[isidorus-cvs] r585 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Fri Jul 8 16:06:14 UTC 2011
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");
}
More information about the Isidorus-cvs
mailing list