Author: lgiessmann Date: Wed Jul 6 12:33:40 2011 New Revision: 571
Log: gdl-frontend: Widgets: fixed a bug when applying the readonly property
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
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 Wed Jul 6 11:55:37 2011 (r570) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Wed Jul 6 12:33:40 2011 (r571) @@ -82,13 +82,15 @@ Topic gdlOverflow = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlOverflow)); Topic gdlTextDecoration = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlTextDecoration)); - - tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); tmpRepresentative.createOccurrence(gdlId, "ID_1", null); + /* + tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); + */ tmpRepresentative.createOccurrence(gdlWidth, "300px", null); tmpRepresentative.createOccurrence(gdlHeight, "300px", null); tmpRepresentative.createOccurrence(gdlBorderRadius, "30px", null); tmpRepresentative.createOccurrence(gdlBorderBottomRightRadius, "2%", null); + /* tmpRepresentative.createOccurrence(gdlPadding, "5px", null); tmpRepresentative.createOccurrence(gdlPaddingLeft, "5%", null); tmpRepresentative.createOccurrence(gdlCursor, CursorValue.HELP.getCssValue(), null); @@ -112,7 +114,7 @@ bgcFocus.addTheme(gdlFocus); Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null); fsHover.addTheme(gdlHover); - + */ GdlText tmp = new GdlText(tmpRepresentative){};
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 Wed Jul 6 11:55:37 2011 (r570) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Wed Jul 6 12:33:40 2011 (r571) @@ -545,11 +545,11 @@ // sets the resize style property. // If gdl:readonly is set to true, this property is set to none, i.e. the passed value is ignored. // IF gdl:readonly is set to false, this property is set to the passed argument. - public void setResize(ResizeValue value) throws InvalidGdlSchemaException, ExecutionException{ + public void setResize(Widget widget, ResizeValue value) throws InvalidGdlSchemaException, ExecutionException{ if(value == null || getReadonly() == true){ - for (TextArea elem : this.textElements) this.setCssProperty(elem, null, "resize", "none"); + DOM.setStyleAttribute(widget.getElement(), "resize", "none"); } else{ - for (TextArea elem : this.textElements) this.setCssProperty(elem, null, "resize", value.getCssValue()); + DOM.setStyleAttribute(widget.getElement(), "resize", value.getCssValue()); } // TODO: if resize == true => set width/height of the outer/container element after the resize operation @@ -557,8 +557,8 @@ // sets the readonly property of this element's text are element - public void setReadonly(boolean value){ - for (TextArea item : this.textElements) item.setReadOnly(value); + public void setReadonly(Widget widget, boolean value){ + ((TextArea)widget).setReadOnly(value); } @@ -588,12 +588,12 @@ // sets the rows property if gdl:width is not set - public void setRows(int value) throws InvalidGdlSchemaException, ExecutionException { + public void setRows(Widget widget, int value) throws InvalidGdlSchemaException, ExecutionException { if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is "" + value + """); Occurrence heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlHeight);
// rows is only treated if height is not set - if(heightOcc == null) this.setRows(value); + if(heightOcc == null) ((TextArea)widget).setVisibleLines(value); // set the outer element (the panel to the correct size if it is not set //TODO: super.setHeight(new AutoNumUnitValue(this.textElement.getOffsetHeight() + "px"), null); @@ -601,12 +601,12 @@ // sets the cols property if gdl:height is not set - public void setCols(int value) throws InvalidGdlSchemaException, ExecutionException { + public void setCols(Widget widget, int value) throws InvalidGdlSchemaException, ExecutionException { if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is "" + value + """); Occurrence widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlWidth);
// cols is only treated if width is not set - if(widthOcc == null) this.setCols(value); + if(widthOcc == null) DOM.setElementAttribute(widget.getElement(), "cols", String.valueOf(value)); // set the outer element (the panel to the correct size if it is not set //TODO: super.setWidth(new AutoNumUnitValue(this.textElement.getOffsetWidth() + "px"), null); @@ -929,15 +929,16 @@ public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { - this.setReadonly(this.getReadonly()); - this.setResize(this.getResize()); - this.setTextType(this.getTextType()); - this.setRows(this.getRows()); - this.setCols(this.getCols()); this.setContentOrientation(widget, this.getContentOrientation()); String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; for (String styleClass : styleClasses) { + this.setReadonly(widget, this.getReadonly()); + this.setResize(widget, this.getResize()); + this.setTextType(this.getTextType()); + this.setRows(widget, this.getRows()); + this.setCols(widget, this.getCols()); + this.setOverflow(widget, this.getOverflow(styleClass), styleClass); this.setVerticalAlign(widget, this.getVerticalAlign(styleClass), styleClass); @@ -1015,7 +1016,21 @@ // resets the size of this element depending on the amount of inner sub-elements @Override protected void adjustSize(){ - // TODO: implement => width, height, overflow of the mainpanel + + + + // if width is not set => auto + // if width is set => offset width of the biggest sub-elements || width of sub-elements + // if min-width is not set => auto + // if min-width is set => offset width of the biggest sub-elements || min-width of sub-elements + // if max-width is not set => auto + // if max-width is set => offset width of the biggest sub-elements || max-width of sub-elements + + + + + + // TODO: set overflow of the element }