isidorus-cvs
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- 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
- 1037 discussions

[isidorus-cvs] r589 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
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 13:00:49 2011
New Revision: 589
Log:
gdl-frontend: Widgets: fixed a bug in GdlVisibleObject.replaceStyleProperty(...), since GWT does not handle String.matches(...)
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
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 10:29:08 2011 (r588)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 13:00:49 2011 (r589)
@@ -11,6 +11,7 @@
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.values.AutoNumUnitValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue;
@@ -105,15 +106,19 @@
public static void replaceStyleProperty(Element elem, String styleName, String styleValue){
String oldStyle = elem.getAttribute("style");
- //Window.alert(">> _" + oldStyle + "_<<" + " >> _" + styleName + "_<< => " + oldStyle.matches("(^| |;)" + styleName + " *:")); // TODO: remove
- if(oldStyle.matches("(^| |;)" + styleName + " *:")){
- Window.alert("!!!TEST!!!");
-
- elem.setAttribute("style", oldStyle.replaceFirst(styleName + ":.+;", styleName + ": " + styleValue + ";"));
- } else {
- elem.setAttribute("style", oldStyle + " " + styleName + ": " + styleValue + ";");
- }
-
+ 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/base/TestClass.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 10:29:08 2011 (r588)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 13:00:49 2011 (r589)
@@ -123,20 +123,6 @@
GdlTitle tmp = new GdlTitle(tmpRepresentative);
this.mainPanel.add(tmp);
-
-
-
-
- String oldStyle = "margin: 0px; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: normal; text-decoration: underline; font-style: normal; font-size: 15pt; font-weight: NORMAL; letter-spacing: normal; word-spacing: normal; font-size: 25pt; font-size: 25pt; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: ... word-spacing: normal; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: normal; text-decoration: underline; font-style: normal; font-size: 15pt; font-weight: NORMAL; letter-spacing: normal; word-spacing: normal;";
-
- /*
- String rex = "width";
- Window.alert(" ==> " + oldStyle.matches("width"));
- Window.alert(oldStyle.replaceAll(" width:[^;]*;", " WIDTH:xyz;"));
- */
-
- Pattern pattern = new Pattern("width");
- Window.alert(">> " + pattern.matches(oldStyle));
}catch(Exception e){
e.printStackTrace();
Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage());
1
0

[isidorus-cvs] r588 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment text 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 10:29:08 2011
New Revision: 588
Log:
gdl-frontend: Widgets: implemented a GWT widget as a pendant to the java.util.Pattern for regular expressions
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/Pattern.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/TestClass.java
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/values/FontWeightValue.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 09:27:41 2011 (r587)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 10:29:08 2011 (r588)
@@ -105,8 +105,11 @@
public static void replaceStyleProperty(Element elem, String styleName, String styleValue){
String oldStyle = elem.getAttribute("style");
+ //Window.alert(">> _" + oldStyle + "_<<" + " >> _" + styleName + "_<< => " + oldStyle.matches("(^| |;)" + styleName + " *:")); // TODO: remove
if(oldStyle.matches("(^| |;)" + styleName + " *:")){
- elem.setAttribute("style", oldStyle.replaceAll(styleName + ":.+;", styleName + ": " + styleValue + ";"));
+ Window.alert("!!!TEST!!!");
+
+ elem.setAttribute("style", oldStyle.replaceFirst(styleName + ":.+;", styleName + ": " + styleValue + ";"));
} else {
elem.setAttribute("style", oldStyle + " " + styleName + ": " + styleValue + ";");
}
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 09:27:41 2011 (r587)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 8 10:29:08 2011 (r588)
@@ -1,12 +1,11 @@
package us.isidor.gdl.anaToMia.Widgets.base;
+
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.environment.Pattern;
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;
@@ -124,6 +123,20 @@
GdlTitle tmp = new GdlTitle(tmpRepresentative);
this.mainPanel.add(tmp);
+
+
+
+
+ String oldStyle = "margin: 0px; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: normal; text-decoration: underline; font-style: normal; font-size: 15pt; font-weight: NORMAL; letter-spacing: normal; word-spacing: normal; font-size: 25pt; font-size: 25pt; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: ... word-spacing: normal; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; font-size: 25pt; width: 300px; max-idth: auto; min-width: auto; height: 300px; max-height: auto; min-height: auto; color: #000000; direction: rtl; text-align: left; line-height: normal; text-decoration: underline; font-style: normal; font-size: 15pt; font-weight: NORMAL; letter-spacing: normal; word-spacing: normal;";
+
+ /*
+ String rex = "width";
+ Window.alert(" ==> " + oldStyle.matches("width"));
+ Window.alert(oldStyle.replaceAll(" width:[^;]*;", " WIDTH:xyz;"));
+ */
+
+ Pattern pattern = new Pattern("width");
+ Window.alert(">> " + pattern.matches(oldStyle));
}catch(Exception e){
e.printStackTrace();
Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage());
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/Pattern.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/environment/Pattern.java Fri Jul 8 10:29:08 2011 (r588)
@@ -0,0 +1,182 @@
+package us.isidor.gdl.anaToMia.Widgets.environment;
+
+// source: http://www.java2s.com/Code/Java/GWT/ImplementjavautilregexPatternwithJavasc…
+
+/*
+ * Copyright 2006 Robert Hanson <iamroberthanson AT gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+/**
+ * <p>
+ * Implementation of the {@link java.util.regex.Pattern} class with a
+ * wrapper aroung the Javascript <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expr…">RegExp</a> object.
+ * As most of the methods delegate to the JavaScript RegExp object, certain differences in the
+ * declaration and behaviour of regular expressions must be expected.
+ * </p>
+ * <p>
+ * Please note that neither the {@link java.util.regex.Pattern#compile(String)} method nor
+ * {@link Matcher} instances are supported. For the later, consider using {@link Pattern#match(String)}.
+ * </p>
+ *
+ * @author George Georgovassilis
+ *
+ */
+public class Pattern {
+
+ /**
+ * Declares that regular expressions should be matched across line borders.
+ */
+ public final static int MULTILINE = 1;
+
+ /**
+ * Declares that characters are matched reglardless of case.
+ */
+ public final static int CASE_INSENSITIVE = 2;
+
+ private JavaScriptObject regExp;
+
+ private static JavaScriptObject createExpression(String pattern, int flags) {
+ String sFlags = "";
+ if ((flags & MULTILINE) != 0)
+ sFlags += "m";
+ if ((flags & CASE_INSENSITIVE) != 0)
+ sFlags += "i";
+ return _createExpression(pattern, sFlags);
+ }
+
+ private static native JavaScriptObject _createExpression(String pattern,
+ String flags)/*-{
+ return new RegExp(pattern, flags);
+ }-*/;
+
+ private native void _match(String text, @SuppressWarnings("rawtypes") List matches)/*-{
+ var regExp = this.@us.isidor.gdl.anaToMia.Widgets.environment.Pattern::regExp;
+ var result = text.match(regExp);
+ if (result == null) return;
+ for (var i=0;i<result.length;i++)
+ matches.@java.util.ArrayList::add(Ljava/lang/Object;)(result[i]);
+ }-*/;
+
+ /**
+ * Determines wether the specified regular expression is validated by the
+ * provided input.
+ * @param regex Regular expression
+ * @param input String to validate
+ * @return <code>true</code> if matched.
+ */
+ public static boolean matches(String regex, String input) {
+ return new Pattern(regex).matches(input);
+ }
+
+ /**
+ * Escape a provided string so that it will be interpreted as a literal
+ * in regular expressions.
+ * The current implementation does escape each character even if not neccessary,
+ * generating verbose literals.
+ * @param input
+ * @return
+ */
+ public static String quote(String input) {
+ String output = "";
+ for (int i = 0; i < input.length(); i++) {
+ output += "\\" + input.charAt(i);
+ }
+ return output;
+ }
+
+ /**
+ * Class constructor
+ * @param pattern Regular expression
+ */
+ public Pattern(String pattern) {
+ this(pattern, 0);
+ }
+
+ /**
+ * Class constructor
+ * @param pattern Regular expression
+ * @param flags
+ */
+ public Pattern(String pattern, int flags) {
+ regExp = createExpression(pattern, flags);
+ }
+
+ /**
+ * This method is borrowed from the JavaScript RegExp object.
+ * It parses a string and returns as an array any assignments to parenthesis groups
+ * in the pattern's regular expression
+ * @param text
+ * @return Array of strings following java's Pattern convention for groups:
+ * Group 0 is the entire input string and the remaining groups are the matched parenthesis.
+ * In case nothing was matched an empty array is returned.
+ */
+ public String[] match(String text) {
+ @SuppressWarnings("rawtypes")
+ List matches = new ArrayList();
+ _match(text, matches);
+ String arr[] = new String[matches.size()];
+ for (int i = 0; i < matches.size(); i++)
+ arr[i] = matches.get(i).toString();
+ return arr;
+ }
+
+ /**
+ * Determines wether a provided text matches the regular expression
+ * @param text
+ * @return
+ */
+ public native boolean matches(String text)/*-{
+ var regExp = this.@us.isidor.gdl.anaToMia.Widgets.environment.Pattern::regExp;
+ return regExp.test(text);
+ }-*/;
+
+ /**
+ * Returns the regular expression for this pattern
+ * @return
+ */
+ public native String pattern()/*-{
+ var regExp = this.@us.isidor.gdl.anaToMia.Widgets.environment.Pattern::regExp;
+ return regExp.source;
+ }-*/;
+
+ private native void _split(String input, @SuppressWarnings("rawtypes") List results)/*-{
+ var regExp = this.@us.isidor.gdl.anaToMia.Widgets.environment.Pattern::regExp;
+ var parts = input.split(regExp);
+ for (var i=0;i<parts.length;i++)
+ results.@java.util.ArrayList::add(Ljava/lang/Object;)(parts[i] );
+ }-*/;
+
+ /**
+ * Split an input string by the pattern's regular expression
+ * @param input
+ * @return Array of strings
+ */
+ public String[] split(String input){
+ @SuppressWarnings("rawtypes")
+ List results = new ArrayList();
+ _split(input, results);
+ String[] parts = new String[results.size()];
+ for (int i=0;i<results.size();i++)
+ parts[i] = (String)results.get(i);
+ return parts;
+ }
+
+}
+
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:27:41 2011 (r587)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 10:29:08 2011 (r588)
@@ -278,10 +278,10 @@
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());
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "width", value.getCssValue()); // TODO: fix
}
this.addStyleToStore(styleClass, "width", value.getCssValue());
- this.setCssProperty(widget, styleClass, "width", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "width", value.getCssValue());
}
}
@@ -290,10 +290,10 @@
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());
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "min-width", value.getCssValue());
}
- this.addStyleToStore(styleClass, "minWidth", value.getCssValue());
- this.setCssProperty(widget, styleClass, "minWidth", value.getCssValue());
+ this.addStyleToStore(styleClass, "min-width", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "minWidth", value.getCssValue());
}
}
@@ -302,10 +302,10 @@
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());
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "max-width", value.getCssValue());
}
- this.addStyleToStore(styleClass, "maxWidth", value.getCssValue());
- this.setCssProperty(widget, styleClass, "maxWidth", value.getCssValue());
+ this.addStyleToStore(styleClass, "max-width", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "maxWidth", value.getCssValue());
}
}
@@ -317,7 +317,7 @@
super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "height", value.getCssValue());
}
this.addStyleToStore(styleClass, "height", value.getCssValue());
- this.setCssProperty(widget, styleClass, "height", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "height", value.getCssValue());
}
}
@@ -326,10 +326,10 @@
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());
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "min-height", value.getCssValue());
}
- this.addStyleToStore(styleClass, "minHeight", value.getCssValue());
- this.setCssProperty(widget, styleClass, "minHeight", value.getCssValue());
+ this.addStyleToStore(styleClass, "min-height", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "minHeight", value.getCssValue());
}
}
@@ -338,10 +338,10 @@
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());
+ super.replaceStyleProperty(((TitleWidget)widget).getTitleElement(), "max-height", value.getCssValue());
}
- this.addStyleToStore(styleClass, "maxHeight", value.getCssValue());
- this.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue());
+ this.addStyleToStore(styleClass, "max-height", value.getCssValue());
+ super.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue());
}
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java Fri Jul 8 09:27:41 2011 (r587)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java Fri Jul 8 10:29:08 2011 (r588)
@@ -17,7 +17,7 @@
@Override
public String getCssValue() {
- String str = this.toString();
+ String str = this.toString().toLowerCase();
if(str.startsWith("_")) return str.substring(1);
else return str;
}
1
0

[isidorus-cvs] r587 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base 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:27:41 2011
New Revision: 587
Log:
gdl-frontend: Widgets: implemented the style-handlers of GdlTitle
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/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 8 09:14:13 2011 (r586)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 09:27:41 2011 (r587)
@@ -113,7 +113,6 @@
}
-
// 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/text/GdlTitle.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:14:13 2011 (r586)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:27:41 2011 (r587)
@@ -40,7 +40,6 @@
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;
@@ -60,6 +59,7 @@
super(tmRepresentative);
// TODO: create a Title element for each TM-elem
this.createTitle();
+ this.createTitle();
}
@@ -67,7 +67,6 @@
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);
@@ -347,33 +346,15 @@
}
-
-
-
-
-
-
- // TODO: override 2x onActiveStart => handle style classes
-
- // TODO: override 2x onHoverStart => handle style classes
-
- // TODO: override 2x onFocusStart => handle style classes
-
-
-
-
-
-
-
-
// 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);
- Window.alert("TEST 1 >> " + source.getClass());
+ GdlTitle.super.onHoverStart(event, handler);
if(source.getClass().equals(TitleWidget.class)){
- // TODO: implement
+ for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) {
+ GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond());
+ }
}
}
@@ -381,26 +362,61 @@
// applies the styles bound to hover and the passed element
@Override
protected void onHoverStart(Widget widget){
- Window.alert("TEST 1.1 >> " + widget.getClass());
+ GdlTitle.super.onHoverStart(widget);
if(widget.getClass().equals(TitleWidget.class)){
- // TODO: implement
- }
- for (Pair<String, String> elem : this.hoverCssNamesAndStyles) {
- DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond());
+ for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) {
+ GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond());
+ }
}
}
-
+ // applies the styles bound to focus and the passed element
+ protected void onFocusStart(Widget widget){
+ 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());
+ }
+ }
+ }
+ // shall be called to apply the styles of the focus class
+ public void onFocusStart(FocusEvent event, FocusStyleHandler handler) {
+ Widget source = (Widget)event.getSource();
+ 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());
+ }
+ }
+ }
+ // applies the styles bound to acitve and the passed element
+ protected void onActiveStart(Widget widget){
+ 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());
+ }
+ }
+ }
+ // shall be called to apply the styles of the active class
+ public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) {
+ Widget source = (Widget)event.getSource();
+ 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());
+ }
+ }
+ }
-
// 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{
1
0

[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