Announcement

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

    Query regarding use of Component XML

    Using SmartGWT version /builds/SmartGWT/3.1p/PowerEdition/2013-02-27.

    Created a component(DynamicForm) which I want to attach with layouts created in Component XML(screen definition).

    Don’t want to do it programmatically, means retrieving the components via the getByID and the adding my component to it.

    Is there any way by which I can attach my Component(which I created in Java) directly in my Component XML(screen definition).

    Thanks,
    Deepak Singh

    #2
    Yes, if the component created in Java has an ID specified, lets say it's "theComp", you can refer to it in Component XML using <Canvas ref="theComp"/> anywhere a Canvas is expected.

    Comment


      #3
      I am having an implementation which generate ToolStrip.
      For example:-
      ESToolStrip.getTopMenu(); This method will generate ToolStrip for my Screen.

      Can I directly associate it with Section defined in my Component XML(screen definition)?
      I don’t want to it programmatically via getByID method.

      Thanks,
      Deepak Singh
      Last edited by DSingh; 2 May 2013, 09:14.

      Comment


        #4
        If it has an ID, yes, use the approach just explained.

        If it does not have an ID, there is no way for XML to refer to it, so you will need to add Java code outside of the Component XML if you want this component added to a Component XML screen.

        See also, in 4.0 builds, the ability to refer to custom Java components from Component XML.

        Comment


          #5
          Does its means that I need to call ESToolStrip.getTopMenu() separately before I load my screen(RPCManager.loadScreen("estore_template1_main" ….))?

          I think only though I will get ID of generated ToolStirp. Please correct me if I am mistaken something.

          Is there is some way by which I can call ESToolStrip.getTopMenu() from component XML.

          Thanks for your assistance.

          Thanks,
          Deepak Singh

          Comment


            #6
            To be referenced from Component XML, your component needs to have ID that is always the same. Clearly, an auto-generated ID will not work. It must have an ID that you know in advance and that can be placed in Component XML.

            Comment


              #7
              I am trying with SmartGwt build 4.0. Getting below error.

              16:21:36.617 [ERROR] [gwt] 16:21:36.619:XRP3:WARN:Log:Error when executing loaded screen: TypeError: isc.com is undefined
              Stack from error.stack:
              unnamed() @ gwt/sc/modules/ISC_Core.js:230
              [c]Class.evaluate() @ gwt/sc/modules/ISC_Core.js:217
              [c]Class.globalEvalWithCapture() @ gwt/sc/modules/ISC_Core.js:274
              [c]Class.globalEvalAndRestore() @ gwt/sc/modules/ISC_Core.js:282
              RPCManager._makeScreen() @ gwt/sc/modules/ISC_DataBinding.js:1299
              RPCManager.loadScreen/_6.callback() @ gwt/sc/modules/ISC_DataBinding.js:1297
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:321
              anonymous() @ gwt/sc/modules/ISC_DataBinding.js:1275
              $wnd.isc.RPCManager.fireReplyCallback() @ :249
              [c]RPCManager.fireReplyCallbacks() @ gwt/sc/modules/ISC_DataBinding.js:1278
              [c]RPCManager.performOperationReply() @ gwt/sc/modules/ISC_DataBinding.js:1275
              RPCManager._performTransactionReply() @ gwt/sc/modules/ISC_DataBinding.js:1269
              [c]RPCManager.performTransactionReply() @ gwt/sc/modules/ISC_DataBinding.js:1235
              anonymous() @ gwt/sc/modules/ISC_Core.js:66
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              [c]Comm.performXmlTransactionReply() @ gwt/sc/modules/ISC_Core.js:971
              anonymous() @ gwt/sc/modules/ISC_Core.js:66
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              Comm._fireXMLCallback() @ gwt/sc/modules/ISC_Core.js:953
              Comm.sendXmlHttpRequest/_12() @ gwt/sc/modules/ISC_Core.js:958
              unnamed() @
              com.smartgwt.client.core.JsObject$SGWT_WARN: 16:21:36.619:XRP3:WARN:Log:Error when executing loaded screen: TypeError: isc.com is undefined
              Stack from error.stack:
              unnamed() @ gwt/sc/modules/ISC_Core.js:230
              [c]Class.evaluate() @ gwt/sc/modules/ISC_Core.js:217
              [c]Class.globalEvalWithCapture() @ gwt/sc/modules/ISC_Core.js:274
              [c]Class.globalEvalAndRestore() @ gwt/sc/modules/ISC_Core.js:282
              RPCManager._makeScreen() @ gwt/sc/modules/ISC_DataBinding.js:1299
              RPCManager.loadScreen/_6.callback() @ gwt/sc/modules/ISC_DataBinding.js:1297
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:321
              anonymous() @ gwt/sc/modules/ISC_DataBinding.js:1275
              $wnd.isc.RPCManager.fireReplyCallback() @ :249
              [c]RPCManager.fireReplyCallbacks() @ gwt/sc/modules/ISC_DataBinding.js:1278
              [c]RPCManager.performOperationReply() @ gwt/sc/modules/ISC_DataBinding.js:1275
              RPCManager._performTransactionReply() @ gwt/sc/modules/ISC_DataBinding.js:1269
              [c]RPCManager.performTransactionReply() @ gwt/sc/modules/ISC_DataBinding.js:1235
              anonymous() @ gwt/sc/modules/ISC_Core.js:66
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              [c]Comm.performXmlTransactionReply() @ gwt/sc/modules/ISC_Core.js:971
              anonymous() @ gwt/sc/modules/ISC_Core.js:66
              [c]Class.fireCallback() @ gwt/sc/modules/ISC_Core.js:263
              Comm._fireXMLCallback() @ gwt/sc/modules/ISC_Core.js:953
              Comm.sendXmlHttpRequest/_12() @ gwt/sc/modules/ISC_Core.js:958
              unnamed() @
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
              at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
              at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
              at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
              at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
              at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
              at java.lang.Thread.run(Thread.java:662)

              Thanks,
              Deepak Singh

              Comment


                #8
                Please follow the full installation procedure and do not skip steps. Be sure to run a GWT compile and to clear your cache as well.

                Comment


                  #9
                  I again followed the full installation procedure. Run a GWT compile and clear my cache. Even though getting the same Error.

                  Kindly suggest, if I am missing anything.

                  Thanks,
                  Deepak Singh

                  Comment


                    #10
                    Please use Firebug's Net panel (or any similar tool) to capture the response coming from the server, also show the complete Component XML file, and the stack trace for the JavaScripy error *in compiled mode*.

                    Comment


                      #11
                      Firebug Net Panel Output
                      Code:
                      isc.Img.create({
                          ID:"Img0",
                          autoDraw:false,
                          imageType:"Logo",
                          src:"[SKIN]etn_logo.gif",
                          title:"Img0",
                          align:"left",
                          showHover:false,
                          showEdges:false
                      })
                      
                      
                      isc.com.archway.smartgwt.client.estore.ESToolStrip.create({
                          ID:"supplyGrid",
                          autoDraw:false,
                          autoFetchData:true,
                          height:400,
                          sortField:"category",
                          width:600,
                          xsi:"http://www.w3.org/1999/XMLSchema-instance"
                      })
                      
                      
                      
                      isc.SectionStack.create({
                          ID:"SectionStackMain",
                          autoDraw:false,
                          sections:[
                              {
                                  ID:"SectionStackSection_MainTop",
                                  title:"Welcome John Doe",
                                  autoShow:true,
                                  items:[
                                      Img0
                                  ]
                              }
                          ],
                          visibilityMode:"multiple",
                          animateSections:true
                      })
                      
                      
                      
                      isc.DataView.create({
                          ID:"DataView0",
                          autoDraw:true,
                          height:"100%",
                          overflow:"hidden",
                          width:"100%",
                          members:[
                              SectionStackMain
                          ],
                          modulesDir:"modules/"
                      })

                      Component XML
                      Code:
                      <Img ID="Img0" autoDraw="false">
                          <imageType>Logo</imageType>
                          <src>[SKIN]etn_logo.gif</src>
                          <title>Img0</title>
                          <align>left</align>
                          <showHover>false</showHover>
                          <showEdges>false</showEdges>
                      </Img>
                      
                      <ListGrid xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
                          constructor="com.archway.smartgwt.client.estore.ESToolStrip"
                          ID="supplyGrid" autoDraw="false" sortField="category"
                           autoFetchData="true" width="600" height="400">
                         
                      </ListGrid>
                      
                      
                      <SectionStack ID="SectionStackMain" autoDraw="false">
                          <sections>
                              <SectionStackSection>
                                  <ID>SectionStackSection_MainTop</ID>
                                  <title>Welcome John Doe</title>
                                  <autoShow>true</autoShow>
                                  <items><Canvas ref="Img0"/>
                                  </items>
                              </SectionStackSection>
                             
                          </sections>
                          <visibilityMode>multiple</visibilityMode>
                          <animateSections>true</animateSections>
                      </SectionStack>
                      
                      
                      <DataView ID="DataView0" width="100%" height="100%" overflow="hidden" autoDraw="true">
                          <members><Canvas ref="SectionStackMain"/>
                          </members>
                          <modulesDir>modules/</modulesDir>
                      </DataView>

                      Thanks,
                      Deepak Singh

                      Comment


                        #12
                        Please take a second look at the Component XML docs regarding use of constructor - you need to make your class Reflectable, and you haven't yet.

                        Comment


                          #13
                          Below is code from my Component XML. I want replace my SectionStackSection_MainTop SectionStackSection through programmatically.

                          But Canvas.getById is not working here.
                          How can I achieve this?

                          Code:
                          <SectionStack ID="SectionStackMain" autoDraw="false">
                              <sections>
                                  <SectionStackSection>
                                      <ID>SectionStackSection_MainTop</ID>
                                      <title>Welcome John Doe</title>
                                      <autoShow>true</autoShow>
                                      <items><Canvas ref="Img0"/>
                                      </items>
                                  </SectionStackSection>
                              </sections>
                              <visibilityMode>multiple</visibilityMode>
                              <animateSections>true</animateSections>
                          </SectionStack>
                          Thanks,
                          Deepak Singh

                          Comment


                            #14
                            I'd say you have to do

                            Code:
                            SectionStack stack = Canvas.getById("SectionStackMain");
                            stack.removeSection("SectionStackSection_MainTop");
                            stack.addSection(myNewSection);
                            Did not try it but could work.

                            Regards,
                            fatzopilot

                            Comment


                              #15
                              Thanks for your response.

                              Comment

                              Working...
                              X