Author: lgiessmann Date: Fri Jul 15 00:24:45 2011 New Revision: 622
Log: gdl-frontend: Widgets: fixed a bug when appending sub-elements to a view in relation to a specific existent sub-element; changed the setters of GdlView depending the Gdl-Style-Properties
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/view/GdlView.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 Thu Jul 14 14:01:08 2011 (r621) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 15 00:24:45 2011 (r622) @@ -91,6 +91,16 @@ public Topic getTmRepresentative(){ return this.tmRepresentative; } + + + public void registerButtonCallback(ClickHandler handler, String id){ + // TODO: implement + } + + + public void deregisterButtonCallback(ClickHandler handler, String id){ + // TODO: implement + }
// this method should be invoked if a new sub-element is added to this instance
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Jul 14 14:01:08 2011 (r621) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 15 00:24:45 2011 (r622) @@ -27,7 +27,7 @@ Window.alert("TEST !!!"); RootPanel.get("GWT_Content").add(mainPanel); mainPanel.setBorderWidth(1); - mainPanel.setPixelSize(500, 500); + mainPanel.setPixelSize(1000, 600); ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>(); requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://psi.test.org/gdl-test/Poet", TopicIdentifierTypes.SubjectIdentifier));
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java Thu Jul 14 14:01:08 2011 (r621) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java Fri Jul 15 00:24:45 2011 (r622) @@ -5,6 +5,7 @@ import com.google.gwt.core.client.JsArray; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Widget; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; @@ -18,11 +19,10 @@ import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.GdlInstantiator; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.value.ContentOrientationValue;
public abstract class GdlView extends GdlVisibleObject implements IGdlContainer, IGdlHasValue { - // TODO: all setter from visible object must infer only the mainPanel - protected GdlView(){ super(); } @@ -42,6 +42,24 @@ } + // this method should be invoked if a new sub-element is added to this instance. + // instances ov GdlView does not organize their sub-elements in + // tables, sub-elements are placed directly on the mainpanel + @Override + protected void addToContainerPanel(Widget widget){ + this.subElements.add(widget); + this.mainPanel.add(widget); + } + + + // content orientation has no effect on a view + @Override + public void setContentOrientation(Widget widget, ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException { + // do nothing, no table is set for organizing content widgets, since a view does not organize + // its content in this manner + } + + public String getViewName()throws InvalidGdlSchemaException { JsArray<Name> viewNames = super.tmRepresentative.getNames(tm.getTopicBySubjectIdentifier(tm.createLocator(GdlPsis.NameType.gdlViewName))); if(viewNames.length() != 1){ @@ -52,12 +70,12 @@ public void registerButtonCallback(ClickHandler handler, String id){ - //TODO: implement + for (Widget widget : this.subElements) ((GdlVisibleObject)widget).registerButtonCallback(handler, id); }
public void deregisterButtonCallback(ClickHandler handler, String id){ - // TODO: implement + for (Widget widget : this.subElements) ((GdlVisibleObject)widget).deregisterButtonCallback(handler, id); } @@ -69,6 +87,20 @@ } + // sets all GDL styles that are defined by the topic map representative. + // In contrast to visible-object, the styles are applied only on the main + // panel, since the view's sub-elements must be formatted with their own + // style properties + @Override + protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { + this.setDisplay(this.getDisplay()); + this.setZindex(this.getZindex()); + this.setFloat(this.getFloat()); + this.setClear(this.getClear()); + super.setGdlStyle(this); + } + + // creates a GdlVisbleObject instance of the passed topic current and inserts it // by using it's defined position style depending on the GdlVisibleObject // represented by ancestor. If ancestor is null current is the first topic @@ -88,7 +120,7 @@ this.subElements.add(newObj); if(super.getTmRepresentative().equals(ancestor))this.mainPanel.add(newObj); - else DOM.insertBefore(this.mainPanel.getElement(), newObj.getElement(), oldObj.getElement()); + else this.mainPanel.insert(newObj, this.mainPanel.getWidgetIndex(oldObj) + 1); position.setAttributes(newObj); return newObj; }