Changeset 583


Ignore:
Timestamp:
07/08/11 11:01:43 (14 years ago)
Author:
lgiessmann
Message:

gdl-frontend: Widgets: fixed the registration of event-handlers for GdlList? => fixed the style-handlers for hover, active and focus

Location:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java

    r581 r583  
    2222import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue;
    2323import com.google.gwt.core.client.JsArray;
    24 import com.google.gwt.dom.client.Element;
    2524import com.google.gwt.dom.client.Style.Display;
    2625import com.google.gwt.dom.client.Style.Float;
     
    5655import com.google.gwt.user.client.ui.VerticalPanel;
    5756import com.google.gwt.user.client.ui.Widget;
    58 import com.google.gwt.dom.client.Node;
    5957
    6058
  • TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java

    r581 r583  
    8484                        Topic gdlDisplay = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlDisplay));
    8585                        Topic gdlContentOrientation = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlContentOrientation));
     86                        Topic gdlListStyleType = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlListStyleType));
     87                       
    8688                       
    8789                        tmpRepresentative.createOccurrence(gdlId, "ID_1", null);
     
    107109                        tmpRepresentative.createOccurrence(gdlDisplay, "inline", null);
    108110                        tmpRepresentative.createOccurrence(gdlContentOrientation, "vertical", null);
     111                        tmpRepresentative.createOccurrence(gdlListStyleType, "square", null);
    109112                        Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
    110113                        bgcHover.addTheme(gdlHover);
     
    117120                       
    118121                       
    119                         GdlList tmp = new GdlList(tmpRepresentative){};
     122                        GdlList tmp = new GdlList(tmpRepresentative);
    120123                        this.mainPanel.add(tmp);
    121124                }catch(Exception e){
  • TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java

    r582 r583  
    88import com.google.gwt.user.client.ui.Widget;
    99import com.google.gwt.dom.client.Node;
     10import com.google.gwt.event.dom.client.BlurEvent;
     11import com.google.gwt.event.dom.client.BlurHandler;
     12import com.google.gwt.event.dom.client.FocusEvent;
     13import com.google.gwt.event.dom.client.FocusHandler;
     14import com.google.gwt.event.dom.client.HasBlurHandlers;
     15import com.google.gwt.event.dom.client.HasFocusHandlers;
     16import com.google.gwt.event.dom.client.HasMouseDownHandlers;
     17import com.google.gwt.event.dom.client.HasMouseOutHandlers;
     18import com.google.gwt.event.dom.client.HasMouseOverHandlers;
     19import com.google.gwt.event.dom.client.HasMouseUpHandlers;
     20import com.google.gwt.event.dom.client.MouseDownEvent;
     21import com.google.gwt.event.dom.client.MouseDownHandler;
     22import com.google.gwt.event.dom.client.MouseOutEvent;
     23import com.google.gwt.event.dom.client.MouseOutHandler;
     24import com.google.gwt.event.dom.client.MouseOverEvent;
     25import com.google.gwt.event.dom.client.MouseOverHandler;
     26import com.google.gwt.event.dom.client.MouseUpEvent;
     27import com.google.gwt.event.dom.client.MouseUpHandler;
     28import com.google.gwt.event.shared.HandlerRegistration;
    1029import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
    1130import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
    1231import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
    1332import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
     33import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
    1434import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
     35import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
     36import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
    1537import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
    1638import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
     
    1840import us.isidor.gdl.anaToMia.Widgets.values.ListStyleTypeValue;
    1941
    20 // TODO: check style attributes + css pseudo classes
    2142
    2243public class GdlList extends GdlVisibleObject{
     
    3859                // this object is able to own only one sub-element
    3960                ListWidget list = new ListWidget(this.getOrdered());
     61                ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
     62                FocusStyleHandler fsHandler = new FocusStyleHandler(this);
     63                HoverStyleHandler hsHandler = new HoverStyleHandler(this);
     64                int idSuffix = 0;
     65                if(this.subElements != null) idSuffix = this.subElements.size();
     66                list.setId(this.getId() + "__GDL_" + idSuffix);
     67                list.addMouseDownHandler(asHandler);
     68                list.addMouseUpHandler(asHandler);
     69                list.addMouseOverHandler(hsHandler);
     70                list.addMouseOutHandler(hsHandler);
     71                list.addFocusHandler(fsHandler);
     72                list.addBlurHandler(fsHandler);
    4073                super.addToContainerPanel(list);       
    4174                this.setGdlStyle(list);
     
    135168                super.setGdlStyle(widget);
    136169
    137                 this.setListStylePositionValue((ListWidget)widget, this.getListStylePosition());
    138                 this.setListStyleType((ListWidget)widget, this.getListStyleType());
     170                // this may be only called if the ListWidget is the passed argument
     171                if(widget.getClass().equals(ListWidget.class)){
     172                        this.setListStylePositionValue((ListWidget)widget, this.getListStylePosition());
     173                        this.setListStyleType((ListWidget)widget, this.getListStyleType());
     174                }
    139175        }
    140176       
     
    149185       
    150186        // Wraps a ul an ol element as a widget based on a SimplePanel
    151         protected class ListWidget extends Composite {
     187        protected class ListWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers{
    152188                private SimplePanel basePanel = new SimplePanel();
    153189                private Element listElement = null;
     
    236272                        return -1;
    237273                }
     274               
     275               
     276                public void setId(String id){
     277                        DOM.setElementAttribute(this.basePanel.getElement(), "id", id);
     278                }
     279
     280
     281                @Override
     282                public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
     283                        return this.basePanel.addDomHandler(handler, MouseOverEvent.getType());
     284                }
     285
     286
     287                @Override
     288                public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
     289                        return this.basePanel.addDomHandler(handler, MouseOutEvent.getType());
     290                }
     291
     292
     293                @Override
     294                public HandlerRegistration addBlurHandler(BlurHandler handler) {
     295                        return this.basePanel.addDomHandler(handler, BlurEvent.getType());
     296                }
     297
     298
     299                @Override
     300                public HandlerRegistration addFocusHandler(FocusHandler handler) {
     301                        return this.basePanel.addDomHandler(handler, FocusEvent.getType());
     302                }
     303
     304
     305                @Override
     306                public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
     307                        return this.basePanel.addDomHandler(handler, MouseUpEvent.getType());
     308                }
     309
     310
     311                @Override
     312                public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
     313                        return this.basePanel.addDomHandler(handler, MouseDownEvent.getType());
     314                }
    238315        }
    239316       
     
    298375                        }
    299376                }
    300                
    301                
    302                
    303377        }
    304378}
Note: See TracChangeset for help on using the changeset viewer.