G4P GUI Builder  4.4
Visual GUI designer for the G4P v4.3.1 library
 All Classes Namespaces Functions Variables
g4p.tool.controls.DBase Class Reference
Inheritance diagram for g4p.tool.controls.DBase:

Classes

class  Zone
 

Public Member Functions

void variableNameChanger ()
 
void make_event_method (ArrayList< String > lines)
 
void make_declaration (ArrayList< String > lines)
 
void make_window_loop (ArrayList< String > lines)
 
void make_creator (ArrayList< String > lines, DBase parent, String window)
 
String show ()
 
String toString ()
 
void draw (Graphics2D g2d, DBase selected)
 
void updatedInGUI (int action)
 
void drawSelector (Graphics2D g)
 
void isOver (MutableDBase m, int x, int y)
 
void set_name (String c_name)
 
void set_event_name (String e_name)
 
String get_name ()
 
boolean isSelectable ()
 
boolean isResizeable ()
 
boolean isMoveable ()
 
void makeTableModel ()
 
CtrlPropModel getTableModel ()
 
BufferedImage getImageFromDataFolder (String filename)
 
int getSize ()
 

Public Attributes

String componentClass = ""
 
Integer[] id = new Integer[1]
 
String _0010_name = "APPLICATION"
 
String name_label = "Variable Name"
 
String name_tooltip = "Use Java naming rules"
 
Boolean name_edit = true
 
Boolean name_show = true
 
Validator name_validator = Validator.getValidator(COMPONENT_NAME)
 
String name_updater = "variableNameChanger"
 
int _0820_x = 0
 
String x_label = "X"
 
String x_tooltip = "pixels"
 
Boolean x_edit = true
 
Boolean x_show = true
 
Validator x_validator = Validator.getValidator(int.class, -9999, 9999)
 
int _0821_y = 0
 
String y_label = "Y"
 
String y_tooltip = "pixels"
 
Boolean y_edit = true
 
Boolean y_show = true
 
Validator y_validator = x_validator
 
int _0826_width = 0
 
String width_label = "Width"
 
String width_tooltip = "pixels"
 
Boolean width_edit = true
 
Boolean width_show = true
 
Validator width_validator = Validator.getValidator(int.class, 10, 9999)
 
int _0827_height = 0
 
String height_label = "Height"
 
String height_tooltip = "pixels"
 
Boolean height_edit = true
 
Boolean height_show = true
 
Validator height_validator = width_validator
 
String _0030_eventHandler = "Event handler"
 
String eventHandler_label = "Event method"
 
String eventHandler_tooltip = "unique name for event handler method"
 
Boolean eventHandler_edit = true
 
Boolean eventHandler_show = true
 
Validator eventHandler_validator = Validator.getValidator(COMPONENT_NAME_0)
 
- Public Attributes inherited from g4p.tool.TDataConstants
int COMPONENT_NAME = 0x00000020
 
int COMPONENT_NAME_0 = 0x00000021
 
int COLOUR_SCHEME = 0x00000022
 
int CURSOR_CHANGER = 0x00000023
 
int SLIDER_SKIN = 0x00000024
 
int RENDERER = 0x00000025
 
int KNOB_CTRL = 0x00000026
 
int ICON_POS = 0x00000027
 
int H_ALIGN = 0x00000028
 
int V_ALIGN = 0x00000029
 
int VALUE_TYPE = 0x0000002A
 
int TEXT_ORIENT = 0x0000002B
 
int STICK_TYPE = 0x0000002C
 
int CLOSE_ACTION = 0x0000002D
 
int SCALE = 0x0000002E
 
int FONT = 0x0000002F
 
int FONT_STYLE = 0x00000030
 
int VALID = 0x00000040
 
int INVALID_LENGTH = 0x00000041
 
int FIRST_CHAR_INVALID = 0x00000042
 
int HAS_A_SPACE = 0x00000043
 
int INVALID_CHAR = 0x00000044
 
int UNAVAILABLE = 0x00000045
 
String CODE_TAG = "(//_CODE_:.*:\\d{6}:)"
 
String SK_SIZE = "(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)"
 
String ADD_HANDLER = " {0}.addEventHandler({1}, \"{2}\");\n"
 
String ADD_DRAW_HANDLER = " {0}.addDrawHandler({1}, \"{2}\");\n"
 
String ADD_MOUSE_HANDLER = " {0}.addMouseHandler({1}, \"{2}\");\n"
 
String ADD_KEY_HANDLER = " {0}.addKeyHandler({1}, \"{2}\");\n"
 
String ADD_PRE_HANDLER = " {0}.addPreHandler({1}, \"{2}\");\n"
 
String ADD_POST_HANDLER = " {0}.addPostHandler({1}, \"{2}\");\n"
 
String ADD_CLOSE_HANDLER = " {0}.addOnCloseHandler({1}, \"{2}\");\n"
 
String METHOD_START_0 = "public void {0}({1} source) [ //_CODE_:{2}:{3}:\n"
 
String METHOD_START_1 = "public void {0}({1} source, GEvent event) [ //_CODE_:{2}:{3}:\n"
 
String WIN_DRAW = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String WIN_MOUSE = "synchronized public void {0}(PApplet appc, GWinData data, MouseEvent mevent) [ //_CODE_:{1}:{2}:\n"
 
String WIN_KEY = "synchronized public void {0}(PApplet appc, GWinData data, KeyEvent kevent) [ //_CODE_:{1}:{2}:\n"
 
String WIN_PRE = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String WIN_POST = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String ON_CLOSE = "public void {0}(GWindow window) [ //_CODE_:{1}:{2}:\n"
 
String METHOD_END = "] //_CODE_:{0}:{1}:\n\n"
 
String SET_SKETCH_TITLE = " surface.setTitle(\"{0}\");\n"
 
String SET_SKETCH_COLOR = " G4P.setGlobalColorScheme(GCScheme.{0});\n"
 
String SET_G4P_MESSAGES = " G4P.messagesEnabled({0});\n"
 
String SET_CURSOR_OFF = " G4P.setCursor({0});\n"
 
String SET_MOUSE_OVER_ON = " G4P.setMouseOverEnabled({0});\n"
 
String SET_ROUND_CORNERS = " GButton.useRoundCorners({0});\n"
 
String SET_GLOBAL_DISPLAY_FONT = " G4P.setDisplayFont(\"{0}\", {1}, {2});\n"
 
String SET_GLOBAL_INPUT_FONT = " G4P.setInputFont(\"{0}\", {1}, {2});\n"
 
String SET_GLOBAL_SLIDER_FONT = " G4P.setSliderFont(\"{0}\", {1}, {2});\n"
 
String SET_TEXT = " {0}.setText(\"{1}\");\n"
 
String SET_PROMPT_TEXT = " {0}.setPromptText(\"{1}\");\n"
 
String SET_TEXT_ALIGN = " {0}.setTextAlign(GAlign.{1}, GAlign.{2});\n"
 
String SET_ICON = " {0}.setIcon(\"{1}\", {2}, GAlign.{3}, GAlign.{4}, GAlign.{5});\n"
 
String SET_ICON_POS = " {0}.setIconPos(GAlign.{1});\n"
 
String SET_ICON_ALIGN = " {0}.setIconAlign(GAlign.{1}, GAlign.{2});\n"
 
String SET_TEXT_BOLD = " {0}.setTextBold();\n"
 
String SET_TEXT_ITALIC = " {0}.setTextItalic();\n"
 
String SET_OPAQUE = " {0}.setOpaque({1});\n"
 
String SET_ACTION_ON_CLOSE = " {0}.setActionOnClose(G4P.{1});\n"
 
String SET_LOCAL_COLOR = " {0}.setLocalColorScheme(GCScheme.{1});\n"
 
String CTOR_WINDOW = " {0} = GWindow.getWindow({1}, \"{2}\", {3}, {4}, {5}, {6}, {7});\n {0}.noLoop();\n"
 
String LOOP_WINDOW = " {0}.loop();\n"
 
String CTOR_GBUTTON = " {0} = new GButton({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_IMG_BTN_XYWHFM = " {0} = new GImageButton({1}, {2}, {3}, {4}, {5}, {6}, \"{7}\");\n"
 
String CTOR_IMG_BTN_XYWHF = " {0} = new GImageButton({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_IMG_BTN_XYFM = " {0} = new GImageButton({1}, {2}, {3}, {4}, \"{5}\");\n"
 
String CTOR_IMG_BTN_XYF = " {0} = new GImageButton({1}, {2}, {3}, {4});\n"
 
String CTOR_IMG_TOG_BTN_0 = " {0} = new GImageToggleButton({1}, {2}, {3});\n"
 
String CTOR_IMG_TOG_BTN_1 = " {0} = new GImageToggleButton({1}, {2}, {3}, \"{4}\", {5}, {6});\n"
 
String CTOR_IMG_TOG_BTN_2 = " {0} = new GImageToggleButton({1}, {2}, {3}, \"{4}\", \"{5}\", {6}, {7});\n"
 
String CTOR_GSTICK = " {0} = new GStick({1}, {2}, {3}, {4}, {5});\n"
 
String SET_STICK_MODE = " {0}.setMode(G4P.{1});\n"
 
String CTOR_GCHECKBOX = " {0} = new GCheckbox({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_GLABEL = " {0} = new GLabel({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_VIEW = " {0} = new GView({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_VIEW_PCAM_6 = " {0} = new GViewPeasyCam({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_VIEW_PCAM_9 = " {0} = new GViewPeasyCam({1}, {2}, {3}, {4}, {5}, new PVector({6}, {7}, {8}), {9});\n"
 
String CTOR_GOPTION = " {0} = new GOption({1}, {2}, {3}, {4}, {5});\n"
 
String SEL_OPTION = " {0}.setSelected({1});\n"
 
String CTOR_GOPTIONGROUP = " {0} = new GToggleGroup();\n"
 
String CTOR_GPANEL = " {0} = new GPanel({1}, {2}, {3}, {4}, {5}, \"{6}\");\n"
 
String COLLAPSED = " {0}.setCollapsed({1});\n"
 
String COLLAPSIBLE = " {0}.setCollapsible({1});\n"
 
String DRAGGABLE = " {0}.setDraggable({1});\n"
 
String CTOR_GPASSWORD1 = " {0} = new GPassword({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_GPASSWORD2 = " {0} = new GPassword({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String PWORD_SIZE = " {0}.setMaxWordLength({1});\n"
 
String CTOR_GTEXTFIELD = " {0} = new GTextField({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_GTEXTAREA = " {0} = new GTextArea({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String SBAR_POLICY = ""
 
String CTOR_GSLIDER = " {0} = new GSlider({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_GSLIDER2D = " {0} = new GSlider2D({1}, {2}, {3}, {4}, {5});\n"
 
String MAKE_VERT = " {0}.setRotation({1}, GControlMode.CORNER);\n"
 
String SET_LIMITS = " {0}.setLimits({1}, {2}, {3});\n"
 
String SET_X_LIMITS = " {0}.setLimitsX({1}, {2}, {3});\n"
 
String SET_Y_LIMITS = " {0}.setLimitsY({1}, {2}, {3});\n"
 
String SET_VALUE_TYPE = " {0}.setNumberFormat(G4P.{1}, {2});\n"
 
String SET_NBR_TICKS = " {0}.setNbrTicks({1});\n"
 
String SET_STICK_TICKS = " {0}.setStickToTicks({1});\n"
 
String SET_SHOW_TICKS = " {0}.setShowTicks({1});\n"
 
String SET_SHOW_VALUE = " {0}.setShowValue({1});\n"
 
String SET_SHOW_LIMITS = " {0}.setShowLimits({1});\n"
 
String SET_TEXT_ORIENT = " {0}.setTextOrientation(G4P.{1});\n"
 
String SET_EASING = " {0}.setEasing({1});\n"
 
String CTOR_GCUSTOMSLIDER = " {0} = new GCustomSlider({1}, {2}, {3}, {4}, {5}, \"{6}\");\n"
 
String CTOR_GTIMER = " {0} = new GTimer({1}, {2}, \"{3}\", {4});\n"
 
String START_TIMER_0 = " {0}.start();\n"
 
String START_TIMER_1 = " {0}.start({1});\n"
 
String INIT_DELAY_TIMER = " {0}.setInitialDelay({1});\n"
 
String CTOR_GKNOB = " {0} = new GKnob({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String SET_TURN_RANGE = " {0}.setTurnRange({1}, {2});\n"
 
String SET_CONTROLLER = " {0}.setTurnMode(GKnob.CTRL_{1});\n"
 
String SET_DRAG_SENSITIVITY = " {0}.setSensitivity({1});\n"
 
String SET_SHOW_TRACK = " {0}.setShowTrack({1});\n"
 
String SET_SHOW_ARC_ONLY = " {0}.setShowArcOnly({1});\n"
 
String SET_OVER_ARC_ONLY = " {0}.setOverArcOnly({1});\n"
 
String SET_OVER_GRIP_ONLY = " {0}.setIncludeOverBezel({1});\n"
 
String CTOR_DROPLIST = " {0} = new GDropList({1}, {2}, {3}, {4}, {5}, {6}, {7});\n"
 
String CTOR_SET_LIST = " {0}.setItems(loadStrings(\"{1}\"), {2});\n"
 
String TIME = "+ millis());\n"
 
String EVENT_TYPE_TIME = "+ event + \" @ \" + millis());\n"
 
String CODE_ANY = " println(\"{0} - {1} >> GEvent.\" " + EVENT_TYPE_TIME
 
String CODE_NO_EVENT_PARAM = " println(\"{0} - {1} >> an event occured @ \" " + TIME
 
String CODE_GWINDOW_DRAW = " appc.background(230);\n"
 
String CODE_GWINDOW_MOUSE = " println(\"{0} - mouse event \" " + TIME
 
String CODE_GWINDOW_KEY = " println(\"{0} - key event \" " + TIME
 
String CODE_GWINDOW_PRE = " println(\"{0} - pre method called \" " + TIME
 
String CODE_GWINDOW_POST = " println(\"{0} - post method called \" " + TIME
 
String CODE_GWINDOW_CLOSE = " println(\"{0} - window closed at \" " + TIME
 
String INDENT = " "
 
String ADD_A_CHILD = " {0}.addControl({1});\n"
 
- Public Attributes inherited from g4p.tool.TFileConstants
final String SEP = File.separator
 
final String PDE_TAB_PRETTY_NAME = "gui"
 
final String PDE_TAB_NAME = PDE_TAB_PRETTY_NAME + ".pde"
 
final String CONFIG_FOLDER = "GUI_BUILDER_DATA"
 
final String GUI_MODEL_FILE_FILTER = "gui.ser."
 
final String GUI_MODEL_FILENAME = GUI_MODEL_FILE_FILTER + G4PTool.getCompatibleVersionNo()
 
final String GUI_MODEL_FILE = CONFIG_FOLDER + SEP + GUI_MODEL_FILENAME
 
final String G4P_TOOL_DATA_FOLDER = "tools" + SEP + "##project.name##" + SEP + "data"
 
final String G4P_LIB = "G4P" + SEP + "library" + SEP + "G4P.jar"
 
final String GUI_PDE_BASE = G4P_TOOL_DATA_FOLDER + SEP + "gui_base.txt"
 
final String TAB0_PDE_BASE = G4P_TOOL_DATA_FOLDER + SEP + "tab0.txt"
 
- Public Attributes inherited from g4p.tool.TGuiConstants
int HANDLE_SIZE = 6
 
int OVER_NONE = 0x00000000
 
int OVER_COMP = 0x00000200
 
int OVER_HORZ = 0x00000201
 
int OVER_VERT = 0x00000202
 
int OVER_DIAG = 0x00000203
 
int MOVED = 0x00010001
 
int RESIZED = 0x00010002
 
int LEFT = 0x00000000
 
int RIGHT = 0x00000001
 
int CENTER = 0x00000002
 
int TOP = 0x00000000
 
int BOTTOM = 0x00000001
 
int MIDDLE = 0x00000002
 
int NORTH = 0x00000000
 
int SOUTH = 0x00000001
 
int EAST = 0x00000002
 
int WEST = 0x00000003
 
int TEXT_ONLY = 0x00000000
 
int ICON_ONLY = 0x00000001
 
int TEXT_AND_ICON = 0x00000002
 
BasicStroke stdStroke
 
BasicStroke selStroke
 
BasicStroke needleStroke
 
BasicStroke heavyStroke
 
BasicStroke dashed
 
Color DASHED_EDGE_COLOR = new Color(32,32,32,128)
 
Color csdrBack = new Color(0,0,0, 8)
 
Color csdrBorder = new Color(0,0,0, 32)
 
Color csdrSlideBack = new Color(220, 220, 220)
 
Color csdrSlideBorder = new Color(64, 64, 64)
 
Color csdrThumb = new Color(255,255,0)
 
Color winBack = new Color(240,240,240)
 
Color winEdge = new Color(160,160,160)
 

Static Public Attributes

static int globalColorSchemeID = GCScheme.BLUE_SCHEME
 
static String globalColorSchemeName = "BLUE_SCHEME"
 
static Color[] globalJpalette = GCScheme.getJavaColor(globalColorSchemeID)
 
static Font globalDisplayFont = new Font("Arial", Font.PLAIN, 12)
 
static Font globalInputFont = new Font("Arial", Font.PLAIN, 12)
 
static Font globalSliderFont = new Font("Arial", Font.BOLD, 11)
 

Protected Member Functions

String get_declaration ()
 
String get_creator (DBase parent, String window)
 
String get_event_definition ()
 
String get_event_code ()
 
String get_event_code (int n)
 
String get_event_header (int n)
 
String get_event_header ()
 
String get_event_end (int n)
 
String get_event_end ()
 
String get_window_loop ()
 
void read ()
 
void drawHandle (Graphics2D g, int x, int y)
 
boolean isOverRectangle (int px, int py, int x, int y, int w, int h)
 

Static Protected Member Functions

static String (int i)
 
static String (float f)
 

Protected Attributes

transient CtrlPropModel propertyModel
 
boolean selectable = true
 
boolean resizeable = true
 
boolean moveable = true
 

Static Protected Attributes

static boolean useRoundCorners = true
 

Package Attributes

StyledString name = null
 

Detailed Description

Every control in the G4P library has its equivalent class in this package, for instance GButton –> DButton. The classes in this package provide information about the properties available in the property grid for a particular component.
If an attribute identifier in one of these classes starts with an underscore followed by a 4 digit numbers then it is to become a property e.g.

_0131_height


The 4 digit number is used to decide the order properties should appear in the property grid.
The part after the second underscore is the property name and this is used to provide additional information about the property, so for

_0131_height


height_label

is the text that describes the property in the grid.

height_edit

can the property be edited.

height_show

is the property visible in the grid.

height_tooltip

the tooltip text for the property grid.

height_editor

the object used to edit the property.

height_validator

the object used to validate the proerty value.

height_updater

the name of the method to call after the property has changed.

If an editor and or validator is not specified for each property a default one based on the data type is provided.

The program uses reflection to get these attributes which are used to create a table model (CtrlPropModel class) for the property grid table (CtrlPropView class).

Author
Peter Lager

Member Function Documentation

void g4p.tool.controls.DBase.draw ( Graphics2D  g2d,
DBase  selected 
)

Called when the display is painted.

Parameters
g2dGraphics2D context
selectedcurrently selected control.
void g4p.tool.controls.DBase.drawHandle ( Graphics2D  g,
int  x,
int  y 
)
protected

Draw a grab handle to resize the control

Parameters
g
x
y
void g4p.tool.controls.DBase.drawSelector ( Graphics2D  g)

Draw a selector if the control is the one being edited.

Parameters
g
String g4p.tool.controls.DBase.get_creator ( DBase  parent,
String  window 
)
protected

Get the creator statement

var = new Foo(...);


Override this method in all classes.

String g4p.tool.controls.DBase.get_declaration ( )
protected

Get the declaration for this control

Foo variable_name;


Overridden in :- DWindow

String g4p.tool.controls.DBase.get_event_code ( )
protected

Get the event code if none then return generic message.

Overridden in :- DTimer

Returns
event handler code
String g4p.tool.controls.DBase.get_event_code ( int  n)
protected

Some controls have more than one event associated with it e.g. DWindows has 6 one for each of the possible events.

This method will get the code associated with one of these id numbers so this method can get called several times for a control.

If it cannot find any code then it will return a generic message.

Overridden in :- DWindow

Parameters
nthe index used for the event id
Returns
String g4p.tool.controls.DBase.get_event_definition ( )
protected

Get the generic event method definition including any associated code.

Overridden in :- DWindow

Modified 09-02-2013 to return null if no method name

String g4p.tool.controls.DBase.get_event_end ( int  n)
protected

Get the event method end with tag

Returns
String g4p.tool.controls.DBase.get_event_header ( int  n)
protected

Get the generic event header for an event

Returns
BufferedImage g4p.tool.controls.DBase.getImageFromDataFolder ( String  filename)

Will return null if no image was loaded.

Parameters
filename
Returns
int g4p.tool.controls.DBase.getSize ( )

Get the actual area of the control

Returns
CtrlPropModel g4p.tool.controls.DBase.getTableModel ( )

Get the property model for this component. If it does not exist then create it first.

Returns
void g4p.tool.controls.DBase.isOver ( MutableDBase  m,
int  x,
int  y 
)

Determines whether a position is over the control and if it is whether it is over the body of the control or a resize handle.

Parameters
m
x
y
boolean g4p.tool.controls.DBase.isOverRectangle ( int  px,
int  py,
int  x,
int  y,
int  w,
int  h 
)
protected

Helper method to see if a position is over a given rectangle.

Parameters
px
py
x
y
w
h
Returns
void g4p.tool.controls.DBase.make_creator ( ArrayList< String lines,
DBase  parent,
String  window 
)

Recursive function to first get the creator code for this component then repeat for any children.
This method is overridden in DWindow, DPanel and DOptionGroup.

Parameters
lines
parentthe control that has this as a child default = null
windowthe window responsible for drawing this control default = "this"
void g4p.tool.controls.DBase.make_declaration ( ArrayList< String lines)

Recursive function to get the variable declaration.

Parameters
lines
void g4p.tool.controls.DBase.make_event_method ( ArrayList< String lines)

Recursive function to get the event methods for all controls

Parameters
lines
void g4p.tool.controls.DBase.make_window_loop ( ArrayList< String lines)

Make windows.loop() statements

Parameters
lines
String g4p.tool.controls.DBase.show ( )

Display details - used for debugging only

static g4p.tool.controls.DBase.String ( int  i)
staticprotected

This method was added to overcome a problem using the MessageFormat class where the locale insisted in inserting thousand separators in numbers. Instead of passing an int to MessageFormat this method means we can pass a String.

static g4p.tool.controls.DBase.String ( float  f)
staticprotected

This method was added to overcome a problem using the MessageFormat class where the locale insisted in inserting thousand separators in numbers. Instead of passing a float to MessageFormat this method means we can pass a String.

String g4p.tool.controls.DBase.toString ( )

Use this to return the name of the component

void g4p.tool.controls.DBase.updatedInGUI ( int  action)

Called when the control has been changed in the GUI.
Override if needed.

Parameters
actionMOVED or RESIZED

Member Data Documentation

transient CtrlPropModel g4p.tool.controls.DBase.propertyModel
protected

The property model used in the table view


The documentation for this class was generated from the following file: