Commit in gui4gl/src/org/codejive/gui4gl/widgets on MAIN | |||
CompoundWidget.java | +15 | -10 | 1.2 -> 1.3 |
Widget.java | +20 | -25 | 1.17 -> 1.18 |
TextField.java | +13 | -11 | 1.7 -> 1.8 |
Toggle.java | +14 | -13 | 1.6 -> 1.7 |
Window.java | +12 | -11 | 1.12 -> 1.13 |
Button.java | +15 | -14 | 1.10 -> 1.11 |
ValueBar.java | +24 | -14 | 1.14 -> 1.15 |
Screen.java | +14 | -4 | 1.13 -> 1.14 |
Container.java | +17 | -8 | 1.14 -> 1.15 |
Text.java | +17 | -7 | 1.7 -> 1.8 |
Toplevel.java | +16 | -6 | 1.4 -> 1.5 |
+177 | -123 |
Did a rollback of the previous code because it was introducing more problems than solving them. A widget's name is now set in the constructor and can not be changed anymore.
diff -u -r1.2 -r1.3 --- CompoundWidget.java 14 Dec 2003 03:09:55 -0000 1.2 +++ CompoundWidget.java 15 Dec 2003 11:06:00 -0000 1.3 @@ -22,6 +22,11 @@
protected Widget m_focusWidget; public CompoundWidget() {
+ this(null); + } + + public CompoundWidget(String _sName) { + super(_sName);
m_children = new LinkedList(); m_childNames = new HashMap(); m_focusWidget = null;
@@ -30,15 +35,10 @@
protected void add(Widget _child) { m_children.add(_child);
+ if (_child.getName() != null) { + m_childNames.put(_child.getName(), _child); + }
_child.setParent(this);
- _child.setName(""); - } - - protected void add(Widget _child, String _sName) { - m_children.add(_child); - m_childNames.put(_sName, _child); - _child.setParent(this); - _child.setName(_sName);
} protected void remove(Widget _child) {
@@ -228,9 +228,14 @@
/* * $Log$
+ * Revision 1.3 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore. + *
* Revision 1.2 2003/12/14 03:09:55 tako
- * Adding a widget without a name will no longer give it an internally generated - * name, it will just be nameless and Themes properties won't be able to
+ * Adding a widget without a name will no longer give it an internally generated + * name, it will just be nameless and Themes properties won't be able to
* refer to it. * * Revision 1.1 2003/12/14 02:36:26 tako
diff -u -r1.17 -r1.18 --- Widget.java 14 Dec 2003 04:07:23 -0000 1.17 +++ Widget.java 15 Dec 2003 11:06:00 -0000 1.18 @@ -86,22 +86,13 @@
protected Padding m_padding; public Widget() {
- m_parent = null; - m_sName = ""; - m_bounds = new Rectangle(); - m_bEnabled = true; - m_bVisible = true; - m_bCanHaveFocus = false; - - m_keyListeners = new ArrayList(); - m_mouseListeners = new ArrayList(); - - m_currentBounds = new Rectangle(); - m_innerBounds = new Rectangle(); - m_padding = new Padding();
+ this(null);
}
- protected void updateTheme() {
+ public Widget(String _sName) { + m_parent = null; + m_sName = _sName; + m_bounds = new Rectangle();
m_backgroundColor = (GLColor)Theme.getValue(getClass(), getFullName(), "backgroundColor"); m_fTransparancy = Theme.getFloatValue(getClass(), getFullName(), "transparancy"); m_backgroundImage = (Texture)Theme.getValue(getClass(), getFullName(), "backgroundImage");
@@ -124,16 +115,22 @@
m_nDisabledYPadding = Theme.getIntegerValue(getClass(), getFullName(), "yPadding#disabled"); m_disabledTextFont = (Font)Theme.getValue(getClass(), getFullName(), "textFont#disabled"); m_disabledTextFontColor = (GLColor)Theme.getValue(getClass(), getFullName(), "textFontColor#disabled");
+ m_bEnabled = true; + m_bVisible = true; + m_bCanHaveFocus = false; + + m_keyListeners = new ArrayList(); + m_mouseListeners = new ArrayList(); + + m_currentBounds = new Rectangle(); + m_innerBounds = new Rectangle(); + m_padding = new Padding();
} public String getName() { return m_sName; }
- protected void setName(String _sName) { - m_sName = _sName; - } -
public String getFullName() { String sName; if (getParent() != null) {
@@ -146,7 +143,7 @@
} else { sName = getName(); }
- return sName;
+ return (sName != null) ? sName : "";
} protected void setParent(CompoundWidget _parent) {
@@ -595,7 +592,6 @@
} protected void initWidget(RenderContext _context) {
- updateTheme();
calculateBounds(); WidgetRendererModel renderer = (WidgetRendererModel)Theme.getValue(getClass(), getFullName(), "renderer"); if (renderer != null) {
@@ -604,7 +600,6 @@
} protected void updateWidget(RenderContext _context) {
- updateTheme();
calculateBounds(); WidgetRendererModel renderer = (WidgetRendererModel)Theme.getValue(getClass(), getFullName(), "renderer"); if (renderer != null) {
@@ -632,10 +627,10 @@
/* * $Log$
- * Revision 1.17 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.18 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.16 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.7 -r1.8 --- TextField.java 14 Dec 2003 04:07:23 -0000 1.7 +++ TextField.java 15 Dec 2003 11:06:00 -0000 1.8 @@ -48,21 +48,23 @@
private int m_nViewOffset; public TextField() {
- this("");
+ this(null, "");
} public TextField(String _sText) {
+ this(null, _sText); + } + + public TextField(String _sName, String _sText) { + super(_sName); + m_textCursorColor = (GLColor)Theme.getValue(getClass(), getFullName(), "textCursorColor"); + m_nCursorBlinkSpeed = Theme.getIntegerValue(getClass(), getFullName(), "textCursorBlinkSpeed"); +
m_changeListeners = new LinkedList(); setFocusable(true); setText(_sText); }
- protected void updateTheme() { - super.updateTheme(); - m_textCursorColor = (GLColor)Theme.getValue(getClass(), getFullName(), "textCursorColor"); - m_nCursorBlinkSpeed = Theme.getIntegerValue(getClass(), getFullName(), "textCursorBlinkSpeed"); - } -
public String getText() { return m_sText; }
@@ -196,10 +198,10 @@
/* * $Log$
- * Revision 1.7 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.8 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.6 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.6 -r1.7 --- Toggle.java 14 Dec 2003 04:07:23 -0000 1.6 +++ Toggle.java 15 Dec 2003 11:06:00 -0000 1.7 @@ -52,19 +52,17 @@
private List m_changeListeners; public Toggle() {
- this(null, false);
+ this(null, null, false);
} public Toggle(String _sCaption, boolean _bChecked) {
+ this(null, _sCaption, _bChecked); + } + + public Toggle(String _sName, String _sCaption, boolean _bChecked) { + super(_sName);
m_sCaption = _sCaption; m_bChecked = _bChecked;
- setFocusable(true); - - m_changeListeners = new ArrayList(); - } - - protected void updateTheme() { - super.updateTheme();
m_checkColor = (GLColor)Theme.getValue(getClass(), getFullName(), "checkColor"); m_checkBackgroundColor = (GLColor)Theme.getValue(getClass(), getFullName(), "checkBackgroundColor"); m_fCheckTransparancy = Theme.getFloatValue(getClass(), getFullName(), "checkTransparancy");
@@ -74,8 +72,11 @@
m_disabledCheckColor = (GLColor)Theme.getValue(getClass(), getFullName(), "checkColor#disabled"); m_disabledCheckBackgroundColor = (GLColor)Theme.getValue(getClass(), getFullName(), "checkBackgroundColor#disabled"); m_fDisabledCheckTransparancy = Theme.getFloatValue(getClass(), getFullName(), "checkTransparancy#disabled");
+ setFocusable(true); + + m_changeListeners = new ArrayList();
}
-
+
public String getCaption() { return m_sCaption; }
@@ -194,10 +195,10 @@
/* * $Log$
- * Revision 1.6 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.7 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.5 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.12 -r1.13 --- Window.java 14 Dec 2003 04:07:23 -0000 1.12 +++ Window.java 15 Dec 2003 11:06:00 -0000 1.13 @@ -51,17 +51,16 @@
private boolean m_bDragging; public Window() {
- this(null);
+ this(null, null);
} public Window(String _sTitle) {
- m_sTitle = _sTitle; - m_bCenterParent = false; - setVisible(false);
+ this(null, _sTitle);
}
- - protected void updateTheme() { - super.updateTheme();
+ + public Window(String _sName, String _sTitle) { + super(_sName); + m_sTitle = _sTitle;
m_nTitlebarHeight = Theme.getIntegerValue(getClass(), getFullName(), "titlebarHeight"); m_titlebarColor = (GLColor)Theme.getValue(getClass(), getFullName(), "titlebarColor"); m_fTitlebarTransparancy = Theme.getFloatValue(getClass(), getFullName(), "titlebarTransparancy");
@@ -75,6 +74,8 @@
m_fDisabledTitlebarTransparancy = Theme.getFloatValue(getClass(), getFullName(), "titlebarTransparancy#disabled"); m_nDisabledCaptionXPadding = Theme.getIntegerValue(getClass(), getFullName(), "captionXPadding#disabled"); m_nDisabledCaptionYPadding = Theme.getIntegerValue(getClass(), getFullName(), "captionYPadding#disabled");
+ m_bCenterParent = false; + setVisible(false);
} public String getTitle() {
@@ -261,10 +262,10 @@
/* * $Log$
- * Revision 1.12 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.13 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.11 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.10 -r1.11 --- Button.java 14 Dec 2003 04:07:23 -0000 1.10 +++ Button.java 15 Dec 2003 11:06:00 -0000 1.11 @@ -51,27 +51,28 @@
private boolean m_bSelected; public Button() {
- this(null);
+ this(null, null);
} public Button(String _sCaption) {
- m_sCaption = _sCaption; - setFocusable(true); - - m_actionListeners = new ArrayList(); - m_bSelected = false;
+ this(null, _sCaption);
}
- - protected void updateTheme() { - super.updateTheme();
+ + public Button(String _sName, String _sCaption) { + super(_sName); + m_sCaption = _sCaption;
m_selectedTextFont = (Font)Theme.getValue(getClass(), getFullName(), "textFont#selected"); m_selectedTextFontColor = (GLColor)Theme.getValue(getClass(), getFullName(), "textFontColor#selected"); m_nSelectedXPadding = Theme.getIntegerValue(getClass(), getFullName(), "xPadding#selected"); m_nSelectedYPadding = Theme.getIntegerValue(getClass(), getFullName(), "yPadding#selected"); m_selectedBackgroundColor = (GLColor)Theme.getValue(getClass(), getFullName(), "backgroundColor#selected"); m_fSelectedTransparancy = Theme.getFloatValue(getClass(), getFullName(), "transparancy#selected");
+ setFocusable(true); + + m_actionListeners = new ArrayList(); + m_bSelected = false;
}
-
+
public String getCaption() { return m_sCaption; }
@@ -203,10 +204,10 @@
/* * $Log$
- * Revision 1.10 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.11 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.9 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.14 -r1.15 --- ValueBar.java 14 Dec 2003 04:07:23 -0000 1.14 +++ ValueBar.java 15 Dec 2003 11:06:00 -0000 1.15 @@ -57,40 +57,50 @@
private List m_changeListeners; public ValueBar(float _fMin, float _fMax) {
- this(_fMin, _fMax, 1.0f, false, GLText.ALIGN_CENTER);
+ this(null, _fMin, _fMax, 1.0f, false, GLText.ALIGN_CENTER);
+ }
+
+ public ValueBar(String _sName, float _fMin, float _fMax) {
+ this(_sName, _fMin, _fMax, 1.0f, false, GLText.ALIGN_CENTER);
} public ValueBar(float _fMin, float _fMax, float _fStepSize) {
- this(_fMin, _fMax, _fStepSize, false, GLText.ALIGN_CENTER);
+ this(null, _fMin, _fMax, _fStepSize, false, GLText.ALIGN_CENTER);
+ }
+
+ public ValueBar(String _sName, float _fMin, float _fMax, float _fStepSize) {
+ this(_sName, _fMin, _fMax, _fStepSize, false, GLText.ALIGN_CENTER);
+ }
+
+ public ValueBar(float _fMin, float _fMax, float _fStepSize, boolean _bShowValue, int _lAlignment) {
+ this(null, _fMin, _fMax, _fStepSize, _bShowValue, _lAlignment);
} /**
- *
+ * @param _sName
* @param _fMin * @param _fMax * @param _fStepSize * @param __bShowValue * @param _lAlignment see GLText for values. */
- public ValueBar(float _fMin, float _fMax, float _fStepSize, boolean _bShowValue, int _lAlignment) {
+ public ValueBar(String _sName, float _fMin, float _fMax, float _fStepSize, boolean _bShowValue, int _lAlignment) {
+ super(_sName);
+
setAlignment(_lAlignment); setShowValue(_bShowValue); m_fMin = _fMin; m_fMax = _fMax; m_fStepSize = _fStepSize;
- m_changeListeners = new LinkedList(); - setFocusable(true); - } - - protected void updateTheme() { - super.updateTheme();
m_barColor = (GLColor)Theme.getValue(getClass(), getFullName(), "barColor"); m_fBarTransparancy = Theme.getFloatValue(getClass(), getFullName(), "barTransparancy"); m_focusedBarColor = (GLColor)Theme.getValue(getClass(), getFullName(), "barColor#focused"); m_fFocusedBarTransparancy = Theme.getFloatValue(getClass(), getFullName(), "barTransparancy#focused"); m_disabledBarColor = (GLColor)Theme.getValue(getClass(), getFullName(), "barColor#disabled"); m_fDisabledBarTransparancy = Theme.getFloatValue(getClass(), getFullName(), "barTransparancy#disabled");
+ m_changeListeners = new LinkedList(); + setFocusable(true);
} public boolean isShowValue() {
@@ -248,10 +258,10 @@
} /* * $Log$
- * Revision 1.14 2003/12/14 04:07:23 tako - * Moved property initialization code from the widget constructors to the new - * method updateTheme() because with the new hierarchical property - * system we have to wait until the entire widget tree has been constructed.
+ * Revision 1.15 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore.
* * Revision 1.13 2003/12/14 03:13:57 tako * Widgets used in CompoundWidgets can now have their properties set
diff -u -r1.13 -r1.14 --- Screen.java 11 Dec 2003 10:49:25 -0000 1.13 +++ Screen.java 15 Dec 2003 11:06:00 -0000 1.14 @@ -43,6 +43,11 @@
private int m_nLastXPos, m_nLastYPos; public Screen() {
+ this(null); + } + + public Screen(String _sName) { + super(_sName);
m_widgetUnderMouse = null; m_widgetPressed = null; m_nLastXPos = m_nLastYPos = -1;
@@ -60,9 +65,9 @@
} }
- public void add(Widget _child, String _sName) {
+ public void add(Widget _child) {
if (_child instanceof Toplevel) {
- super.add(_child, _sName);
+ super.add(_child);
} else { throw new RuntimeException("Screen only accepts Toplevel widgets as it children"); }
@@ -277,9 +282,14 @@
/* * $Log$
+ * Revision 1.14 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore. + *
* Revision 1.13 2003/12/11 10:49:25 tako
- * All mouse events now include information about which button changed - * state.
+ * All mouse events now include information about which button changed + * state.
* Fixed null pointer exception in getActiveToplevel(). * * Revision 1.12 2003/11/25 16:28:00 tako
diff -u -r1.14 -r1.15 --- Container.java 14 Dec 2003 03:13:57 -0000 1.14 +++ Container.java 15 Dec 2003 11:06:00 -0000 1.15 @@ -32,14 +32,18 @@
*/ public class Container extends CompoundWidget {
+ public Container() { + this(null); + } + + public Container(String _sName) { + super(_sName); + } +
public void add(Widget _child) { super.add(_child); }
- public void add(Widget _child, String _sName) { - super.add(_child, _sName); - } -
protected Widget getChild(String _sName) { return (Widget)m_childNames.get(_sName); }
@@ -92,11 +96,16 @@
/* * $Log$
+ * Revision 1.15 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore. + *
* Revision 1.14 2003/12/14 03:13:57 tako
- * Widgets used in CompoundWidgets can now have their properties set - * specifically within the CompoundWidgets hierarchy. Each widget within - * a CompoundWidget can have a (unique) name which can be used in the - * Theme properties like <widgetname>.<propertyname>. If the hierarchy
+ * Widgets used in CompoundWidgets can now have their properties set + * specifically within the CompoundWidgets hierarchy. Each widget within + * a CompoundWidget can have a (unique) name which can be used in the + * Theme properties like <widgetname>.<propertyname>. If the hierarchy
* is more than one level deep the names are separated by dots as well. * * Revision 1.13 2003/12/14 02:36:26 tako
diff -u -r1.7 -r1.8 --- Text.java 5 Dec 2003 01:07:02 -0000 1.7 +++ Text.java 15 Dec 2003 11:06:00 -0000 1.8 @@ -29,10 +29,15 @@
private String m_sText; public Text() {
- this(null);
+ this(null, null);
} public Text(String _sText) {
+ this(null, _sText); + } + + public Text(String _sName, String _sText) { + super(_sName);
m_sText = _sText; }
@@ -47,13 +52,18 @@
/* * $Log$
+ * Revision 1.8 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore. + *
* Revision 1.7 2003/12/05 01:07:02 tako
- * Implemented enabled/disabled state for widgets. - * Renamed all caption properties to text properties leaving only one set of - * properties instead some widgets using text and others caption. - * Moved all text related properties to the Widget class even though that - * class never actually uses them but this saves lots of coding in the widgets - * that do need text properties.
+ * Implemented enabled/disabled state for widgets. + * Renamed all caption properties to text properties leaving only one set of + * properties instead some widgets using text and others caption. + * Moved all text related properties to the Widget class even though that + * class never actually uses them but this saves lots of coding in the widgets + * that do need text properties.
* Changed some property names during object construction. * * Revision 1.6 2003/11/25 16:28:00 tako
diff -u -r1.4 -r1.5 --- Toplevel.java 5 Dec 2003 01:07:02 -0000 1.4 +++ Toplevel.java 15 Dec 2003 11:06:00 -0000 1.5 @@ -36,6 +36,11 @@
m_bDraggable = true; }
+ public Toplevel(String _sName) { + super(_sName); + m_bDraggable = true; + } +
public Toplevel getToplevel() { return this; }
@@ -78,13 +83,18 @@
/* * $Log$
+ * Revision 1.5 2003/12/15 11:06:00 tako + * Did a rollback of the previous code because it was introducing more + * problems than solving them. A widget's name is now set in the constructor + * and can not be changed anymore. + *
* Revision 1.4 2003/12/05 01:07:02 tako
- * Implemented enabled/disabled state for widgets. - * Renamed all caption properties to text properties leaving only one set of - * properties instead some widgets using text and others caption. - * Moved all text related properties to the Widget class even though that - * class never actually uses them but this saves lots of coding in the widgets - * that do need text properties.
+ * Implemented enabled/disabled state for widgets. + * Renamed all caption properties to text properties leaving only one set of + * properties instead some widgets using text and others caption. + * Moved all text related properties to the Widget class even though that + * class never actually uses them but this saves lots of coding in the widgets + * that do need text properties.
* Changed some property names during object construction. * * Revision 1.3 2003/11/25 16:28:00 tako