[isidorus-cvs] r574 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Thu Jul 7 12:58:32 UTC 2011
Author: lgiessmann
Date: Thu Jul 7 05:58:31 2011
New Revision: 574
Log:
gdl-frontend: Widgets: implemented the behavior for gdl:ContentOrientation
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 00:58:04 2011 (r573)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 05:58:31 2011 (r574)
@@ -49,12 +49,16 @@
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{
protected AbsolutePanel mainPanel = new AbsolutePanel();
+ protected Panel containerPanel = null;
protected Topic tmRepresentative = null;
protected TopicMap tm = null;
protected ArrayList<Pair<String, String>> activeCssNamesAndStyles = new ArrayList<Pair<String,String>>();
@@ -85,6 +89,17 @@
return this.tmRepresentative;
}
+
+ // this method should be invoked if a new sub-element is added to this instance
+ protected void addToContainerPanel(Widget widget){
+ if(this.containerPanel == null){
+ this.containerPanel = new VerticalPanel();
+ this.mainPanel.add(this.containerPanel);
+ }
+
+ this.containerPanel.add(widget);
+ }
+
// a helper method that returns all occurrences of the type bound to the passed PSI
protected JsArray<Occurrence> getOccurrences(String occurrenceType){
@@ -1123,10 +1138,10 @@
// sets the float style property of all sub elements by using the GWT DOM class
public void setContentOrientation(Widget widget, ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException {
- // TODO: use a VerticalPanel or HorizontalPanel instead of setting the display property
- String valueStr = "inline";
- if(value != null && value == ContentOrientationValue.VERTICAL) valueStr = "block";
- this.setCssProperty(widget, null, "display", valueStr);
+ if(value == ContentOrientationValue.HORIZONTAL && this.containerPanel == null) this.containerPanel = new HorizontalPanel();
+ else if(this.containerPanel == null) this.containerPanel = new VerticalPanel();
+
+ this.mainPanel.add(this.containerPanel);
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Jul 7 00:58:04 2011 (r573)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Jul 7 05:58:31 2011 (r574)
@@ -5,7 +5,6 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
import us.isidor.gdl.anaToMia.Widgets.text.GdlText;
-import us.isidor.gdl.anaToMia.Widgets.text.GdlTextObject;
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -104,7 +103,7 @@
tmpRepresentative.createOccurrence(gdlFontSize, "15pt", null);
tmpRepresentative.createOccurrence(gdlTextDecoration, "underline", null);
tmpRepresentative.createOccurrence(gdlDisplay, "inline", null);
- tmpRepresentative.createOccurrence(gdlContentOrientation, "horizontal", null);
+ tmpRepresentative.createOccurrence(gdlContentOrientation, "vertical", null);
Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
bgcHover.addTheme(gdlHover);
Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 7 00:58:04 2011 (r573)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 7 05:58:31 2011 (r574)
@@ -63,7 +63,7 @@
elem.addFocusHandler(fsHandler);
elem.addBlurHandler(fsHandler);
this.subElements.add(elem);
- super.mainPanel.add(elem);
+ super.addToContainerPanel(elem);
return elem;
}
More information about the Isidorus-cvs
mailing list