Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Where do I find the properties of a widget?

    I'm trying to set the default properties of the Dialog class but I can't find the correct names of the available properties which I would like to change.

    Eg I would like to change the text of the different buttons but using something like
    Code:
    Dialog d = new Dialog();
    d.setProperty("YES_BUTTON_TITLE", Resources.getText("sguiedOptionYes"));
    d.setProperty("NO_BUTTON_TITLE", Resources.getText("sguiedOptionNo"));
    d.setProperty("CANCEL_BUTTON_TITLE", Resources.getText("sguiedOptionCancel"));
    d.setProperty("OK_BUTTON_TITLE", Resources.getText("sguiedButnOk"));
    Dialog.setDefaultProperties(d);
    but this throws a JavaScriptException:
    Code:
    00:28:38,704 [ERROR] Uncaught exception escaped
    com.google.gwt.core.client.JavaScriptException: (TypeError): widget is null
      fileName: http://127.0.0.1:8888
      lineNumber: 141
      stack: ("YES_BUTTON_TITLE","Yes")@http://127.0.0.1:8888:141
    @:0
    ([object GWTJavaObject],16384002,[object XMLHttpRequest])@http://127.0.0.1:8888/portal/hosted.html?portal:56
    ([object Event])@http://127.0.0.1:8888:34
    ((function () {__gwt_makeJavaInvoke(1)(handler, 16384002, _this);}),[object XMLHttpRequest],[object Object])@http://127.0.0.1:8888:41
    @:0
    (null,65642,(function () {__gwt_makeJavaInvoke(1)(handler, 16384002, _this);}),[object XMLHttpRequest],[object Object])@http://127.0.0.1:8888/portal/hosted.html?portal:56
    ([object Event])@http://127.0.0.1:8888:54
    
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
     	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129)
             :

    So, how do I get a list of/where do I find the correct property names which I can set/change?

    I'm using GWT 2.2.0, SmartGWT 2.4, NetBeans 6.9.1, GWT4NB 2.10

    Thomas

    PS: no, using the i18n locale stuff is not an option for my app to change the button texts!

    #2
    anybody?
    Please?

    Comment


      #3
      You're not really supposed to poke at classes that way.

      However, you can get a list of the properties by looking at the XXX.ds.xml files that define each smartclient component.

      Dialog.ds.xml just points to Window.ds.xml, so here are the properties:

      Code:
      <DataSource	ID="Window" inheritsFrom="Canvas" Constructor="Window">
      	<fields>
              <!-- Window as a whole -->
      		<field name="autoCenter" type="boolean" basic="true"/>
      		<field name="isModal" type="boolean" basic="true"/>
      		<field name="dismissOnOutsideClick" type="boolean"/>
      		<field name="dismissOnEscape" type="boolean"/>
      
      		<field name="visibility" type="visibilityEnum" basic="true"/>	
      
              <!-- prevent generic Layout properties from showing up as basics -->
      		<field name="layoutMargin"	type="positiveInteger" basic="false"/>
              <field name="align" type="anyAlignEnum" basic="false"/>
              <field name="defaultLayoutAlign" type="anyAlignEnum" basic="false"/>	
      		<field name="membersMargin"	type="positiveInteger" basic="false"/>
      
      
              <!-- contents -->
      		<field name="autoSize" type="boolean" basic="true"/>
      		<field name="src" type="URL"/>
              <field name="contentsType" type="string"/>
      		<field name="contentLayout"	type="enum">
      			<valueMap>
      				<value>vertical</value>
      				<value>horizontal</value>
      				<value>none</value>
      			</valueMap>
      		</field>
      
      
              <!-- header -->
      		<field name="showHeader" type="boolean"/>
      		<field name="canFocusInHeaderButtons" type="boolean"/>
      		<field name="headerConstructor" type="className"/>
      		<field name="headerStyle" type="cssClass"/>
      		<field name="hiliteHeaderStyle" type="cssClass"/>
              <field name="showHeaderBackground" type="boolean"/>
      		<field name="headerSrc" type="URL" />
      		<field name="hiliteHeaderSrc" type="URL" />
      		<field name="headerDefaults" type="Canvas" propertiesOnly="true"/>
              <field name="headerControls" type="string" multiple="true"/>
      
                 <!-- title (a label in the header with the Window's title) -->
      		   <field name="showTitle" type="boolean"/>
      		   <field name="title" type="HTML"/>
                 <field name="headerLabelConstructor" type="className" visibility="internal"/>
      		   <field name="headerLabelTextStyle" type="cssClass"/>
      		   <field name="headerLabelInnerTextStyle" type="cssClass"/>
                 <field name="headerLabelDefaults" type="Canvas" propertiesOnly="true"/>
      
                 <!-- headerIcon (icon, typically on left of headerBar, with various windows controls) -->
      		   <field name="showHeaderIcon" type="boolean"/>
                 <field name="headerIconConstructor" type="className" visibility="internal"/>
                 <field name="headerIconDefaults" type="Canvas" propertiesOnly="true"/>
               
                 <!-- close button --> 
      		   <field name="showCloseButton" type="boolean" basic="true"/>
      		   <field name="closeButtonConstructor" type="className" visibility="internal"/>
      		   <field name="closeButtonDefaults" type="Canvas" propertiesOnly="true"/>
      
                 <!-- minimize button --> 
      		   <field name="showMinimizeButton" type="boolean"/>
      		   <field name="minimizeButtonConstructor" type="className" visibility="internal"/>
      		   <field name="minimizeButtonDefaults" type="Canvas" propertiesOnly="true"/>
      		   <field name="minimized" type="boolean"/>
         		   <field name="maximized" type="boolean"/>
      		   <field name="defaultMinimizeHeight" type="positiveInteger"/>
      		   <field name="animateMinimize" type="boolean"/>
      		   <field name="minimizeTime" type="positiveInteger"/>
                 <field name="minimizeHeight" type="number"/>
                 
                 <!-- animation -->
                 <field name="animateMinimize" type="boolean"/>
                 <field name="minimizeAcceleration" type="string"/>
                 <field name="minimizeTime"   type="int"/>
      
                 <!-- restore button -->
      		   <field name="restoreButtonDefaults" type="Canvas" propertiesOnly="true"/>
      
                 <!-- maximize button --> 
      		   <field name="showMaximizeButton" type="boolean"/>
      		   <field name="maximizeButtonConstructor" type="className" visibility="internal"/>
      		   <field name="maximizeButtonDefaults" type="Canvas" propertiesOnly="true"/>
      
              <!-- footer -->
      		<field name="showFooter" type="boolean"/>
      		<field name="footerHeight" type="positiveInteger"/>
                 
              <!-- status bar --> 
      		<field name="showStatusBar" type="boolean"/>
      		<field name="statusBarConstructor" type="className" visibility="internal"/>
      		<field name="statusBarStyle" type="cssClass"/>
      		<field name="statusBarDefaults" type="Canvas" propertiesOnly="true" visibility="internal"/>
                 
              <!-- corner resizer --> 
      		<field name="showResizer" type="boolean"/>
      		<field name="resizerConstructor" type="className" visibility="internal"/>
      		<field name="resizerDefaults" type="Canvas" propertiesOnly="true"/>
                 
              <!-- toolbar (shown inside body) -->
      		<field name="showToolbar" type="boolean" visibility="internal"/>
      		<field name="toolbarButtons" type="Canvas" multiple="true" propertiesOnly="true" visibility="internal"/>
      		<field name="toolbarConstructor" type="className" visibility="internal"/>
      		<field name="toolbarDefaults" type="Canvas" propertiesOnly="true" visibility="internal"/>
               
              <!-- body -->
      		<field name="showBody" type="boolean"/>
      		<field name="bodyStyle" type="cssClass"/>
      		<field name="bodyColor" type="color"/>
      		<field name="hiliteBodyColor" type="color"/>
      		<field name="bodyConstructor" type="string"/>
      		<field name="bodyDefaults" type="Layout" propertiesOnly="true"/>
      
              <!-- Leave this field at the end of the list for Visual ISC D&D -->
      		<field name="items" type="Canvas" multiple="true"/>
              
              <field name="showModalMask" type="boolean"/>
              <field name="modalMaskOpacity" type="number"/>
              
          </fields>
      </DataSource>

      Comment


        #4
        thanx, atomatom, for your reply.

        Originally posted by atomatom
        You're not really supposed to poke at classes that way.
        but what is the correct/proper way of doing what I need to do?
        Dialog explicitly defines the method setDefaultProperties() which takes as a parameter another Dialog. So, how is the supposed to work?

        All the examples/postings/code snippets/docs I found regarding properties where related to pure javascript rather than using SmartGWT code.

        Comment


          #5
          most of the methods have a java api call.

          the setDefault is kind of confusing. it's so you can define a component as a 'template' and then use it to set properties of other components. for example, this is used in the listgrid when you setPickListProperties(ListGrid) - since you don't have access to the actual picklist used at that time. mildly confusing, but sort of makes sense.

          Comment


            #6
            Originally posted by atomatom
            most of the methods have a java api call.

            the setDefault is kind of confusing. it's so you can define a component as a 'template' and then use it to set properties of other components. for example, this is used in the listgrid when you setPickListProperties(ListGrid) - since you don't have access to the actual picklist used at that time. mildly confusing, but sort of makes sense.
            it is confusing, indeed. But your example details exactly what I want/need to do: I want to change properties (the button texts) of all Dialogs. At the time of setting them I don't have access to all possible dialogs, that my app will show.

            So, here is my (initial) question: how do I go about creating a dialog template with my own button text?

            Comment


              #7
              Originally posted by atomatom
              However, you can get a list of the properties by looking at the XXX.ds.xml files that define each smartclient component.

              Dialog.ds.xml just points to Window.ds.xml, so here are the properties:
              where do I find these files? I checked smartgwt.jar but couldn't a Dialog.ds.xml nor a Windows.ds.xml...

              Comment


                #8
                I found those in the sc folder of gwt generated project. If you're using eclipse just search for the resource by name.

                Comment


                  #9
                  Originally posted by atomatom
                  I found those in the sc folder of gwt generated project. If you're using eclipse just search for the resource by name.
                  thanx, atomatom, for the suggestion. Alas, I can't find it in my build, dist or anywhere.
                  The only place I found something is in the smartclientSDK of SmartClient_70rc2_Evaluation. But even there in Window.ds.xml I can't find anything to 'globally' change the texts for my dialog buttons via properties.

                  Any other ideas/suggestions are greatly appreaciated...

                  Thomas

                  Comment


                    #10
                    You could try extending one of the classes and using that. I don't know how you globally change the properties of the existing components without changing the source code.

                    For example, create a MyWindow extends Window, then do all the customization in the constructor.

                    Are you trying to customize the Calendar? My suggestion would be drop the Calendar widget. It is really not very good and has some terrible limitations.

                    Comment


                      #11
                      I'm trying to customize the button texts of Dialog...

                      Comment


                        #12
                        If this is for localization, there are locales files shipped as .properties files for lots of different locales. Your locale may already be covered, if not, you can create and contribute one - see this thread.

                        @atomatom telling users to avoid the Calendar widget unilaterally is very poor advice which is damaging to many users. Every widget necessarily has limitations and you may have encountered a limitation that affects your application, but many, many users have successfully used the Calendar.

                        Comment


                          #13
                          To substantiate my warning: the Calendar does not support events that cross the midnight boundary and that should be highlighted in big flashing letters but it is not. That is the worst bit and I wasted a lot of time with the Calendar before I hit that limitation. It is also quite difficult to customize (sure, not impossible) since it appears to be a rather large and complex SmartClient component.

                          If someone was harmed by my opinion, I apologize. It might suit you just fine if you have events that are all contained within a normal workday (ie 9am-5pm).

                          Comment


                            #14
                            Warning people that the calendar doesn't support events that specifically span midnight and show up on the next day is fine.

                            As to "big flashing letters", sorry, your perception that this is very important isn't really accurate. We get more requests for recurring events, built-in load on demand, etc.

                            Comment


                              #15
                              Originally posted by Isomorphic
                              If this is for localization, there are locales files shipped as .properties files for lots of different locales. Your locale may already be covered, if not, you can create and contribute one - see this thread.
                              yes, it is for localization,but as I mentioned in my OP I can't use the build-in localization/i8n,etc. I get my localized texts from the backend where the user is free to configure each and every text that appears on the screen.

                              So, I get the texts for the dialog buttons and all I want/need to do is to set these texts in a 'template' dialog or, as the method suggests, in the defaultProperties of dialog.

                              Now, how can I achieve this?
                              How I am supposed to use this method?

                              Thanx,

                              Thomas

                              Comment

                              Working...
                              X