isidorus-cvs
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
July 2011
- 1 participants
- 156 discussions

[isidorus-cvs] r586 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: container text
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 09:14:13 2011
New Revision: 586
Log:
gdl-frontend: Widgets: fixed a bug in the registration of the event handlers of GdlList
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 09:06:12 2011 (r585)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 09:14:13 2011 (r586)
@@ -275,37 +275,37 @@
@Override
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseOverEvent.getType());
+ return this.addDomHandler(handler, MouseOverEvent.getType());
}
@Override
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseOutEvent.getType());
+ return this.addDomHandler(handler, MouseOutEvent.getType());
}
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
- return this.basePanel.addDomHandler(handler, BlurEvent.getType());
+ return this.addDomHandler(handler, BlurEvent.getType());
}
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
- return this.basePanel.addDomHandler(handler, FocusEvent.getType());
+ return this.addDomHandler(handler, FocusEvent.getType());
}
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseUpEvent.getType());
+ return this.addDomHandler(handler, MouseUpEvent.getType());
}
@Override
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseDownEvent.getType());
+ return this.addDomHandler(handler, MouseDownEvent.getType());
}
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:06:12 2011 (r585)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:14:13 2011 (r586)
@@ -371,9 +371,9 @@
public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) {
Widget source = (Widget)event.getSource();
super.onHoverStart(event, handler);
+ Window.alert("TEST 1 >> " + source.getClass());
if(source.getClass().equals(TitleWidget.class)){
// TODO: implement
- Window.alert("TEST 1");
}
}
@@ -381,9 +381,9 @@
// applies the styles bound to hover and the passed element
@Override
protected void onHoverStart(Widget widget){
+ Window.alert("TEST 1.1 >> " + widget.getClass());
if(widget.getClass().equals(TitleWidget.class)){
// TODO: implement
- Window.alert("TEST 1.1");
}
for (Pair<String, String> elem : this.hoverCssNamesAndStyles) {
DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond());
@@ -460,37 +460,37 @@
@Override
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseOverEvent.getType());
+ return this.addDomHandler(handler, MouseOverEvent.getType());
}
@Override
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseOutEvent.getType());
+ return this.addDomHandler(handler, MouseOutEvent.getType());
}
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
- return this.basePanel.addDomHandler(handler, BlurEvent.getType());
+ return this.addDomHandler(handler, BlurEvent.getType());
}
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
- return this.basePanel.addDomHandler(handler, FocusEvent.getType());
+ return this.addDomHandler(handler, FocusEvent.getType());
}
@Override
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseUpEvent.getType());
+ return this.addDomHandler(handler, MouseUpEvent.getType());
}
@Override
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
- return this.basePanel.addDomHandler(handler, MouseDownEvent.getType());
+ return this.addDomHandler(handler, MouseDownEvent.getType());
}
}
}
1
0

[isidorus-cvs] r585 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 09:06:12 2011
New Revision: 585
Log:
gdl-frontend: Widgets: implemented the set (min|max)[width|height]
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 06:22:52 2011 (r584)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:06:12 2011 (r585)
@@ -1,7 +1,6 @@
package us.isidor.gdl.anaToMia.Widgets.text;
import java.util.ArrayList;
-
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
@@ -11,8 +10,8 @@
import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
import us.isidor.gdl.anaToMia.Widgets.values.ColorValue;
-import us.isidor.gdl.anaToMia.Widgets.values.CssValue;
import us.isidor.gdl.anaToMia.Widgets.values.DirectionValue;
import us.isidor.gdl.anaToMia.Widgets.values.FontWeightValue;
import us.isidor.gdl.anaToMia.Widgets.values.NormalNumUnitValue;
@@ -41,6 +40,7 @@
import com.google.gwt.event.dom.client.MouseUpHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
+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.Widget;
@@ -63,6 +63,27 @@
}
+ // sets the list Element to either ol or ul depending on the gdl:ordered property
+ public void createTitle() throws InvalidGdlSchemaException, ExecutionException {
+ // this object is able to own only one sub-element
+ TitleWidget title = new TitleWidget(this.getTitleOrder());
+ title.setText("TITLE!!!");
+ ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+ FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+ HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+ int idSuffix = 0;
+ if(this.subElements != null) idSuffix = this.subElements.size();
+ title.setId(this.getId() + "__GDL_" + idSuffix);
+ title.addMouseDownHandler(asHandler);
+ title.addMouseUpHandler(asHandler);
+ title.addMouseOverHandler(hsHandler);
+ title.addMouseOutHandler(hsHandler);
+ title.addFocusHandler(fsHandler);
+ title.addBlurHandler(fsHandler);
+ super.addToContainerPanel(title);
+ this.setGdlStyle(title);
+ }
+
// returns a PositiveNumUnitValue instance that represents the text font-size of this element.
// If a styleClass is set, only the corresponding value of the scoped occurrence is returned
// or null. The default values of gdl:Title differ to gdl:Text-Object
@@ -112,9 +133,6 @@
// this method is not implemented, since the title-order is set in initTitle
// It exists only for consistency reasons
}
-
-
-
// adds a stly property and value as a pair to the corresponding array list
@@ -126,7 +144,6 @@
}
-
// sets the direction style property of this element by using the GWT DOM class
@Override
public void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
@@ -256,6 +273,83 @@
this.addStyleToStore(styleClass, "word-spacing", value.getCssValue());
}
}
+
+
+ // sets the width style property of this element by using the GWT DOM class
+ public void setWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "width", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "width", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "width", value.getCssValue());
+ }
+ }
+
+
+ // sets the min-width style property of this element by using the GWT DOM class
+ public void setMinWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "minWidth", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "minWidth", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "minWidth", value.getCssValue());
+ }
+ }
+
+
+ // sets the max-width style property of this element by using the GWT DOM class
+ public void setMaxWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "maxWidth", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "maxWidth", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "maxWidth", value.getCssValue());
+ }
+ }
+
+
+ // sets the height style property of this element by using the GWT DOM class
+ public void setHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "height", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "height", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "height", value.getCssValue());
+ }
+ }
+
+
+ // sets the min-height style property of this element by using the GWT DOM class
+ public void setMinHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "minHeight", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "minHeight", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "minHeight", value.getCssValue());
+ }
+ }
+
+
+ // sets the max-height style property of this element by using the GWT DOM class
+ public void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "maxHeight", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "maxHeight", value.getCssValue());
+ this.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue());
+ }
+ }
+
+
+
+
+
@@ -272,9 +366,31 @@
+ // some handler for applying the css style bound to the pseudo classes hover, active and focus
+ @Override
+ public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) {
+ Widget source = (Widget)event.getSource();
+ super.onHoverStart(event, handler);
+ if(source.getClass().equals(TitleWidget.class)){
+ // TODO: implement
+ Window.alert("TEST 1");
+ }
+ }
-
+ // applies the styles bound to hover and the passed element
+ @Override
+ protected void onHoverStart(Widget widget){
+ if(widget.getClass().equals(TitleWidget.class)){
+ // TODO: implement
+ Window.alert("TEST 1.1");
+ }
+ for (Pair<String, String> elem : this.hoverCssNamesAndStyles) {
+ DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond());
+ }
+ }
+
+
@@ -283,26 +399,6 @@
- // sets the list Element to either ol or ul depending on the gdl:ordered property
- public void createTitle() throws InvalidGdlSchemaException, ExecutionException {
- // this object is able to own only one sub-element
- TitleWidget title = new TitleWidget(this.getTitleOrder());
- title.setText("TITLE!!!");
- ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
- FocusStyleHandler fsHandler = new FocusStyleHandler(this);
- HoverStyleHandler hsHandler = new HoverStyleHandler(this);
- int idSuffix = 0;
- if(this.subElements != null) idSuffix = this.subElements.size();
- title.setId(this.getId() + "__GDL_" + idSuffix);
- title.addMouseDownHandler(asHandler);
- title.addMouseUpHandler(asHandler);
- title.addMouseOverHandler(hsHandler);
- title.addMouseOutHandler(hsHandler);
- title.addFocusHandler(fsHandler);
- title.addBlurHandler(fsHandler);
- super.addToContainerPanel(title);
- this.setGdlStyle(title);
- }
// this class represents the acutal content of this widget, i.e.
@@ -346,6 +442,7 @@
default: throw new ExecutionException("The title order of a GDL Title element must be 1, 2, 3 or 4");
}
this.basePanel.getElement().insertFirst(this.titleElement);
+ GdlTitle.super.replaceStyleProperty(this.titleElement, "margin", "0px");
}
1
0

[isidorus-cvs] r584 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base container text
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 06:22:52 2011
New Revision: 584
Log:
gdl-frontend: Widgets: implemented the setters of all GDL properties of GdlTextObject in the class GdlTitle
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
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/container/GdlList.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Fri Jul 8 04:01:43 2011 (r583)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Fri Jul 8 06:22:52 2011 (r584)
@@ -158,6 +158,7 @@
public final static String gdlRows = gdl + "rows";
public final static String gdlCols = gdl + "cols";
public final static String gdlResize = gdl + "resize";
+ public final static String gdlTitleOrder = gdl + "title-order";
public final static String gdlUnitName = gdl + "unit-name";
public final static String gdlUnitBorderWidth = gdl + "unit-border-width";
public final static String gdlUnitBorderTopWidth = gdl + "unit-border-top-width";
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 Fri Jul 8 04:01:43 2011 (r583)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 06:22:52 2011 (r584)
@@ -21,6 +21,7 @@
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue;
import com.google.gwt.core.client.JsArray;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.VerticalAlign;
@@ -101,6 +102,18 @@
this.containerPanel.add(widget);
}
+
+ public static void replaceStyleProperty(Element elem, String styleName, String styleValue){
+ String oldStyle = elem.getAttribute("style");
+ if(oldStyle.matches("(^| |;)" + styleName + " *:")){
+ elem.setAttribute("style", oldStyle.replaceAll(styleName + ":.+;", styleName + ": " + styleValue + ";"));
+ } else {
+ elem.setAttribute("style", oldStyle + " " + styleName + ": " + styleValue + ";");
+ }
+
+ }
+
+
// a helper method that returns all occurrences of the type bound to the passed PSI
protected JsArray<Occurrence> getOccurrences(String occurrenceType){
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 Fri Jul 8 04:01:43 2011 (r583)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 06:22:52 2011 (r584)
@@ -7,6 +7,7 @@
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
import us.isidor.gdl.anaToMia.Widgets.text.GdlListBox;
import us.isidor.gdl.anaToMia.Widgets.text.GdlText;
+import us.isidor.gdl.anaToMia.Widgets.text.GdlTitle;
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -84,6 +85,7 @@
Topic gdlDisplay = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlDisplay));
Topic gdlContentOrientation = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlContentOrientation));
Topic gdlListStyleType = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlListStyleType));
+ Topic gdlDirection = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlDirection));
tmpRepresentative.createOccurrence(gdlId, "ID_1", null);
@@ -109,6 +111,7 @@
tmpRepresentative.createOccurrence(gdlDisplay, "inline", null);
tmpRepresentative.createOccurrence(gdlContentOrientation, "vertical", null);
tmpRepresentative.createOccurrence(gdlListStyleType, "square", null);
+ tmpRepresentative.createOccurrence(gdlDirection, "rtl", null);
Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
bgcHover.addTheme(gdlHover);
Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
@@ -119,7 +122,7 @@
fsHover.addTheme(gdlHover);
- GdlList tmp = new GdlList(tmpRepresentative);
+ GdlTitle tmp = new GdlTitle(tmpRepresentative);
this.mainPanel.add(tmp);
}catch(Exception e){
e.printStackTrace();
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 04:01:43 2011 (r583)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 06:22:52 2011 (r584)
@@ -3,8 +3,8 @@
import java.util.ArrayList;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.dom.client.Node;
import com.google.gwt.event.dom.client.BlurEvent;
@@ -44,18 +44,18 @@
// some constructors
protected GdlList() throws InvalidGdlSchemaException, ExecutionException {
super();
- this.initList(this.getOrdered());
+ this.createList();
}
public GdlList(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
super(tmRepresentative);
- this.initList(this.getOrdered());
+ this.createList();
}
// sets the list Element to either ol or ul depending on the gdl:ordered property
- public void initList(boolean ordered) throws InvalidGdlSchemaException, ExecutionException {
+ public void createList() throws InvalidGdlSchemaException, ExecutionException {
// this object is able to own only one sub-element
ListWidget list = new ListWidget(this.getOrdered());
ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
@@ -140,13 +140,13 @@
// sets the css property list-style-type
public void setListStyleType(ListWidget widget, ListStyleTypeValue value) throws InvalidGdlSchemaException, ExecutionException {
- widget.getListElement().setAttribute("style", widget.getListElement().getAttribute("style") + " list-style-type: " + value.getCssValue() + ";");
+ if(value != null) super.replaceStyleProperty(widget.getListElement(), "list-style-type", value.getCssValue());
}
// sets the css property list-style-position
public void setListStylePositionValue(ListWidget widget, ListStylePositionValue value) throws InvalidGdlSchemaException, ExecutionException {
- widget.getListElement().setAttribute("style", widget.getListElement().getAttribute("style") + " list-style-position: " + value.getCssValue() + ";");
+ if(value != null) super.replaceStyleProperty(widget.getListElement(), "list-style-position", value.getCssValue());
}
@@ -185,7 +185,7 @@
// Wraps a ul an ol element as a widget based on a SimplePanel
protected class ListWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers{
- private SimplePanel basePanel = new SimplePanel();
+ private AbsolutePanel basePanel = new AbsolutePanel();
private Element listElement = null;
// note: index is not the actual index of the item in the array list,
// it is the user's passed index when inserting this element
@@ -203,11 +203,6 @@
if(ordered) this.listElement = DOM.createElement("ol");
else this.listElement = DOM.createElement("ul");
this.basePanel.getElement().insertFirst(this.listElement);
-
- // TODO: remove
- Element li = DOM.createElement("li");
- li.setInnerHTML("Hallo !!!");
- this.listElement.insertFirst(li);
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Fri Jul 8 04:01:43 2011 (r583)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Fri Jul 8 06:22:52 2011 (r584)
@@ -61,9 +61,9 @@
public TextAlignValue getTextAlign(String styleClass) throws InvalidGdlSchemaException {
Occurrence textAlignOcc = null;
if(styleClass != null){
- textAlignOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlDirection, styleClass);
+ textAlignOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlTextAlign, styleClass);
} else {
- textAlignOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDirection);
+ textAlignOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlTextAlign);
}
if(textAlignOcc == null && styleClass != null){
@@ -86,9 +86,9 @@
public NormalNumUnitValue getLineHeight(String styleClass) throws InvalidGdlSchemaException {
Occurrence lineHeightOcc = null;
if(styleClass != null){
- lineHeightOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlDirection, styleClass);
+ lineHeightOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlLineHeight, styleClass);
} else {
- lineHeightOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDirection);
+ lineHeightOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlLineHeight);
}
if(lineHeightOcc == null && styleClass != null){
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 06:22:52 2011 (r584)
@@ -0,0 +1,399 @@
+package us.isidor.gdl.anaToMia.Widgets.text;
+
+import java.util.ArrayList;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+import us.isidor.gdl.anaToMia.Widgets.values.ColorValue;
+import us.isidor.gdl.anaToMia.Widgets.values.CssValue;
+import us.isidor.gdl.anaToMia.Widgets.values.DirectionValue;
+import us.isidor.gdl.anaToMia.Widgets.values.FontWeightValue;
+import us.isidor.gdl.anaToMia.Widgets.values.NormalNumUnitValue;
+import us.isidor.gdl.anaToMia.Widgets.values.PositiveNumUnitValue;
+import us.isidor.gdl.anaToMia.Widgets.values.TextAlignValue;
+import us.isidor.gdl.anaToMia.Widgets.values.TextDecorationValue;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.FontStyle;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.dom.client.HasMouseDownHandlers;
+import com.google.gwt.event.dom.client.HasMouseOutHandlers;
+import com.google.gwt.event.dom.client.HasMouseOverHandlers;
+import com.google.gwt.event.dom.client.HasMouseUpHandlers;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
+
+
+public class GdlTitle extends GdlTextObject {
+ protected ArrayList<Pair<String, String>> titleActiveCssNamesAndStyles = new ArrayList<Pair<String,String>>();
+ protected ArrayList<Pair<String, String>> titleFocusCssNamesAndStyles = new ArrayList<Pair<String,String>>();
+ protected ArrayList<Pair<String, String>> titleHoverCssNamesAndStyles = new ArrayList<Pair<String,String>>();
+
+ protected GdlTitle() throws InvalidGdlSchemaException, ExecutionException {
+ super();
+ }
+
+
+ public GdlTitle(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
+ super(tmRepresentative);
+ // TODO: create a Title element for each TM-elem
+ this.createTitle();
+ }
+
+
+ // returns a PositiveNumUnitValue instance that represents the text font-size of this element.
+ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned
+ // or null. The default values of gdl:Title differ to gdl:Text-Object
+ @Override
+ public PositiveNumUnitValue getFontSize(String styleClass) throws InvalidGdlSchemaException {
+ Occurrence sizeOcc = null;
+ if(styleClass != null){
+ sizeOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlFontSize, styleClass);
+ } else {
+ sizeOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFontSize);
+ }
+
+ if(sizeOcc == null && styleClass != null){
+ return null;
+ } else if(sizeOcc == null) {
+ switch(this.getTitleOrder()){
+ case 1: return new PositiveNumUnitValue("24pt");
+ case 2: return new PositiveNumUnitValue("19pt");
+ case 3: return new PositiveNumUnitValue("16pt");
+ default: return new PositiveNumUnitValue("14pt");
+ }
+ } else {
+ return new PositiveNumUnitValue(sizeOcc.getValue());
+ }
+ }
+
+
+ // returns the property of a gdl:title-order occurrence, otherwise the default value if no occurrence is set
+ public int getTitleOrder() throws InvalidGdlSchemaException{
+ Occurrence orderOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlTitleOrder);
+
+ if(orderOcc != null){
+ try{
+ int titleOrder = Integer.valueOf(orderOcc.getValue());
+ return titleOrder;
+ }catch(NumberFormatException e){
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlTitleOrder + " must be set to one of \"1\", \"2\", \"3\" or \"4\", but is \"" + orderOcc.getValue() + "\"");
+ }
+ } else {
+ return 1;
+ }
+ }
+
+
+ @Deprecated
+ public void setTitleOrder(Widget widget, int value){
+ // this method is not implemented, since the title-order is set in initTitle
+ // It exists only for consistency reasons
+ }
+
+
+
+
+
+ // adds a stly property and value as a pair to the corresponding array list
+ private void addStyleToStore(String styleClass, String property, String value){
+ if(styleClass == null) return;
+ else if(styleClass.equals(GdlPsis.Scope.gdlActive)) this.titleActiveCssNamesAndStyles.add(new Pair<String, String>(property, value));
+ else if(styleClass.equals(GdlPsis.Scope.gdlFocus)) this.titleFocusCssNamesAndStyles.add(new Pair<String, String>(property, value));
+ else if(styleClass.equals(GdlPsis.Scope.gdlHover)) this.titleHoverCssNamesAndStyles.add(new Pair<String, String>(property, value));
+ }
+
+
+
+ // sets the direction style property of this element by using the GWT DOM class
+ @Override
+ public void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "direction", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "direction", value.getCssValue());
+ }
+ }
+
+
+ // sets the text-align style property of this element by using the GWT DOM class
+ @Override
+ public void setTextAlign(Widget widget, TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "text-align", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "text-align", value.getCssValue());
+ }
+ }
+
+
+ // sets the line-height style property of this element by using the GWT DOM class
+ @Override
+ public void setLineHeight(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "line-height", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "line-height", value.getCssValue());
+ }
+ }
+
+
+ // sets the text-decoration style property of this element by using the GWT DOM class
+ @Override
+ public void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "text-decoration", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "text-decoration", value.getCssValue());
+ }
+ }
+
+
+ // sets the color style property of this element by using the GWT DOM class
+ @Override
+ public void setColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "color", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "color", value.getCssValue());
+ }
+ }
+
+
+ // sets the font-family style property of this element by using the GWT DOM class
+ @Override
+ public void setFontFamily(Widget widget, String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-family", value);
+ }
+ this.addStyleToStore(styleClass, "font-family", value);
+ }
+ }
+
+
+ // sets the font-style style property of this element by using the GWT DOM class
+ @Override
+ public void setFontStyle(Widget widget, FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-style", value.getCssName());
+ }
+ this.addStyleToStore(styleClass, "font-style", value.getCssName());
+ }
+ }
+
+
+ // sets the font-size style property of this element by using the GWT DOM class
+ @Override
+ public void setFontSize(Widget widget, PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-size", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "font-size", value.getCssValue());
+ }
+ }
+
+
+ // sets the font-weight style property of this element by using the GWT DOM class
+ @Override
+ public void setFontWeight(Widget widget, FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-weight", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "font-weight", value.getCssValue());
+ }
+ }
+
+
+ // sets the letter-spacing style property of this element by using the GWT DOM class
+ @Override
+ public void setLetterSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "letter-spacing", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "letter-spacing", value.getCssValue());
+ }
+ }
+
+ // sets the word-spacing style property of this element by using the GWT DOM class
+ @Override
+ public void setWordSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
+ if(value != null && widget.getClass().equals(TitleWidget.class)) {
+ if(styleClass == null){
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "word-spacing", value.getCssValue());
+ }
+ this.addStyleToStore(styleClass, "word-spacing", value.getCssValue());
+ }
+ }
+
+
+
+ // TODO: override 2x onActiveStart => handle style classes
+
+ // TODO: override 2x onHoverStart => handle style classes
+
+ // TODO: override 2x onFocusStart => handle style classes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // sets the list Element to either ol or ul depending on the gdl:ordered property
+ public void createTitle() throws InvalidGdlSchemaException, ExecutionException {
+ // this object is able to own only one sub-element
+ TitleWidget title = new TitleWidget(this.getTitleOrder());
+ title.setText("TITLE!!!");
+ ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+ FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+ HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+ int idSuffix = 0;
+ if(this.subElements != null) idSuffix = this.subElements.size();
+ title.setId(this.getId() + "__GDL_" + idSuffix);
+ title.addMouseDownHandler(asHandler);
+ title.addMouseUpHandler(asHandler);
+ title.addMouseOverHandler(hsHandler);
+ title.addMouseOutHandler(hsHandler);
+ title.addFocusHandler(fsHandler);
+ title.addBlurHandler(fsHandler);
+ super.addToContainerPanel(title);
+ this.setGdlStyle(title);
+ }
+
+
+ // this class represents the acutal content of this widget, i.e.
+ // it wraps a h1, h2, h3 or h4 element
+ protected class TitleWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasMouseOverHandlers, HasMouseOutHandlers, HasBlurHandlers, HasFocusHandlers{
+ private AbsolutePanel basePanel = new AbsolutePanel();
+ private Element titleElement = null;
+
+
+ // some constructurs
+ public TitleWidget()throws ExecutionException{
+ initWidget(this.basePanel);
+ this.initTitleElement(1);
+ }
+
+
+
+ public Element getTitleElement(){
+ return this.titleElement;
+ }
+
+
+ public TitleWidget(int titleOrder) throws ExecutionException{
+ if(titleOrder <= 0 || titleOrder > 4) throw new ExecutionException("The title order of a GDL Title element must be 1, 2, 3 or 4");
+ initWidget(this.basePanel);
+ this.initTitleElement(titleOrder);
+ }
+
+
+ // creates and returns the actual title element
+ private void initTitleElement(int titleOrder) throws ExecutionException {
+ switch(titleOrder){
+ case 1: this.titleElement = DOM.createElement("h1");
+ break;
+ case 2: this.titleElement = DOM.createElement("h2");
+ break;
+ case 3: this.titleElement = DOM.createElement("h3");
+ break;
+ case 4: this.titleElement = DOM.createElement("h4");
+ break;
+ default: throw new ExecutionException("The title order of a GDL Title element must be 1, 2, 3 or 4");
+ }
+ this.basePanel.getElement().insertFirst(this.titleElement);
+ }
+
+
+ // inserts the passed string as content to the heading
+ public void setText(String text){
+ if(text == null) return;
+ this.titleElement.setInnerText(text);
+ }
+
+
+ public void setId(String id){
+ DOM.setElementAttribute(this.basePanel.getElement(), "id", id);
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseOverEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseOutEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addBlurHandler(BlurHandler handler) {
+ return this.basePanel.addDomHandler(handler, BlurEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addFocusHandler(FocusHandler handler) {
+ return this.basePanel.addDomHandler(handler, FocusEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseUpEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseDownEvent.getType());
+ }
+ }
+}
1
0

[isidorus-cvs] r583 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base container
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 04:01:43 2011
New Revision: 583
Log:
gdl-frontend: Widgets: fixed the registration of event-handlers for GdlList => fixed the style-handlers for hover, active and focus
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/container/GdlList.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 Fri Jul 8 02:13:38 2011 (r582)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 04:01:43 2011 (r583)
@@ -21,7 +21,6 @@
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue;
import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.VerticalAlign;
@@ -55,7 +54,6 @@
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.dom.client.Node;
public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{
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 Fri Jul 8 02:13:38 2011 (r582)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 04:01:43 2011 (r583)
@@ -83,6 +83,8 @@
Topic gdlTextDecoration = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlTextDecoration));
Topic gdlDisplay = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlDisplay));
Topic gdlContentOrientation = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlContentOrientation));
+ Topic gdlListStyleType = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlListStyleType));
+
tmpRepresentative.createOccurrence(gdlId, "ID_1", null);
tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null);
@@ -106,6 +108,7 @@
tmpRepresentative.createOccurrence(gdlTextDecoration, "underline", null);
tmpRepresentative.createOccurrence(gdlDisplay, "inline", null);
tmpRepresentative.createOccurrence(gdlContentOrientation, "vertical", null);
+ tmpRepresentative.createOccurrence(gdlListStyleType, "square", null);
Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
bgcHover.addTheme(gdlHover);
Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
@@ -116,7 +119,7 @@
fsHover.addTheme(gdlHover);
- GdlList tmp = new GdlList(tmpRepresentative){};
+ GdlList tmp = new GdlList(tmpRepresentative);
this.mainPanel.add(tmp);
}catch(Exception e){
e.printStackTrace();
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 02:13:38 2011 (r582)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 04:01:43 2011 (r583)
@@ -7,17 +7,38 @@
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.dom.client.Node;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.dom.client.HasMouseDownHandlers;
+import com.google.gwt.event.dom.client.HasMouseOutHandlers;
+import com.google.gwt.event.dom.client.HasMouseOverHandlers;
+import com.google.gwt.event.dom.client.HasMouseUpHandlers;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
import us.isidor.gdl.anaToMia.Widgets.values.ListStylePositionValue;
import us.isidor.gdl.anaToMia.Widgets.values.ListStyleTypeValue;
-// TODO: check style attributes + css pseudo classes
public class GdlList extends GdlVisibleObject{
// some constructors
@@ -37,6 +58,18 @@
public void initList(boolean ordered) throws InvalidGdlSchemaException, ExecutionException {
// this object is able to own only one sub-element
ListWidget list = new ListWidget(this.getOrdered());
+ ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+ FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+ HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+ int idSuffix = 0;
+ if(this.subElements != null) idSuffix = this.subElements.size();
+ list.setId(this.getId() + "__GDL_" + idSuffix);
+ list.addMouseDownHandler(asHandler);
+ list.addMouseUpHandler(asHandler);
+ list.addMouseOverHandler(hsHandler);
+ list.addMouseOutHandler(hsHandler);
+ list.addFocusHandler(fsHandler);
+ list.addBlurHandler(fsHandler);
super.addToContainerPanel(list);
this.setGdlStyle(list);
}
@@ -134,8 +167,11 @@
public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException {
super.setGdlStyle(widget);
- this.setListStylePositionValue((ListWidget)widget, this.getListStylePosition());
- this.setListStyleType((ListWidget)widget, this.getListStyleType());
+ // this may be only called if the ListWidget is the passed argument
+ if(widget.getClass().equals(ListWidget.class)){
+ this.setListStylePositionValue((ListWidget)widget, this.getListStylePosition());
+ this.setListStyleType((ListWidget)widget, this.getListStyleType());
+ }
}
@@ -148,7 +184,7 @@
// Wraps a ul an ol element as a widget based on a SimplePanel
- protected class ListWidget extends Composite {
+ protected class ListWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers{
private SimplePanel basePanel = new SimplePanel();
private Element listElement = null;
// note: index is not the actual index of the item in the array list,
@@ -235,6 +271,47 @@
return -1;
}
+
+
+ public void setId(String id){
+ DOM.setElementAttribute(this.basePanel.getElement(), "id", id);
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseOverEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseOutEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addBlurHandler(BlurHandler handler) {
+ return this.basePanel.addDomHandler(handler, BlurEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addFocusHandler(FocusHandler handler) {
+ return this.basePanel.addDomHandler(handler, FocusEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseUpEvent.getType());
+ }
+
+
+ @Override
+ public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
+ return this.basePanel.addDomHandler(handler, MouseDownEvent.getType());
+ }
}
@@ -297,8 +374,5 @@
}
}
}
-
-
-
}
}
1
0

[isidorus-cvs] r582 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 02:13:38 2011
New Revision: 582
Log:
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 02:00:38 2011 (r581)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 02:13:38 2011 (r582)
@@ -17,6 +17,7 @@
import us.isidor.gdl.anaToMia.Widgets.values.ListStylePositionValue;
import us.isidor.gdl.anaToMia.Widgets.values.ListStyleTypeValue;
+// TODO: check style attributes + css pseudo classes
public class GdlList extends GdlVisibleObject{
// some constructors
@@ -166,7 +167,11 @@
if(ordered) this.listElement = DOM.createElement("ol");
else this.listElement = DOM.createElement("ul");
this.basePanel.getElement().insertFirst(this.listElement);
- this.listElement.insertFirst(DOM.createElement("li"));
+
+ // TODO: remove
+ Element li = DOM.createElement("li");
+ li.setInnerHTML("Hallo !!!");
+ this.listElement.insertFirst(li);
}
1
0

[isidorus-cvs] r581 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base container text
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 02:00:38 2011
New Revision: 581
Log:
gdl-frontend: Widgets: fixed a bug in GdlList when applying list styles
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/container/GdlList.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.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 Fri Jul 8 00:02:50 2011 (r580)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 02:00:38 2011 (r581)
@@ -99,23 +99,10 @@
this.mainPanel.add(this.containerPanel);
}
+ this.subElements.add(widget);
this.containerPanel.add(widget);
}
-
- // this method should be invoked if a new sub-element is added to this instance
- protected void addToContainerPanel(Element elem){
- if(this.containerPanel == null){
- this.containerPanel = new VerticalPanel();
- this.mainPanel.add(this.containerPanel);
- }
-
- Element panel = this.containerPanel.getElement();
- Node lastItem = panel.getLastChild();
- if(lastItem == null) panel.insertFirst(lastItem);
- else panel.insertAfter(elem, lastItem);
- }
-
// a helper method that returns all occurrences of the type bound to the passed PSI
protected JsArray<Occurrence> getOccurrences(String occurrenceType){
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 Fri Jul 8 00:02:50 2011 (r580)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 02:00:38 2011 (r581)
@@ -3,6 +3,7 @@
import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.container.GdlList;
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
import us.isidor.gdl.anaToMia.Widgets.text.GdlListBox;
import us.isidor.gdl.anaToMia.Widgets.text.GdlText;
@@ -115,7 +116,7 @@
fsHover.addTheme(gdlHover);
- GdlListBox tmp = new GdlListBox(tmpRepresentative){};
+ GdlList tmp = new GdlList(tmpRepresentative){};
this.mainPanel.add(tmp);
}catch(Exception e){
e.printStackTrace();
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 00:02:50 2011 (r580)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 02:00:38 2011 (r581)
@@ -17,11 +17,10 @@
import us.isidor.gdl.anaToMia.Widgets.values.ListStylePositionValue;
import us.isidor.gdl.anaToMia.Widgets.values.ListStyleTypeValue;
+
public class GdlList extends GdlVisibleObject{
-
-
// some constructors
- protected GdlList() throws InvalidGdlSchemaException{
+ protected GdlList() throws InvalidGdlSchemaException, ExecutionException {
super();
this.initList(this.getOrdered());
}
@@ -34,9 +33,11 @@
// sets the list Element to either ol or ul depending on the gdl:ordered property
- public void initList(boolean ordered) throws InvalidGdlSchemaException {
+ public void initList(boolean ordered) throws InvalidGdlSchemaException, ExecutionException {
// this object is able to own only one sub-element
- super.subElements.add(new ListWidget(this.getOrdered()));
+ ListWidget list = new ListWidget(this.getOrdered());
+ super.addToContainerPanel(list);
+ this.setGdlStyle(list);
}
@@ -74,7 +75,7 @@
} else if(this.getOrdered()){
return ListStyleTypeValue.DECIMAL;
} else {
- return ListStyleTypeValue.CIRCLE;
+ return ListStyleTypeValue.DISC;
}
}
@@ -104,14 +105,14 @@
// sets the css property list-style-type
- public void setListStyleType(Widget widget, ListStyleTypeValue value) throws InvalidGdlSchemaException, ExecutionException {
- this.setCssProperty(widget, null, "list-style-type", value.getCssValue());
+ public void setListStyleType(ListWidget widget, ListStyleTypeValue value) throws InvalidGdlSchemaException, ExecutionException {
+ widget.getListElement().setAttribute("style", widget.getListElement().getAttribute("style") + " list-style-type: " + value.getCssValue() + ";");
}
// sets the css property list-style-position
- public void setListStylePositionValue(Widget widget, ListStylePositionValue value) throws InvalidGdlSchemaException, ExecutionException {
- this.setCssProperty(widget, null, "list-style-position", value.getCssValue());
+ public void setListStylePositionValue(ListWidget widget, ListStylePositionValue value) throws InvalidGdlSchemaException, ExecutionException {
+ widget.getListElement().setAttribute("style", widget.getListElement().getAttribute("style") + " list-style-position: " + value.getCssValue() + ";");
}
@@ -132,13 +133,13 @@
public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException {
super.setGdlStyle(widget);
- this.setListStylePositionValue(widget, this.getListStylePosition());
- this.setListStyleType(widget, this.getListStyleType());
+ this.setListStylePositionValue((ListWidget)widget, this.getListStylePosition());
+ this.setListStyleType((ListWidget)widget, this.getListStyleType());
}
// inserts the passed item on the given index
- public void append(GdlVisibleObject item, int position){
+ public void insert(GdlVisibleObject item, int position){
if(this.subElements != null && this.subElements.size() != 0){
((ListWidget)this.subElements.get(0)).insertWidget(item, position);
}
@@ -154,14 +155,18 @@
private ArrayList<Pair<ListItem, Integer>> itemsAndIndexes = new ArrayList<Pair<ListItem, Integer>>();
public ListWidget(){
+ initWidget(this.basePanel);
this.listElement = DOM.createElement("ul");
this.basePanel.getElement().insertFirst(this.listElement);
}
+
public ListWidget(boolean ordered){
+ initWidget(this.basePanel);
if(ordered) this.listElement = DOM.createElement("ol");
else this.listElement = DOM.createElement("ul");
this.basePanel.getElement().insertFirst(this.listElement);
+ this.listElement.insertFirst(DOM.createElement("li"));
}
@@ -201,6 +206,11 @@
}
+ // returns the acutal DOM element
+ public Element getListElement(){
+ return this.listElement;
+ }
+
// returns all ListItems
public ArrayList<ListItem> getItems(){
ArrayList<ListItem> items = new ArrayList<GdlList.ListItem>();
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java Fri Jul 8 00:02:50 2011 (r580)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java Fri Jul 8 02:00:38 2011 (r581)
@@ -65,7 +65,6 @@
elem.addMouseOutHandler(hsHandler);
elem.addFocusHandler(fsHandler);
elem.addBlurHandler(fsHandler);
- this.subElements.add(elem);
super.addToContainerPanel(elem);
return elem;
}
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 Fri Jul 8 00:02:50 2011 (r580)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Fri Jul 8 02:00:38 2011 (r581)
@@ -67,7 +67,6 @@
elem.addMouseOutHandler(hsHandler);
elem.addFocusHandler(fsHandler);
elem.addBlurHandler(fsHandler);
- this.subElements.add(elem);
super.addToContainerPanel(elem);
return elem;
}
1
0

[isidorus-cvs] r580 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 00:02:50 2011
New Revision: 580
Log:
gdl-frontend: Widgets: fixed a java warning
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java Fri Jul 8 00:01:50 2011 (r579)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java Fri Jul 8 00:02:50 2011 (r580)
@@ -5,8 +5,6 @@
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseUpHandler;
-import com.google.gwt.user.client.ui.Widget;
-
public class ActiveStyleHandler implements MouseDownHandler, MouseUpHandler{
1
0

[isidorus-cvs] r579 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base container values
by lgiessmann@common-lisp.net 08 Jul '11
by lgiessmann@common-lisp.net 08 Jul '11
08 Jul '11
Author: lgiessmann
Date: Fri Jul 8 00:01:50 2011
New Revision: 579
Log:
gdl-frontend: Widgets: implemented GdlList
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStylePositionValue.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStyleTypeValue.java
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
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/container/GdlList.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 7 09:29:24 2011 (r578)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Fri Jul 8 00:01:50 2011 (r579)
@@ -129,7 +129,7 @@
public final static String gdlFloat = gdl + "float";
public final static String gdlBackgroundColor = gdl + "background-color";
public final static String gdlOrdered = gdl + "ordered";
- public final static String gdlListstyleType = gdl + "list-style-type";
+ public final static String gdlListStyleType = gdl + "list-style-type";
public final static String gdlListStylePosition = gdl + "list-style-position";
public final static String gdlPositionStyle = gdl + "position-style";
public final static String gdlNthValue = gdl + "nth-value";
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 09:29:24 2011 (r578)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 00:01:50 2011 (r579)
@@ -914,7 +914,7 @@
return null;
} else {
return new NumUnitValue(paddingOcc.getValue());
- }
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Thu Jul 7 09:29:24 2011 (r578)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 8 00:01:50 2011 (r579)
@@ -1,49 +1,289 @@
package us.isidor.gdl.anaToMia.Widgets.container;
+import java.util.ArrayList;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
-
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.dom.client.Node;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
-import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+import us.isidor.gdl.anaToMia.Widgets.values.ListStylePositionValue;
+import us.isidor.gdl.anaToMia.Widgets.values.ListStyleTypeValue;
-public class GdlList extends GdlVisibleObject implements IGdlContainer{
- protected Element listElement = null;
+public class GdlList extends GdlVisibleObject{
+
// some constructors
- protected GdlList(){
+ protected GdlList() throws InvalidGdlSchemaException{
super();
+ this.initList(this.getOrdered());
}
public GdlList(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
super(tmRepresentative);
+ this.initList(this.getOrdered());
}
- public void initList(boolean ordered){
- Element elem = DOM.createElement(ordered ? "ol" : "ul");
- super.addToContainerPanel(elem);
+ // sets the list Element to either ol or ul depending on the gdl:ordered property
+ public void initList(boolean ordered) throws InvalidGdlSchemaException {
+ // this object is able to own only one sub-element
+ super.subElements.add(new ListWidget(this.getOrdered()));
}
- public void createListItem(){
-
+ // returns the property of a gdl:ordered occurrence, otherwise the default value if no occurrence is set
+ public boolean getOrdered() throws InvalidGdlSchemaException{
+ Occurrence orderedOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlOrdered);
+
+ if(orderedOcc != null){
+ String boolStr = orderedOcc.getValue().toUpperCase();
+ if(boolStr.equals("TRUE")){
+ return true;
+ } else if(boolStr.equals("FALSE")) {
+ return false;
+ } else {
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlOrdered + " must be set to one of \"true\" or \"false\", but is \"" + orderedOcc.getValue() + "\"");
+ }
+ } else {
+ return false;
+ }
}
- public boolean getOrdered(){
- // TODO: implement
- return false;
+ // returns a ListStyleTypeValeu instance that describes this instance's list style type property
+ public ListStyleTypeValue getListStyleType() throws InvalidGdlSchemaException {
+ Occurrence typeOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlListStyleType);
+
+ if(typeOcc != null){
+ try{
+ return ListStyleTypeValue.fromString(typeOcc.getValue());
+ }catch(IllegalArgumentException e){
+ String values = "deciaml, decimal-leading-zero, lower-greek, lower-roman, armenian, georgian, upper-roman, " +
+ "lower-alpha, upper-alpha, lower-latin, upper-latin, disc, circle, square or none";
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlListStyleType + " must be set to one of " + values + " , but is \"" + typeOcc.getValue() + "\"");
+ }
+ } else if(this.getOrdered()){
+ return ListStyleTypeValue.DECIMAL;
+ } else {
+ return ListStyleTypeValue.CIRCLE;
+ }
}
+
+ // returns a ListStylePositionValue instance that describes this instance's list style position property
+ public ListStylePositionValue getListStylePosition() throws InvalidGdlSchemaException {
+ Occurrence positionOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlListStylePosition);
+ if(positionOcc != null){
+ try{
+ return ListStylePositionValue.valueOf(positionOcc.getValue().toUpperCase());
+ }catch(IllegalArgumentException e){
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlListStylePosition + " must be set to one of inside or outside, but is \"" + positionOcc.getValue() + "\"");
+ }
+ } else{
+ return ListStylePositionValue.OUTSIDE;
+ }
+
+ }
+
+
+ // sets the css property ordered
+ @Deprecated
+ public void setOrdered(Widget widget, boolean value) throws InvalidGdlSchemaException, ExecutionException {
+ // do nothing this property has to be set in the initList mehtod
+ }
+
+
+ // sets the css property list-style-type
+ public void setListStyleType(Widget widget, ListStyleTypeValue value) throws InvalidGdlSchemaException, ExecutionException {
+ this.setCssProperty(widget, null, "list-style-type", value.getCssValue());
+ }
+
+
+ // sets the css property list-style-position
+ public void setListStylePositionValue(Widget widget, ListStylePositionValue value) throws InvalidGdlSchemaException, ExecutionException {
+ this.setCssProperty(widget, null, "list-style-position", value.getCssValue());
+ }
+
+
+ // calls the super applies the GdlStyle for every TextArea item of this instance
+ @Override
+ protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{
+ if(this.subElements != null){
+ for (Widget item : this.subElements) {
+ this.setGdlStyle(item);
+ }
+ }
+ }
+
+
+ // sets the css properties, by calling the super class's method and the local
+ // method, which sets some specific properties for the GdlList instance
@Override
- public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant)
- throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
+ public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException {
+ super.setGdlStyle(widget);
+
+ this.setListStylePositionValue(widget, this.getListStylePosition());
+ this.setListStyleType(widget, this.getListStyleType());
+ }
+
+
+ // inserts the passed item on the given index
+ public void append(GdlVisibleObject item, int position){
+ if(this.subElements != null && this.subElements.size() != 0){
+ ((ListWidget)this.subElements.get(0)).insertWidget(item, position);
+ }
+ }
+
+
+ // Wraps a ul an ol element as a widget based on a SimplePanel
+ protected class ListWidget extends Composite {
+ private SimplePanel basePanel = new SimplePanel();
+ private Element listElement = null;
+ // note: index is not the actual index of the item in the array list,
+ // it is the user's passed index when inserting this element
+ private ArrayList<Pair<ListItem, Integer>> itemsAndIndexes = new ArrayList<Pair<ListItem, Integer>>();
+
+ public ListWidget(){
+ this.listElement = DOM.createElement("ul");
+ this.basePanel.getElement().insertFirst(this.listElement);
+ }
+
+ public ListWidget(boolean ordered){
+ if(ordered) this.listElement = DOM.createElement("ol");
+ else this.listElement = DOM.createElement("ul");
+ this.basePanel.getElement().insertFirst(this.listElement);
+ }
+
+
+ // inserts the passed list item as the last child to this list element
+ public void appendListItem(ListItem item){
+ if(item == null) return;
+ item.appendToList(this.listElement);
+ }
+
+
+ // inserts the passed instance item to this list directly after the intance previous
+ public void appendListItem(ListItem item, ListItem previous){
+ if(item == null) return;
+ item.appendToList(this.listElement, previous);
+ }
+
+
+ // inserts the passed widget directly before the first item that
+ // has a greater position index
+ public void insertWidget(Widget widget, int position){
+ ListItem previosItem = this.getItemBeforeIndex(position);
+ ListItem item = new ListItem(this.listElement);
+ item.appendContentToListItem(widget.getElement());
+ this.appendListItem(item, previosItem);
+ }
+
+
+ // returns the first item that has a smaller position index
+ public ListItem getItemBeforeIndex(int idx){
+ Pair<ListItem, Integer> result = null;
+ for (Pair<ListItem, Integer> item : this.itemsAndIndexes) {
+ if(item.getSecond() < idx && (result == null || result.getSecond() < item.getSecond()))result = item;
+ }
+
+ if(result != null) result.getFirst();
+ return null;
+ }
+
+
+ // returns all ListItems
+ public ArrayList<ListItem> getItems(){
+ ArrayList<ListItem> items = new ArrayList<GdlList.ListItem>();
+ for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) {
+ items.add(pair.getFirst());
+ }
+ return items;
+ }
+
+
+ // returns the position index of the item, that was psecified when
+ // inserting the passed ListItem
+ public int indexOfItem(ListItem item){
+ for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) {
+ if(pair.getFirst().equals(item)) return pair.getSecond();
+ }
+
+ return -1;
+ }
+ }
+
+
+ // this class wrapps a list item, i.e. a div element within a li element
+ protected class ListItem{
+ private Element liElement = null;
+ private Element divElement = null;
+
+ public ListItem(){
+ this.liElement = DOM.createElement("li");
+ this.divElement = DOM.createElement("div");
+ this.liElement.insertFirst(this.divElement);
+ }
+
+ public ListItem(Element parentList){
+ this();
+ this.appendToList(parentList);
+ }
+
+ // inserts the this instance into the passed list element,
+ // if this instance is not bound yet
+ public void appendToList(Element parentList){
+ if(parentList != null && this.liElement.getParentNode() == null){
+ Node lastChild = parentList.getLastChild();
+ if(lastChild != null){
+ parentList.insertAfter(this.liElement, lastChild);
+ } else {
+ parentList.insertFirst(this.liElement);
+ }
+ }
+ }
+
+
+ // inserts the this instance into the passed list element
+ // after the passed ListItem, if this instance is not bound yet
+ public void appendToList(Element parentList, ListItem previous){
+ if(parentList == null) return;
+
+ if(previous == null){
+ this.appendToList(parentList);
+ }else{
+ parentList.insertAfter(this.liElement, previous.liElement);
+ }
+ }
+
+
+ // removes this instance from the set list
+ public void removeFromList(){
+ this.liElement.removeFromParent();
+ }
+
+ // appends the content element to the inner div item
+ public void appendContentToListItem(Element content){
+ if(content != null){
+ Node lastChild = this.divElement.getLastChild();
+ if(lastChild != null){
+ this.divElement.insertAfter(content, lastChild);
+ } else {
+ this.divElement.insertFirst(content);
+ }
+ }
+ }
+
+
}
}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStylePositionValue.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStylePositionValue.java Fri Jul 8 00:01:50 2011 (r579)
@@ -0,0 +1,13 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public enum ListStylePositionValue implements CssValue {
+ INSIDE,
+ OUTSIDE;
+
+
+ @Override
+ public String getCssValue() {
+ return this.toString().toLowerCase();
+ }
+
+}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStyleTypeValue.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ListStyleTypeValue.java Fri Jul 8 00:01:50 2011 (r579)
@@ -0,0 +1,47 @@
+package us.isidor.gdl.anaToMia.Widgets.values;
+
+public enum ListStyleTypeValue implements CssValue{
+ DECIMAL,
+ DECIMAL_LEADING_ZERO,
+ LOWER_GREEK,
+ LOWER_ROMAN,
+ ARMENIAN,
+ GEORGIAN,
+ UPPER_ROMAN,
+ LOWER_ALPHA,
+ UPPER_ALPHA,
+ LOWER_LATIN,
+ UPPER_LATIN,
+ DISC,
+ CIRCLE,
+ SQUARE,
+ NONE;
+
+ @Override
+ public String getCssValue() {
+ return this.toString().toLowerCase().replace("_", "-");
+ }
+
+
+ public static ListStyleTypeValue fromString(String str) throws IllegalArgumentException{
+ if(null == str) return null;
+
+ String upperStr = str.toUpperCase();
+ if(upperStr.equals("DECIMAL")) return DECIMAL;
+ else if(upperStr.equals("DECIMAL-LEADING-ZERO")) return DECIMAL_LEADING_ZERO;
+ else if(upperStr.equals("LOWER-GREEK")) return LOWER_GREEK;
+ else if(upperStr.equals("LOWER-ROMAN")) return LOWER_ROMAN;
+ else if(upperStr.equals("ARMENIAN")) return ARMENIAN;
+ else if(upperStr.equals("GEORGIAN")) return GEORGIAN;
+ else if(upperStr.equals("UPPER-ROMAN")) return UPPER_ROMAN;
+ else if(upperStr.equals("LOWER-ALPHA")) return LOWER_ALPHA;
+ else if(upperStr.equals("UPPER-ALPHA")) return UPPER_ALPHA;
+ else if(upperStr.equals("LOWER-LATIN")) return LOWER_LATIN;
+ else if(upperStr.equals("UPPER-LATIN")) return UPPER_LATIN;
+ else if(upperStr.equals("DISC")) return DISC;
+ else if(upperStr.equals("CIRCLE")) return CIRCLE;
+ else if(upperStr.equals("SQUARE")) return SQUARE;
+ else if(upperStr.equals("NONE")) return NONE;
+ else throw new IllegalArgumentException("the value " + str + "is not a FontWeightValue value");
+ }
+}
1
0

[isidorus-cvs] r578 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base container
by lgiessmann@common-lisp.net 07 Jul '11
by lgiessmann@common-lisp.net 07 Jul '11
07 Jul '11
Author: lgiessmann
Date: Thu Jul 7 09:29:24 2011
New Revision: 578
Log:
gdl-frontend: Widgets: started to implement GdlList
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Jul 7 08:49:40 2011 (r577)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Jul 7 09:29:24 2011 (r578)
@@ -22,6 +22,7 @@
<source path="base"/>
<source path="views"/>
<source path="text"/>
+ <source path="container"/>
<source path="environment"/>
<source path="values"/>
<source path="isidorus"/>
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 08:49:40 2011 (r577)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 09:29:24 2011 (r578)
@@ -21,6 +21,7 @@
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue;
import com.google.gwt.core.client.JsArray;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.VerticalAlign;
@@ -54,6 +55,7 @@
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.dom.client.Node;
public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{
@@ -100,6 +102,20 @@
this.containerPanel.add(widget);
}
+
+ // this method should be invoked if a new sub-element is added to this instance
+ protected void addToContainerPanel(Element elem){
+ if(this.containerPanel == null){
+ this.containerPanel = new VerticalPanel();
+ this.mainPanel.add(this.containerPanel);
+ }
+
+ Element panel = this.containerPanel.getElement();
+ Node lastItem = panel.getLastChild();
+ if(lastItem == null) panel.insertFirst(lastItem);
+ else panel.insertAfter(elem, lastItem);
+ }
+
// a helper method that returns all occurrences of the type bound to the passed PSI
protected JsArray<Occurrence> getOccurrences(String occurrenceType){
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Thu Jul 7 09:29:24 2011 (r578)
@@ -0,0 +1,49 @@
+package us.isidor.gdl.anaToMia.Widgets.container;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.DOM;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+
+public class GdlList extends GdlVisibleObject implements IGdlContainer{
+ protected Element listElement = null;
+
+ // some constructors
+ protected GdlList(){
+ super();
+ }
+
+
+ public GdlList(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
+ super(tmRepresentative);
+ }
+
+
+ public void initList(boolean ordered){
+ Element elem = DOM.createElement(ordered ? "ol" : "ul");
+ super.addToContainerPanel(elem);
+ }
+
+
+ public void createListItem(){
+
+ }
+
+
+ public boolean getOrdered(){
+ // TODO: implement
+ return false;
+ }
+
+
+ @Override
+ public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant)
+ throws InvalidGdlSchemaException {
+ // TODO Auto-generated method stub
+
+ }
+}
1
0

[isidorus-cvs] r577 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text
by lgiessmann@common-lisp.net 07 Jul '11
by lgiessmann@common-lisp.net 07 Jul '11
07 Jul '11
Author: lgiessmann
Date: Thu Jul 7 08:49:40 2011
New Revision: 577
Log:
gdl-frontend: Widgets: implemented GdlListBox (GDL:one-per-group is currently not implemented)
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
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/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
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 07:44:51 2011 (r576)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Jul 7 08:49:40 2011 (r577)
@@ -4,6 +4,7 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
+import us.isidor.gdl.anaToMia.Widgets.text.GdlListBox;
import us.isidor.gdl.anaToMia.Widgets.text.GdlText;
import us.isidor.gdl.anaToMia.Widgets.values.CursorValue;
import com.google.gwt.core.client.EntryPoint;
@@ -114,7 +115,7 @@
fsHover.addTheme(gdlHover);
- GdlText tmp = new GdlText(tmpRepresentative){};
+ GdlListBox tmp = new GdlListBox(tmpRepresentative){};
this.mainPanel.add(tmp);
}catch(Exception e){
e.printStackTrace();
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java Thu Jul 7 08:49:40 2011 (r577)
@@ -0,0 +1,198 @@
+package us.isidor.gdl.anaToMia.Widgets.text;
+
+import java.util.ArrayList;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Widget;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
+import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+
+public class GdlListBox extends GdlTextObject implements IGdlHasValue{
+ // some constructors
+ protected GdlListBox() throws InvalidGdlSchemaException, ExecutionException {
+ super();
+ }
+
+
+ public GdlListBox(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
+ super(tmRepresentative);
+ // TODO: create a ListBox element for each TM-elem
+ ListBox lb = this.createNewListBox(); // TODO: remove only for debugging
+ lb.addItem("value-1", Direction.LTR);
+ lb.addItem("value-2", Direction.LTR);
+ lb.addItem("value-3", Direction.LTR);
+ lb.addItem("value-4", Direction.LTR);
+ lb.addItem("value-5", Direction.LTR);
+ lb.addItem("value-6", Direction.LTR);
+ lb.addItem("value-1", Direction.LTR);
+ lb.addItem("value-2", Direction.LTR);
+ lb.addItem("value-3", Direction.LTR);
+ lb.addItem("value-4", Direction.LTR);
+ lb.addItem("value-5", Direction.LTR);
+ lb.addItem("value-6", Direction.LTR);
+ lb = this.createNewListBox(); // TODO: remove only for debugging
+ lb.addItem("value-1", Direction.LTR);
+ lb.addItem("value-2", Direction.LTR);
+ lb.addItem("value-3", Direction.LTR);
+ }
+
+
+ // creates a new ListBox item, adds it to the subElements array,
+ // and applies the styles on it
+ protected ListBox createNewListBox() throws InvalidGdlSchemaException, ExecutionException {
+ ListBox elem = new ListBox(this.getMultiple());
+ DOM.setElementAttribute(elem.getElement(), "id", this.getId() + "__GDL_" + this.subElements.size());
+ this.setGdlStyle(elem);
+ ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+ FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+ HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+ elem.addMouseDownHandler(asHandler);
+ elem.addMouseUpHandler(asHandler);
+ elem.addMouseOverHandler(hsHandler);
+ elem.addMouseOutHandler(hsHandler);
+ elem.addFocusHandler(fsHandler);
+ elem.addBlurHandler(fsHandler);
+ this.subElements.add(elem);
+ super.addToContainerPanel(elem);
+ return elem;
+ }
+
+
+ // removes the passed element and all its handlers from the outer element
+ protected void removeListbox(ListBox elem) throws InvalidGdlSchemaException, ExecutionException{
+ for (Pair<Widget, ArrayList<EventHandler>> item : this.eventHandlers) {
+ if(item.getFirst().equals(elem)){
+ this.eventHandlers.remove(item);
+ break;
+ }
+ }
+ this.subElements.remove(elem);
+ elem.removeFromParent();
+ }
+
+
+ // returns the gdl:multiple property - if no value is set the default value is returned
+ public boolean getMultiple() throws InvalidGdlSchemaException {
+ Occurrence multipleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMultiple);
+
+ if(multipleOcc != null){
+ String boolStr = multipleOcc.getValue().toUpperCase();
+ if(boolStr.equals("TRUE")){
+ return true;
+ } else if(boolStr.equals("FALSE")) {
+ return false;
+ } else {
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlMargin + " must be set to one of \"true\" or \"false\", but is \"" + multipleOcc.getValue() + "\"");
+ }
+ } else {
+ return false;
+ }
+ }
+
+
+ // returns the gdl:one-per-group property - if no value is set the default value is returned
+ public boolean getOnePerGroup() throws InvalidGdlSchemaException {
+ Occurrence onePerGroupOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlOnePerGroup);
+
+ if(onePerGroupOcc != null){
+ String boolStr = onePerGroupOcc.getValue().toUpperCase();
+ if(boolStr.equals("TRUE")){
+ return true;
+ } else if(boolStr.equals("FALSE")) {
+ return false;
+ } else {
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlOnePerGroup + " must be set to one of \"true\" or \"false\", but is \"" + onePerGroupOcc.getValue() + "\"");
+ }
+ } else {
+ return false;
+ }
+ }
+
+
+ // returns an int instance of a gdl:size occurrence.
+ // If no gdl:size occurrence is set, the default value is returned
+ public int getSize() throws InvalidGdlSchemaException {
+ Occurrence rowsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlSize);
+
+ if(rowsOcc != null){
+ try{
+ int value = Integer.valueOf(rowsOcc.getValue());
+ if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlSize + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\"");
+ else return value;
+ }catch(NumberFormatException e){
+ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlSize + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\"");
+ }
+ } else {
+ return 1;
+ }
+ }
+
+
+ // sets the size property of this element by using the GWT DOM class
+ public void setSize(Widget widget, int value){
+ ((ListBox)widget).setVisibleItemCount(value);
+ }
+
+
+ // this method has not effect, it is defined only for consistency reasons
+ @Deprecated
+ public void setMultiple(Widget widget, boolean value){
+ // Do nothing the gdl:multiple property is set in the createListBox method
+ // directly when calling the ListBox constructor
+ }
+
+
+ public void setOnePerGroup(Widget widget, boolean value){
+ // TODO: implement => http://code.google.com/p/gwt-traction/source/browse/src/com/tractionsoftwar…
+ }
+
+
+ // sets the css properties, by calling the super class's method and the local
+ // method, which sets some specific properties for the GdlText instance
+ @Override
+ public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException {
+ super.setGdlStyle(widget);
+
+ this.setSize(widget, this.getSize());
+ this.setOnePerGroup(widget, this.getOnePerGroup());
+ }
+
+
+ // returns an ArrayList of string that contains all selected values
+ @Override
+ public ArrayList<String> getStringValue() {
+ ArrayList<String> results = new ArrayList<String>();
+ for (Widget elem : super.subElements) {
+ ListBox lb = ((ListBox)elem);
+ if(lb.getSelectedIndex() != -1) results.add(lb.getValue(lb.getSelectedIndex()));
+ }
+ return results;
+ }
+
+
+ @Override
+ public ArrayList<Pair<TopicMapsTypes, Object>> getTmValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public boolean validate() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
\ No newline at end of file
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 07:44:51 2011 (r576)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 7 08:49:40 2011 (r577)
@@ -52,12 +52,12 @@
}
- // creates a new TextArea item, adds it to the textElements array,
+ // creates a new TextArea item, adds it to the subElements array,
// and applies the styles on it
protected TextArea createNewTextArea() throws InvalidGdlSchemaException, ExecutionException {
TextArea elem = new TextArea();
DOM.setElementAttribute(elem.getElement(), "id", this.getId() + "__GDL_" + this.subElements.size());
- this.setGdlStyle((Widget)elem);
+ this.setGdlStyle(elem);
ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
FocusStyleHandler fsHandler = new FocusStyleHandler(this);
HoverStyleHandler hsHandler = new HoverStyleHandler(this);
@@ -448,7 +448,7 @@
}
- // returns a boolean instance of a gdl:rows occurrence.
+ // returns an int instance of a gdl:rows occurrence.
// If no gdl:rows occurrence is set, the default value is returned
public int getRows() throws InvalidGdlSchemaException {
Occurrence rowsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlRows);
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Thu Jul 7 07:44:51 2011 (r576)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Thu Jul 7 08:49:40 2011 (r577)
@@ -1,10 +1,7 @@
package us.isidor.gdl.anaToMia.Widgets.text;
-
import com.google.gwt.dom.client.Style.FontStyle;
-import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;
-
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
@@ -283,66 +280,66 @@
// sets the direction style property of this element by using the GWT DOM class
public void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "direction", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "direction", value.getCssValue());
}
// sets the text-align style property of this element by using the GWT DOM class
public void setTextAlign(Widget widget, TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textAlign", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "textAlign", value.getCssValue());
}
// sets the line-height style property of this element by using the GWT DOM class
public void setLineHeight(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "lineHeight", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "lineHeight", value.getCssValue());
}
// sets the text-decoration style property of this element by using the GWT DOM class
public void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textDecoration", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "textDecoration", value.getCssValue());
}
// sets the color style property of this element by using the GWT DOM class
public void setColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "color", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "color", value.getCssValue());
}
// sets the font-family style property of this element by using the GWT DOM class
public void setFontFamily(Widget widget, String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontFamily", value);
+ if(value != null) this.setCssProperty(widget, styleClass, "fontFamily", value);
}
// sets the font-style style property of this element by using the GWT DOM class
public void setFontStyle(Widget widget, FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontStyle", value.getCssName());
+ if(value != null) this.setCssProperty(widget, styleClass, "fontStyle", value.getCssName());
}
// sets the font-size style property of this element by using the GWT DOM class
public void setFontSize(Widget widget, PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontSize", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "fontSize", value.getCssValue());
}
// sets the font-weight style property of this element by using the GWT DOM class
public void setFontWeight(Widget widget, FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontWeight", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "fontWeight", value.getCssValue());
}
// sets the letter-spacing style property of this element by using the GWT DOM class
public void setLetterSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "letterSpacing", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "letterSpacing", value.getCssValue());
}
// sets the word-spacing style property of this element by using the GWT DOM class
public void setWordSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException {
- if(value != null) this.setCssProperty((TextArea)widget, styleClass, "wordSpacing", value.getCssValue());
+ if(value != null) this.setCssProperty(widget, styleClass, "wordSpacing", value.getCssValue());
}
1
0