Announcement

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

    Center Title in Window Header

    Hello,

    Looking for some guidance on centering the title in the Window header. I thought I could use AutoChild properties, but I cannot seem to get that to work.

    Code:
            final Window window = new Window();
            window.setTitle(title);
            Label headerLabel = new Label();
            headerLabel.setAlign(Alignment.CENTER);
            headerLabel.setLayoutAlign(Alignment.CENTER);
            window.setAutoChildProperties("headerLabel", headerLabel);
    Any help would be appreciated.

    SmartClient Version: v9.1p_2014-06-17/Pro Deployment (built 2014-06-17)

    FF ESR 24.6.0

    Thanks

    #2
    By default the "headerLabel" autoChild is only as wide as it needs to be to accomodate its text so setting align to "center" doesn't have the effect you expect.
    Try setting width to 100% on the headerLabel config block too.
    Or, alternatively you could use "headerControls" to inject "*" sized LayoutSpacers to the left and right of the header label causing it to render centered between those spacers.

    Comment


      #3
      Thank you, exactly what I needed.

      In fact, I used both of your suggestions together to provide the perfect center by accounting for the same amount of space on the left side for the amount of space the Close button takes on the right side.

      Code:
      final Window window = new Window();                                                               
      Label headerLabel = new Label();                                                                  
      headerLabel.setWidth100();                                                                        
      headerLabel.setAlign(Alignment.CENTER);                                                           
      window.setAutoChildProperties("headerLabel", headerLabel);                                        
      LayoutSpacer l = new LayoutSpacer();                                                              
      l.setWidth(15);                                                                                   
      window.setHeaderControls(l, HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

      Comment


        #4
        Hello,

        Something has regressed in the latest daily build, as my title text stopped being aligned center with the example above.
        The last working build I can confirm is "SmartClient Version: v9.1p_2014-08-31/Pro Deployment (built 2014-08-31)".

        We upgraded to "SmartClient Version: v9.1p_2014-09-10/Pro Deployment (built 2014-09-10)" today and it is no longer centered.

        Regards

        Comment


          #5
          Additionally,
          I am seeing the following warning in the development mode console which didn't appear in previous builds.

          Code:
          com.smartgwt.client.core.JsObject$SGWT_WARN: 21:09:06.653:XRP7:WARN:Log:element parentNode null
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
              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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
              at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
              at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
              at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
              at com.smartgwt.client.widgets.BaseWidget.setProperty(BaseWidget.java)
              at com.smartgwt.client.widgets.BaseWidget.setAttribute(BaseWidget.java:874)
              at com.smartgwt.client.widgets.Canvas.setWidth(Canvas.java:8621)

          Comment


            #6
            Just a quick update to let you know this is being looked at

            Regards
            Isomorphic Software

            Comment


              #7
              We've now made a change to address the centering issue - this change should be present in the next nightly build (dated Sep 17 or above).
              We haven't reproduced the problem with the stack trace by the way -- to pursue that one further we'd need to see a way to reproduce.

              Regards
              Isomorphic Software

              Comment


                #8
                Thanks for the center fix.

                You can reproduce one of the exceptions using the following code snippet.

                Code:
                FacetChart fc = new FacetChart();
                fc.setChartType(ChartType.PIE);
                fc.setShowTitle(Boolean.FALSE);
                fc.setFacets(new Facet("somefield", ""));
                fc.setValueProperty("somevalue");
                fc.setData(new RecordList());
                Window w = new Window();
                w.addItem(fc);
                w.draw();
                Code:
                com.smartgwt.client.core.JsObject$SGWT_WARN: 12:14:18.802:XRP0:WARN:Log:element parentNode null
                    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                    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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
                    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
                    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                    at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java)

                Comment


                  #9
                  Thanks for the test case. We've now made a change to address this "element parentNode is null" issue. Please try the next nightly build dated Sept 20 or above to pick up this change.

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    Originally posted by Isomorphic View Post
                    Thanks for the test case. We've now made a change to address this "element parentNode is null" issue. Please try the next nightly build dated Sept 20 or above to pick up this change.
                    Is this issue also corrected for the SectionStack? I get the following message:
                    Code:
                    11:49:22.820 [ERROR] [zedes2V010214] 11:49:22.820:MUP0:WARN:Log:element parentNode null
                    com.smartgwt.client.core.JsObject$SGWT_WARN: 11:49:22.820:MUP0:WARN:Log:element parentNode null
                        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                        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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
                        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
                        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                        at com.smartgwt.client.widgets.layout.SectionStack.collapseSection(SectionStack.java)
                        at zedes2.client.view.SchuelerFormView.maximizeDokumenteArea(SchuelerFormView.java:300)
                        at zedes2.client.presenter.manager.DokumenteManager$1.onCellDoubleClick(DokumenteManager.java:73)
                        at com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent.dispatch(CellDoubleClickEvent.java:111)
                        at com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent.dispatch(CellDoubleClickEvent.java:1)
                        at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
                        at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
                        at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
                        at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
                        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
                        at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
                        at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                        at java.lang.reflect.Method.invoke(Method.java:606)
                        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                        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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
                        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
                        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
                        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:356)
                        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                        at java.lang.reflect.Method.invoke(Method.java:606)
                        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                        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:745)
                    Which seems to be thrown when calling collapseSection(0);.
                    I haven't downloaded the new nightly yet (sept 20) , but just want to know if the issue is also corrected for the SectionStack before upgrading, since I am waiting for a bugfix of another issue.
                    Using SmartGWT Power (v9.1p_2014-09-06/PowerEdition Deployment (built 2014-09-06))

                    Comment


                      #11
                      Can't say for sure - we haven't seen a code sample that reproduces that error.

                      Comment


                        #12
                        Originally posted by Isomorphic View Post
                        Can't say for sure - we haven't seen a code sample that reproduces that error.
                        Here is a testcase:
                        Code:
                        public class TestingModule implements EntryPoint {
                        
                        	ListGrid lg = new ListGrid();
                        
                        	public void onModuleLoad() {
                        
                        		VLayout vlayout = new VLayout();
                        
                        		final SectionStack sectionStack = new SectionStack();
                        		sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
                        		sectionStack.setShowExpandControls(true);
                        		sectionStack.setAnimateSections(true);
                        		sectionStack.setTop(2);
                        
                        		SectionStackSection section1 = new SectionStackSection("Section1");
                        
                        		Label label1 = new Label("section 1");
                        		section1.addItem(label1);
                        
                        		section1.setExpanded(true);
                        		
                        		SectionStackSection section2 = new SectionStackSection("Section2");
                        
                        		Label label2 = new Label("section 2");
                        		section2.addItem(label2);
                        
                        		sectionStack.setSections(section1, section2);
                        
                        		IButton button = new IButton("Expand");
                        		button.addClickHandler(new ClickHandler() {
                        
                        			@Override
                        			public void onClick(ClickEvent event) {
                        				sectionStack.expandSection(1);
                        				sectionStack.collapseSection(0);
                        			}
                        		});
                        		vlayout.addMember(sectionStack);
                        		vlayout.addMember(button);
                        		vlayout.draw();
                        	}
                        
                        }
                        Error when loading:
                        Code:
                        15:44:30.106 [ERROR] [zedes2V010214] 15:44:30.105:MUP3:WARN:Log:element parentNode null
                        com.smartgwt.client.core.JsObject$SGWT_WARN: 15:44:30.105:MUP3:WARN:Log:element parentNode null
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                            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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
                            at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                            at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
                            at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
                            at com.smartgwt.client.widgets.layout.SectionStack.collapseSection(SectionStack.java)
                            at de.mks_infofabrik.zedes2.client.test.TestingModule$1.onClick(TestingModule.java:48)
                            at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:111)
                            at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
                            at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
                            at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
                            at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
                            at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
                            at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
                            at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            at java.lang.reflect.Method.invoke(Method.java:606)
                            at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                            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.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
                            at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
                            at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
                            at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
                            at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                            at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
                            at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:356)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                            at java.lang.reflect.Method.invoke(Method.java:606)
                            at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                            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:745)
                        Error when pushing button:
                        Code:
                        15:44:30.445 [ERROR] [zedes2V010214] 15:44:30.444:TMR9:WARN:Log:element parentNode null
                        com.smartgwt.client.core.JsObject$SGWT_WARN: 15:44:30.444:TMR9:WARN:Log:element parentNode null
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                            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:745)
                        Using Using SmartGWT Power (v9.1p_2014-09-06/PowerEdition Deployment (built 2014-09-06)).
                        Last edited by edulid; 23 Sep 2014, 05:51.

                        Comment


                          #13
                          Do you have a code sample that reproduces the problem with the latest patched build? Your build date is from before the fix we applied.

                          Comment


                            #14
                            Originally posted by Isomorphic View Post
                            Do you have a code sample that reproduces the problem with the latest patched build? Your build date is from before the fix we applied.
                            That was exactly my question:
                            Originally posted by edulid View Post
                            Is this issue also corrected for the SectionStack?
                            As I said, I am waiting for bugfixes for other bugs before I apply the latest build, .. but ok, I will test this and let you know.

                            Comment


                              #15
                              Ok, with the last patch I don't get this error.

                              Comment

                              Working...
                              X