Author: lgiessmann Date: Mon Jul 11 06:50:59 2011 New Revision: 597
Log: gdl-frontend: Widgets: implemnted GdlDatePicker
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/complexData/GdlDatePicker.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 Mon Jul 11 03:35:13 2011 (r596) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 11 06:50:59 2011 (r597) @@ -4,6 +4,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.complexData.GdlDatePicker; import us.isidor.gdl.anaToMia.Widgets.container.GdlUnit; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; @@ -97,8 +98,8 @@ tmpRepresentative.createOccurrence(gdlId, "ID_1", null); tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); - tmpRepresentative.createOccurrence(gdlWidth, "300px", null); - tmpRepresentative.createOccurrence(gdlHeight, "300px", null); + tmpRepresentative.createOccurrence(gdlWidth, "100px", null); + tmpRepresentative.createOccurrence(gdlHeight, "100px", null); tmpRepresentative.createOccurrence(gdlBorderRadius, "30px", null); tmpRepresentative.createOccurrence(gdlBorderBottomRightRadius, "2%", null); tmpRepresentative.createOccurrence(gdlPadding, "5px", null); @@ -142,7 +143,7 @@ - GdlUnit tmp = new GdlUnit(tmpRepresentative); + GdlDatePicker tmp = new GdlDatePicker(tmpRepresentative); this.mainPanel.add(tmp); }catch(Exception e){ e.printStackTrace();
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java Mon Jul 11 03:35:13 2011 (r596) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java Mon Jul 11 06:50:59 2011 (r597) @@ -1,5 +1,142 @@ package us.isidor.gdl.anaToMia.Widgets.complexData;
-public class GdlDatePicker extends GdlComplexData { - // TODO: implement +import java.util.ArrayList; + +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.Widget; +import com.google.gwt.user.datepicker.client.DatePicker; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; +import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue; +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; + + + +public class GdlDatePicker extends GdlComplexData implements IGdlHasValue { + + // some constructors + protected GdlDatePicker(){ + super(); + } + + + public GdlDatePicker(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ + super(tmRepresentative); + // create a date widget for each tm-construct + this.createDateWidget(); + } + + + + public void createDateWidget() throws InvalidGdlSchemaException, ExecutionException { + // this object is able to own only one sub-element + + DateWidget date = new DateWidget(); + 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(); + date.setId(this.getId() + "__GDL_" + idSuffix); + date.addMouseDownHandler(asHandler); + date.addMouseUpHandler(asHandler); + date.addMouseOverHandler(hsHandler); + date.addMouseOutHandler(hsHandler); + date.addFocusHandler(fsHandler); + date.addBlurHandler(fsHandler); + + super.addToContainerPanel(date); + this.setGdlStyle(date); + } + + + + + @Override + public ArrayList<String> getStringValue() { + // TODO: implement + return null; + } + + + @Override + public ArrayList<Pair<TopicMapsTypes, Object>> getTmValue() { + // TODO Auto-generated method stub + return null; + } + + + @Override + public boolean validate() { + // TODO Auto-generated method stub + return false; + } + + + + protected class DateWidget extends DatePicker implements HasFocusHandlers, HasBlurHandlers, HasMouseDownHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers { + public void setId(String id){ + DOM.setElementAttribute(this.getElement(), "id", id); + } + + + @Override + public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { + return this.addDomHandler(handler, MouseOverEvent.getType()); + } + + + @Override + public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { + return this.addDomHandler(handler, MouseOutEvent.getType()); + } + + + @Override + public HandlerRegistration addBlurHandler(BlurHandler handler) { + return this.addDomHandler(handler, BlurEvent.getType()); + } + + + @Override + public HandlerRegistration addFocusHandler(FocusHandler handler) { + return this.addDomHandler(handler, FocusEvent.getType()); + } + + + @Override + public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { + return this.addDomHandler(handler, MouseUpEvent.getType()); + } + + + @Override + public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { + return this.addDomHandler(handler, MouseDownEvent.getType()); + } + } }