Author: lgiessmann Date: Thu Jul 7 09:29:24 2011 New Revision: 578
Log: gdl-frontend: Widgets: started to implement GdlList
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/ 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/GDL_Widgets.gwt.xml branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Jul 7 08:49:40 2011 (r577) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Jul 7 09:29:24 2011 (r578) @@ -22,6 +22,7 @@ <source path="base"/> <source path="views"/> <source path="text"/> + <source path="container"/> <source path="environment"/> <source path="values"/> <source path="isidorus"/>
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 7 08:49:40 2011 (r577) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 09:29:24 2011 (r578) @@ -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; @@ -54,6 +55,7 @@ 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{ @@ -100,6 +102,20 @@ 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){
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.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/container/GdlList.java Thu Jul 7 09:29:24 2011 (r578) @@ -0,0 +1,49 @@ +package us.isidor.gdl.anaToMia.Widgets.container; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.DOM; + +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class GdlList extends GdlVisibleObject implements IGdlContainer{ + protected Element listElement = null; + + // some constructors + protected GdlList(){ + super(); + } + + + public GdlList(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ + super(tmRepresentative); + } + + + public void initList(boolean ordered){ + Element elem = DOM.createElement(ordered ? "ol" : "ul"); + super.addToContainerPanel(elem); + } + + + public void createListItem(){ + + } + + + public boolean getOrdered(){ + // TODO: implement + return false; + } + + + @Override + public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant) + throws InvalidGdlSchemaException { + // TODO Auto-generated method stub + + } +}