devisor2.grid.options
Class ControlCenter

java.lang.Object
  extended bydevisor2.grid.options.ControlCenter

public class ControlCenter
extends java.lang.Object

This class has three important roles in the DeViSoRGriD 2 application.

During startup, it is responsible for creating and loading the locale and RessourceBundle to provide access to button captions etc. It also instanciates ALL dialogs (which are implemented as static), therefore EVERY dialog the programmer ever adds to the application must be registered in this class's initDialogs method. As we implemented pluggable Look&Feel for the application, there has to be one central class where dialogs are stored so that a dynamic change of the look&feel affects the dialogs as well.

Secondly, this class offers access to the global variables the application definitely needed. I know global variables and object- oriented programming don't match, but as we decided to design a very modular and open software, it made things a lot easier to have global access to the central options management and storage class Options and to the locale class providing captions for all buttons etc.
The global variables are mostly single variables which can be accessed directly.
Thirdly, the so-called MODE of the application is managed here. To explain the term MODE: To make sure there is only one legal type of operation at any time, the application must always be in one and only one mode. The mode specifies what type of operation is invoked when the user performs clicks and drags on the center drawing area. We made strict rules on mode changes resulting in performing certain operations, documented in "ZAP BRANNAGAN's BIG BOOK OF OPERATIONS AND RULES" to be found in the /manual/specs directory of your devisorgrid2 installation.

A last note on the dialog structure of the application:
All dialogs are implemented as static, allowing for minimum effort to display them. Here in this class, they are initialized, meaning the GUI is created. They still remain hidden though. Whenever wanted, they can be displayed using the corresponding showDialog()<\code> method.

Example of how to use the ControlCenter:
(1) Add a ControlCenter reference to the class you're in:
private ControlCenter cc; <\code>
(2) In the constructor, set it to this class:
cc = ControlCenter.getMyself ();<\code>
(3) Extract whatever you want from the Options reference op or the ResourceBundle reference rb. See documentation of Options or Locale_en_US for details about that. OR get the current selection type or boundary etc. respectively

See Also:
devisor2.options.Options

Field Summary
static int ADD_CIRCLEM
          indicates that CIRCLEMS are addable at the moment
static int ADD_CIRCLEP
          indicates that CIRCLEPS are addable at the moment
static int ADD_CLIPBOARD
          indicates that CLIPBOARD is addable at the moment
static int ADD_LINE
          indicates that LINES are addable at the moment
static int ADD_MACRO
          indicates that MACROS are addable at the moment
static int ADD_MULTILINE
          indicates that MULTILINES are addable at the moment
static int ADD_NODE
          indicates that NODES are addable at the moment
static int ADD_NOTHING
          indicates that nothing is addable at the moment
static int ADD_QUAD
          indicates that QUADS are addable at the moment
static int ADD_TRI
          indicates that TRIS are addable at the moment
 int addType
          Flag to indicate the current ADD TYPE, use constants provided below in this class.
static boolean APPEND
          constant for the copy mode add new boundaries
 boolean copymode
          Flag to determine the copy mode: KEEPSTRUCTURE <=> new boundaries are created APPEND <=> cloned segments are appended to their boundary
 Domain d
          the global Domain instance
 DrawControl dc
          the global DrawControl instance
 boolean directMode
          Flag to indicate that direct input is active, default is false.
 DialogManager dm
          reference to the dialog manager
static int DRAW_MODE
          indicates that drawing is the current mode
static int EDGESTATUS_MODE
          indicates that setting edge status is the current mode
 FAQFrame faq
          the global faq Frame reference
 GridControl gc
          the global GridControl instance
 int globalscale
          the global precision scale factor
 int globalscale2
           
 int globalscaledigits
           
 HelpFrame help
          the global help Frame reference
static boolean KEEPSTRUCTURE
          constant for the copy mode keep boundary structure
 java.util.Locale locale
          the global Locale
static int MIRROR_MODE
          indicates that mirroring is the current mode
 int mode
          Flag to indicate the current MODE, use constants provided default is NO_MODE
static int NO_MODE
          indicates that no mode is the current mode
 Options op
          the global Options instance
static int PARALLELBLOCK_MODE
          indicates that setting parallelblocks is the current mode
 int[] perimeter
          the global user space perimeter
static int PROPERTY_MODE
          indicates that querying properties is the current mode
 java.util.ResourceBundle rb
          the global ResourceBundle
 ReadmeFrame readme
          the global read Frame reference
static int RECTIFYELEMENT_MODE
          indicates that rectifying elements is the current mode
static int REFINE_MODE
          indicates that refining is the current mode
 boolean selectEdges
          Flag whether EDGES are selectable, default is FALSE
 boolean selectElements
          Flag whether ELEMENTS are selectable, default is FALSE
 boolean selectNodes
          Flag whether NODES are selectable, default is FALSE
 boolean selectSegments
          Flag whether SEGMENTS are selectable, default is FALSE
 devisor2.grid.backend.undo.UndoManager um
          reference to the undo manager
static int ZOOM_IN
          indicates that zooming in is available at the moment
static int ZOOM_MODE
          indicates that zooming is the current mode
static int ZOOM_NONE
          indicates that no zooming is available at the moment
static int ZOOM_SET
          indicates that set zoom is available at the moment
 int zoomType
          Flag to indicate the current ZOOM TYPE, please use constants provided in this class
 
Constructor Summary
ControlCenter(Options options)
          the constructor initializes some neccessary stuff such as locale and resources.
 
Method Summary
 java.lang.String getModeString()
           
static ControlCenter getMyself()
          a static self-deliverer for easy access from within the application.
static java.lang.String wS(java.lang.String key)
          wrapper method for access to resource strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d

public Domain d
the global Domain instance


globalscale

public int globalscale
the global precision scale factor


globalscale2

public int globalscale2

globalscaledigits

public int globalscaledigits

perimeter

public int[] perimeter
the global user space perimeter


op

public Options op
the global Options instance


dc

public DrawControl dc
the global DrawControl instance


gc

public GridControl gc
the global GridControl instance


locale

public java.util.Locale locale
the global Locale


rb

public java.util.ResourceBundle rb
the global ResourceBundle


help

public HelpFrame help
the global help Frame reference


faq

public FAQFrame faq
the global faq Frame reference


readme

public ReadmeFrame readme
the global read Frame reference


copymode

public boolean copymode
Flag to determine the copy mode: KEEPSTRUCTURE <=> new boundaries are created APPEND <=> cloned segments are appended to their boundary


selectNodes

public boolean selectNodes
Flag whether NODES are selectable, default is FALSE


selectElements

public boolean selectElements
Flag whether ELEMENTS are selectable, default is FALSE


selectSegments

public boolean selectSegments
Flag whether SEGMENTS are selectable, default is FALSE


selectEdges

public boolean selectEdges
Flag whether EDGES are selectable, default is FALSE


addType

public int addType
Flag to indicate the current ADD TYPE, use constants provided below in this class. Default is ADD_NOTHING.


zoomType

public int zoomType
Flag to indicate the current ZOOM TYPE, please use constants provided in this class


mode

public int mode
Flag to indicate the current MODE, use constants provided default is NO_MODE


directMode

public boolean directMode
Flag to indicate that direct input is active, default is false.


dm

public DialogManager dm
reference to the dialog manager


um

public devisor2.grid.backend.undo.UndoManager um
reference to the undo manager


KEEPSTRUCTURE

public static final boolean KEEPSTRUCTURE
constant for the copy mode keep boundary structure

See Also:
Constant Field Values

APPEND

public static final boolean APPEND
constant for the copy mode add new boundaries

See Also:
Constant Field Values

ADD_NOTHING

public static final int ADD_NOTHING
indicates that nothing is addable at the moment

See Also:
Constant Field Values

ADD_NODE

public static final int ADD_NODE
indicates that NODES are addable at the moment

See Also:
Constant Field Values

ADD_LINE

public static final int ADD_LINE
indicates that LINES are addable at the moment

See Also:
Constant Field Values

ADD_MULTILINE

public static final int ADD_MULTILINE
indicates that MULTILINES are addable at the moment

See Also:
Constant Field Values

ADD_CIRCLEP

public static final int ADD_CIRCLEP
indicates that CIRCLEPS are addable at the moment

See Also:
Constant Field Values

ADD_CIRCLEM

public static final int ADD_CIRCLEM
indicates that CIRCLEMS are addable at the moment

See Also:
Constant Field Values

ADD_TRI

public static final int ADD_TRI
indicates that TRIS are addable at the moment

See Also:
Constant Field Values

ADD_QUAD

public static final int ADD_QUAD
indicates that QUADS are addable at the moment

See Also:
Constant Field Values

ADD_MACRO

public static final int ADD_MACRO
indicates that MACROS are addable at the moment

See Also:
Constant Field Values

ADD_CLIPBOARD

public static final int ADD_CLIPBOARD
indicates that CLIPBOARD is addable at the moment

See Also:
Constant Field Values

NO_MODE

public static final int NO_MODE
indicates that no mode is the current mode

See Also:
Constant Field Values

ZOOM_MODE

public static final int ZOOM_MODE
indicates that zooming is the current mode

See Also:
Constant Field Values

DRAW_MODE

public static final int DRAW_MODE
indicates that drawing is the current mode

See Also:
Constant Field Values

EDGESTATUS_MODE

public static final int EDGESTATUS_MODE
indicates that setting edge status is the current mode

See Also:
Constant Field Values

PARALLELBLOCK_MODE

public static final int PARALLELBLOCK_MODE
indicates that setting parallelblocks is the current mode

See Also:
Constant Field Values

PROPERTY_MODE

public static final int PROPERTY_MODE
indicates that querying properties is the current mode

See Also:
Constant Field Values

RECTIFYELEMENT_MODE

public static final int RECTIFYELEMENT_MODE
indicates that rectifying elements is the current mode

See Also:
Constant Field Values

REFINE_MODE

public static final int REFINE_MODE
indicates that refining is the current mode

See Also:
Constant Field Values

MIRROR_MODE

public static final int MIRROR_MODE
indicates that mirroring is the current mode

See Also:
Constant Field Values

ZOOM_NONE

public static final int ZOOM_NONE
indicates that no zooming is available at the moment

See Also:
Constant Field Values

ZOOM_SET

public static final int ZOOM_SET
indicates that set zoom is available at the moment

See Also:
Constant Field Values

ZOOM_IN

public static final int ZOOM_IN
indicates that zooming in is available at the moment

See Also:
Constant Field Values
Constructor Detail

ControlCenter

public ControlCenter(Options options)
the constructor initializes some neccessary stuff such as locale and resources. After constructor call, all global attributes are accessible via cc.attributename

Parameters:
options - - an Options instance created in the devisorgrid startup class
Method Detail

getMyself

public static ControlCenter getMyself()
a static self-deliverer for easy access from within the application.

Returns:
the global ControlCenter reference itself.

getModeString

public java.lang.String getModeString()
Returns:
the current mode as a string description with full submodes

wS

public static final java.lang.String wS(java.lang.String key)
wrapper method for access to resource strings