Author: lgiessmann Date: Fri Jul 15 03:50:29 2011 New Revision: 626
Log: gdl-frontend: Widgets: changed the overflow css property to visible for all visble objects
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/Utils.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/GdlTitle.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 15 03:34:35 2011 (r625) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 15 03:50:29 2011 (r626) @@ -11,7 +11,6 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.environment.MultipleHandlerRegistration; import us.isidor.gdl.anaToMia.Widgets.environment.Pair; -import us.isidor.gdl.anaToMia.Widgets.environment.Pattern; import us.isidor.gdl.anaToMia.Widgets.value.AbsoluteNumValue; import us.isidor.gdl.anaToMia.Widgets.value.AutoNumUnitValue; import us.isidor.gdl.anaToMia.Widgets.value.AutoNumValue; @@ -21,9 +20,7 @@ import us.isidor.gdl.anaToMia.Widgets.value.ContentOrientationValue; import us.isidor.gdl.anaToMia.Widgets.value.CursorValue; import us.isidor.gdl.anaToMia.Widgets.value.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; @@ -74,6 +71,7 @@ // some constructors protected GdlVisibleObject() { initWidget(this.mainPanel); + DOM.setStyleAttribute(this.mainPanel.getElement(), "overflow", "visible"); }
@@ -114,24 +112,6 @@ this.containerPanel.add(widget); } - - public static void replaceStyleProperty(Element elem, String styleName, String styleValue){ - String oldStyle = elem.getAttribute("style"); - String newValue = styleName + ": " + styleValue + ";"; - - Pattern pattern1 = new Pattern("(^| )" + styleName + " *:[^;]"); - Pattern pattern2 = new Pattern(";" + styleName + " *:[^;]"); - if(pattern1.matches(oldStyle)){ - elem.setAttribute("style", oldStyle.replaceFirst(pattern1.pattern(), newValue)); - }else if(pattern2.matches(oldStyle)){ - elem.setAttribute("style", oldStyle.replaceFirst(pattern1.pattern(), ";" + newValue)); - }else{ - String valueToAppend = styleName + ": " + styleValue + ";"; - if(oldStyle.length() == 0) valueToAppend = " " + valueToAppend; - elem.setAttribute("style", oldStyle + valueToAppend); - } - } -
// 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/Utils.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java Fri Jul 15 03:34:35 2011 (r625) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java Fri Jul 15 03:50:29 2011 (r626) @@ -2,6 +2,10 @@
import java.util.ArrayList;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pattern; + +import com.google.gwt.dom.client.Element; + public class Utils { // returns true if both arrays have the same items @@ -25,4 +29,24 @@ for(int i = 0; i != str.length(); ++i) if(!Character.isDigit(str.charAt(i))) return false; return true; } + + + // replaces the given style property by the passed value, if no old value + // for this property was found, the new valu is imply added to the style attribute + public static void replaceStyleProperty(Element elem, String styleName, String styleValue){ + String oldStyle = elem.getAttribute("style"); + String newValue = styleName + ": " + styleValue + ";"; + + Pattern pattern1 = new Pattern("(^| )" + styleName + " *:[^;]"); + Pattern pattern2 = new Pattern(";" + styleName + " *:[^;]"); + if(pattern1.matches(oldStyle)){ + elem.setAttribute("style", oldStyle.replaceFirst(pattern1.pattern(), newValue)); + }else if(pattern2.matches(oldStyle)){ + elem.setAttribute("style", oldStyle.replaceFirst(pattern1.pattern(), ";" + newValue)); + }else{ + String valueToAppend = styleName + ": " + styleValue + ";"; + if(oldStyle.length() == 0) valueToAppend = " " + valueToAppend; + elem.setAttribute("style", oldStyle + valueToAppend); + } + } }
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 15 03:34:35 2011 (r625) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Fri Jul 15 03:50:29 2011 (r626) @@ -3,7 +3,6 @@ import java.util.ArrayList; import com.google.gwt.dom.client.Element; 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; @@ -33,6 +32,7 @@ import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer; import us.isidor.gdl.anaToMia.Widgets.base.TmHelper; +import us.isidor.gdl.anaToMia.Widgets.base.Utils; import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler; @@ -160,13 +160,13 @@ // sets the css property list-style-type public void setListStyleType(ListWidget widget, ListStyleTypeValue value) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) super.replaceStyleProperty(widget.getListElement(), "list-style-type", value.getCssValue()); + if(value != null) Utils.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 { - if(value != null) super.replaceStyleProperty(widget.getListElement(), "list-style-position", value.getCssValue()); + if(value != null) Utils.replaceStyleProperty(widget.getListElement(), "list-style-position", value.getCssValue()); }
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 15 03:34:35 2011 (r625) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 15 03:50:29 2011 (r626) @@ -6,6 +6,7 @@ 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.base.Utils; import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler; @@ -150,7 +151,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "direction", value.getCssValue()); } this.addStyleToStore(styleClass, "direction", value.getCssValue()); } @@ -162,7 +163,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "text-align", value.getCssValue()); } this.addStyleToStore(styleClass, "text-align", value.getCssValue()); } @@ -174,7 +175,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "line-height", value.getCssValue()); } this.addStyleToStore(styleClass, "line-height", value.getCssValue()); } @@ -186,7 +187,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "text-decoration", value.getCssValue()); } this.addStyleToStore(styleClass, "text-decoration", value.getCssValue()); } @@ -198,7 +199,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "color", value.getCssValue()); } this.addStyleToStore(styleClass, "color", value.getCssValue()); } @@ -210,7 +211,7 @@ 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); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-family", value); } this.addStyleToStore(styleClass, "font-family", value); } @@ -222,7 +223,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-style", value.getCssName()); } this.addStyleToStore(styleClass, "font-style", value.getCssName()); } @@ -234,7 +235,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-size", value.getCssValue()); } this.addStyleToStore(styleClass, "font-size", value.getCssValue()); } @@ -246,7 +247,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "font-weight", value.getCssValue()); } this.addStyleToStore(styleClass, "font-weight", value.getCssValue()); } @@ -258,7 +259,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "letter-spacing", value.getCssValue()); } this.addStyleToStore(styleClass, "letter-spacing", value.getCssValue()); } @@ -269,7 +270,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "word-spacing", value.getCssValue()); } this.addStyleToStore(styleClass, "word-spacing", value.getCssValue()); } @@ -280,7 +281,7 @@ 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()); // TODO: fix + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "width", value.getCssValue()); // TODO: fix } this.addStyleToStore(styleClass, "width", value.getCssValue()); super.setCssProperty(widget, styleClass, "width", value.getCssValue()); @@ -292,7 +293,7 @@ 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(), "min-width", value.getCssValue()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "min-width", value.getCssValue()); } this.addStyleToStore(styleClass, "min-width", value.getCssValue()); super.setCssProperty(widget, styleClass, "minWidth", value.getCssValue()); @@ -304,7 +305,7 @@ 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(), "max-width", value.getCssValue()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "max-width", value.getCssValue()); } this.addStyleToStore(styleClass, "max-width", value.getCssValue()); super.setCssProperty(widget, styleClass, "maxWidth", value.getCssValue()); @@ -316,7 +317,7 @@ 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()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "height", value.getCssValue()); } this.addStyleToStore(styleClass, "height", value.getCssValue()); super.setCssProperty(widget, styleClass, "height", value.getCssValue()); @@ -328,7 +329,7 @@ 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(), "min-height", value.getCssValue()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "min-height", value.getCssValue()); } this.addStyleToStore(styleClass, "min-height", value.getCssValue()); super.setCssProperty(widget, styleClass, "minHeight", value.getCssValue()); @@ -340,7 +341,7 @@ 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(), "max-height", value.getCssValue()); + Utils.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "max-height", value.getCssValue()); } this.addStyleToStore(styleClass, "max-height", value.getCssValue()); super.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue()); @@ -355,7 +356,7 @@ GdlTitle.super.onHoverStart(event, handler); if(source.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -367,7 +368,7 @@ GdlTitle.super.onHoverStart(widget); if(widget.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -378,7 +379,7 @@ GdlTitle.super.onFocusStart(widget); if(widget.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleFocusCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -390,7 +391,7 @@ GdlTitle.super.onFocusStart(event, handler); if(source.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleFocusCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -401,7 +402,7 @@ GdlTitle.super.onActiveStart(widget); if(widget.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleActiveCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -413,7 +414,7 @@ GdlTitle.super.onActiveStart(event, handler); if(source.getClass().equals(TitleWidget.class)){ for (Pair<String, String> pair : this.titleActiveCssNamesAndStyles) { - GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + Utils.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); } } } @@ -484,7 +485,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"); + Utils.replaceStyleProperty(this.titleElement, "margin", "0px"); }