this.getLayoutParent() IIRC Robert Wende wrote: > Hi Matt, > > thanks - i didn't see the forest for the trees. > i only need a reference in the StartWidget to the TravelplanerContainer. Is > this possible about a getParent-method? > > Thanks > > > -------- Original-Nachricht -------- >> Datum: Wed, 03 Jun 2009 16:45:52 +0100 >> Von: Matthew Gregory <[email protected]> >> An: [email protected] >> Betreff: Re: [qooxdoo-devel] Property usage > >> OK, I haven't examined the code in detail but it looks fine, the problem >> is you are calling getJourneyContainer before setJourneyContainer >> >> You do this first: >> this.__startWidget = new travelagent..StartWidget(componentData); >> >> This will call the constructor which is where you are calling >> getJourneyContainer. Then after the constructor returns you are >> setting it >> this.__startWidget.setJourneyContainer("test0rn"); >> >> You need to rearrange your code >> >> > properties: { >> > journeyContainer : {inheritable:true, deferredInit: true} >> >> you could add an apply key to this >> >> > properties: { >> > journeyContainer : {inheritable:true, deferredInit: true, apply >> : >> "_applyJourneyContainer"} >> >> You can then add a function to your class that will get called when you >> set the property >> >> _applyJourneyContainer : function(value) >> { >> alert(value); >> } >> >> >> Hope that helps! >> Matt >> >> >> >> Robert Wende wrote: >>> Hi Matt, >>> >>> my abstract class looks like: >>> >>> qx.Class.define("travelagent.impl.fe.travelplaner.uis.AbstractMediator", >>> { >>> type: "abstract", >>> extend: qx.ui.container.Composite, >>> >>> properties: { >>> journeyContainer : {inheritable:true, deferredInit: true} >>> }, >>> >>> members: { >>> /** >>> * @abstract >>> */ >>> edit: function() {return true;}, >>> openMap: function() {return true;}, >>> save: function() {return true;}, >>> update: function(e) {return true;} >>> >>> } >>> }); >>> >>> then i derive a DestinationWidget: >>> >>> >> qx.Class.define("travelagent.impl.fe.travelplaner.uis.DestinationWidget",{ >>> >>> type: "abstract", >>> extend: travelagent.impl.fe.travelplaner.uis.AbstractMediator, >>> >>> properties: { >>> destinationData : {inheritable:true, deferredInit:true, check : >> "travelagent.impl.data.DestinationData"}, >>> clockWidget : {inheritable:true, deferredInit:true}, >>> calendarWidget : {inheritable:true, deferredInit:true}, >>> mapWidget : {inheritable:true, deferredInit:true} >>> }, >>> >>> members:{ >>> openMap:function(){ >>> return true; >>> } >>> } >>> }); >>> >>> and in my StartWidget, i want to use the journeyContainer-Prop from the >> AbstractMediator. >>> qx.Class.define("travelagent.impl.fe.travelplaner.uis.StartWidget",{ >>> >>> extend:travelagent.impl.fe.travelplaner.uis.DestinationWidget, >>> >>> >>> construct: function(data){ >>> >>> this.base(arguments); >>> this.initDestinationData(data); >>> >>> this.__buildLayout(); //external method for the layout >>> >>> alert(this.getJourneyContainer()); //test the prop >>> }, >>> ... >>> } >>> >>> The alert-methode give my the following: null >>> >>> I set the JourneyContainer-Prop in another class: >>> >>> >> qx.Class.define("travelagent.impl.fe.travelplaner.TravelplanerContainer", { >>> extend : qx.ui.container.Scroll, >>> construct : function() { >>> this.base(arguments); >>> this.set({ >>> width : 1024, >>> height : 400 >>> }); >>> >>> var layout = new qx.ui.layout.VBox().set({ >>> spacing : 5 >>> // alignX: "center" >>> }); >>> >>> this.__journeyContainer = new >>> qx.ui.container.Composite(layout).set({ >>> padding : 20, >>> width : 1008, >>> backgroundColor : "white" >>> }); >>> >>> this.__journeyContainer.setAllowStretchX(false); >>> this.add(this.__journeyContainer); >>> >>> this.__journeyContainer.add(new >>> qx.ui.basic.Label("Travelplan")); >>> >>> // init dummywidgets >>> var start = new travelagent.impl.data.DestinationData(); >>> start.setType("StartWidget"); >>> var goal = new travelagent.impl.data.DestinationData(); >>> goal.setType("GoalWidget"); >>> var waypoint = new travelagent.impl.data.DestinationData(); >>> waypoint.setType("WaypointWidget"); >>> var waypoint2 = new travelagent.impl.data.DestinationData(); >>> waypoint2.setType("WaypointWidget"); >>> var waypoint3 = new travelagent.impl.data.DestinationData(); >>> waypoint3.setType("WaypointWidget"); >>> >>> goal.setPrev(waypoint); >>> waypoint.setPrev(start); >>> waypoint2.setPrev(waypoint); >>> waypoint3.setPrev(waypoint2); >>> ... >>> this.addWidget(start); >>> >>> >>> >>> }, >>> >>> members : { >>> // ref to component >>> __journeyContainer : null, >>> __startWidget : null, >>> __goalWidget : null, >>> >>> /** >>> * Adds a widget to the travel plan. Therefore the type of the >>> given >>> * data object is checked. >>> * >>> * @param componentData >>> * {IComponentData} The data object of the widget to >>> add. >>> */ >>> addWidget : function(componentData) { >>> switch (componentData.getType()) { >>> case "StartWidget" : >>> this.__startWidget = new >> travelagent.impl.fe.travelplaner.uis.StartWidget(componentData); >>> >>> this.__startWidget.setJourneyContainer("test0rn"); >>> >>> this.__journeyContainer.add(this.__startWidget); >>> ... >>> >>> I hope this helps, >>> Thanks >>> >>> >>> >>> -------- Original-Nachricht -------- >>>> Datum: Wed, 03 Jun 2009 16:10:02 +0100 >>>> Von: Matthew Gregory <[email protected]> >>>> An: [email protected] >>>> Betreff: Re: [qooxdoo-devel] Property usage >>>>> now i have a new problem with my property. >>>>> Another class set the journeyContainer: >>>>> >>>>> this.__startWidget.setJourneyContainer(this) >>>>> >>>>> when i call the getter in the startWidget, i get a null value. why? i >>>> thought that the property is inherit from AbstractMediator to >> StartWidget. >>>> That should work, any chance of a bit more code? Would be good if you >>>> could post the code that creates the class, sets the property and then >>>> where the property is being read >>>> >>>>> My second problem concerns the init-process. >>>>> >>>>> i have tried the following: >>>>> >>>>> properties: { >>>>> newTest:{nullable:true} //i guess this is the same like newTest = >> null; >>>>> } >>>>> >>>>> now i want to init the property in my constructor like: >>>>> >>>>> this.initNewTest("hello"); >>>>> >>>>> Firebug says that the function ist undefined. how can i init my >>>> properties? >>>> >>>> (not 100% sure about the accuracy of this statement) Nullable >> properties >>>> are initialized to null by default, use setTest() instead. Or you could >>>> add an init value to the property >>>> >>>> > newTest:{nullable:true, init:"hello"} >>>> >>>> This only works well for "simple" types though, arrays and objects are >>>> initialized by reference and not value >>>> >>>> >>>> >>>> >>>> >> ------------------------------------------------------------------------------ >>>> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >>>> looking to deploy the next generation of Solaris that includes the >> latest >>>> innovations from Sun and the OpenSource community. Download a copy and >>>> enjoy capabilities such as Networking, Storage and Virtualization. >>>> Go to: http://p.sf.net/sfu/opensolaris-get >>>> _______________________________________________ >>>> qooxdoo-devel mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >> >> ------------------------------------------------------------------------------ >> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >> looking to deploy the next generation of Solaris that includes the latest >> innovations from Sun and the OpenSource community. Download a copy and >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to: http://p.sf.net/sfu/opensolaris-get >> _______________________________________________ >> qooxdoo-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >
------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
