org.keridwen.modelling.mesh.inspector.core
Class Context

java.lang.Object
  extended by org.keridwen.modelling.mesh.inspector.core.Context

public class Context
extends Object

Generic context manager to define/know in which software context the application or module is run or instanced. This class should be used as STATIC object as follow:
In the starting code (e.g main method or calling class):
//default settings (at least we try...)
Context.getInstance().setVTK_CONTEXT(true);
Context.getInstance().setPlotContext(true);

//Real test (i.e the context test really if the tested components are
// available.
// test the plotting context (JFreeChart)
Context.getInstance().testPlotcontext();

// load the VTK context if relevant
if (Context.getInstance().isVTK_CONTEXT()) {
Context.getInstance().loadVtkContext();
}

// example of use
if (Context.getInstance().isVTK_CONTEXT()) {
controlPanel.exportToVtkFileButton.setActionCommand(EXPORT_VTK_FILE);
controlPanel.exportToVtkFileButton.addActionListener(this);
controlPanel.exportToVtkFileButton.setEnabled(true);
}

Author:
J.Forest, Artenum SARL.

Field Summary
static String BATCH
           
 boolean cassandraContext
           
static String GRAPHICAL
           
protected  String guiContext
           
protected  boolean keridwenContext
           
protected  com.artenum.penelope.mesh.interfaces.Mesh kerMesh
           
protected  boolean plotContext
           
protected  String StudyPath
           
protected  boolean vtkContext
           
 
Constructor Summary
Context()
           
 
Method Summary
 String getGUI_CONTEXT()
          get the context related to the GUI.
static Context getInstance()
          Gets the singleton instance of Preferences.
 com.artenum.penelope.mesh.interfaces.Mesh getKeridwenMesh()
           
 String getStudyPath()
           
 boolean isCASSANDRA_CONTEXT()
           
 boolean isKERIDWEN_CONTEXT()
           
 boolean isPlotContext()
           
 boolean isVTK_CONTEXT()
          return the VTK context (i.e if VTK based functions are operational or not).
 void loadVtkContext()
          Load (i.e test) if the VTK context is available or not.
 void setCASSANDRA_CONTEXT(boolean cASSANDRACONTEXT)
          Set the Cassandra context, to indicate if a Cassandra viewer (see http://www.artenum.com/cassandra) is linked to the current inspector.
 void setContext(String GUI_CONTEXT, boolean CASSANDRA_CONTEXT, boolean KERIDWEN_CONTEXT, boolean VTK_CONTEXT)
           
 void setGUI_CONTEXT(String guiContext)
          set the context related to the GUI, i.e a flag (string) to know if the GUI can be/should be displayed or not.
 void setKERIDWEN_CONTEXT(boolean kERIDWENCONTEXT)
          Set the Keridwen context, i.e if the application is running as KerModule and/or a KerDataBus is available or not.
 void setKeridwenMesh(com.artenum.penelope.mesh.interfaces.Mesh mesh)
          Set the mesh to inspect directly from a mesh object in memory.
 void setPlotContext(boolean plotContext)
          Set the plot context for the JFreeChart plotting features.
 void setStudyPath(String studyPath)
           
 void setVTK_CONTEXT(boolean vTKCONTEXT)
          Set the VTK context (i.e to set if VTK based functions be operational or not).
 void testPlotcontext()
          test the presence of the JFreeMesh library in the classpath (see third part components) or not and set the plotting context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BATCH

public static final String BATCH
See Also:
Constant Field Values

GRAPHICAL

public static final String GRAPHICAL
See Also:
Constant Field Values

guiContext

protected String guiContext

cassandraContext

public boolean cassandraContext

keridwenContext

protected boolean keridwenContext

vtkContext

protected boolean vtkContext

plotContext

protected boolean plotContext

kerMesh

protected com.artenum.penelope.mesh.interfaces.Mesh kerMesh

StudyPath

protected String StudyPath
Constructor Detail

Context

public Context()
Method Detail

getInstance

public static Context getInstance()
Gets the singleton instance of Preferences.

Returns:
The singleton instance

setContext

public void setContext(String GUI_CONTEXT,
                       boolean CASSANDRA_CONTEXT,
                       boolean KERIDWEN_CONTEXT,
                       boolean VTK_CONTEXT)

getGUI_CONTEXT

public String getGUI_CONTEXT()
get the context related to the GUI. If GRAPHICAL, a GUI can be displayed, otherwise not.

Returns:

setGUI_CONTEXT

public void setGUI_CONTEXT(String guiContext)
set the context related to the GUI, i.e a flag (string) to know if the GUI can be/should be displayed or not.
If GRAPHICAL, a GUI can be displayed, otherwise not.

Parameters:
guiContext -

isCASSANDRA_CONTEXT

public boolean isCASSANDRA_CONTEXT()
Returns:
return if the Cassandra context status (true or not). If the Cassandra context is true, this means that a Cassandra viewer (see http://www.artenum.com/cassandra) is linked to the current inspector.

setCASSANDRA_CONTEXT

public void setCASSANDRA_CONTEXT(boolean cASSANDRACONTEXT)
Set the Cassandra context, to indicate if a Cassandra viewer (see http://www.artenum.com/cassandra) is linked to the current inspector.

Parameters:
cASSANDRACONTEXT -

isKERIDWEN_CONTEXT

public boolean isKERIDWEN_CONTEXT()

setKERIDWEN_CONTEXT

public void setKERIDWEN_CONTEXT(boolean kERIDWENCONTEXT)
Set the Keridwen context, i.e if the application is running as KerModule and/or a KerDataBus is available or not. See Keridwen's documentation for further information (www.artenum.com or www.keridwen.org).

Parameters:
kERIDWENCONTEXT -

setKeridwenMesh

public void setKeridwenMesh(com.artenum.penelope.mesh.interfaces.Mesh mesh)
Set the mesh to inspect directly from a mesh object in memory. Used for instance,

Parameters:
mesh -

getKeridwenMesh

public com.artenum.penelope.mesh.interfaces.Mesh getKeridwenMesh()

isVTK_CONTEXT

public boolean isVTK_CONTEXT()
return the VTK context (i.e if VTK based functions are operational or not).

Returns:

setVTK_CONTEXT

public void setVTK_CONTEXT(boolean vTKCONTEXT)
Set the VTK context (i.e to set if VTK based functions be operational or not).

Parameters:
vTKCONTEXT -

testPlotcontext

public void testPlotcontext()
test the presence of the JFreeMesh library in the classpath (see third part components) or not and set the plotting context.


loadVtkContext

public void loadVtkContext()
Load (i.e test) if the VTK context is available or not. Take care, that this status may depend from the platform. The method call a VtkContextLoader that tries to load the VTK related native layer. If this not possible, the vtk context is overwrite to false.


isPlotContext

public boolean isPlotContext()

setPlotContext

public void setPlotContext(boolean plotContext)
Set the plot context for the JFreeChart plotting features.

Parameters:
plotContext -

getStudyPath

public String getStudyPath()

setStudyPath

public void setStudyPath(String studyPath)


Copyright © 2013 Artenum. All Rights Reserved.