Announcement

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

    SC.showPrompt()- Title is missing

    Hi Isomorphic,

    in this case, first parameter is title
    Code:
    SC.showPrompt("Title is missing", "Message");
    but title is never applied. (v12.0p_2019-10-16/PowerEdition Deployment (built 2019-10-16))

    Click image for larger version  Name:	Prompt.PNG Views:	0 Size:	2.7 KB ID:	259699

    Test case:

    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS extends VLayout implements EntryPoint {
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            setWidth100();
            setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    SC.showPrompt("Title is missing", "Message");
                }
            });
            addMember(recreateBtn);
            draw();
        }
    }
    Result:

    Click image for larger version  Name:	Title is missing.PNG Views:	0 Size:	914 Bytes ID:	259700

    Best regards
    Pavo

    #2
    This should be fixed back to SGWT 6.1p/SC 11.1p as of the nightly builds dated 2019-10-19.

    Comment


      #3
      Hi Isomorphic,

      this problem I reported has beed fixed, but that fix is causing a new bug.

      How to see bug:
      1. Click on "Recreate Window with title".
      2. Click on "Recreate Window without title".

      "Recreate Window without title" should not have a title, but it has a title from "Recreate Window with title"!

      Code:
      package com.smartgwt.sample.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.core.KeyIdentifier;
      import com.smartgwt.client.event.SmartGwtTimer;
      import com.smartgwt.client.util.Page;
      import com.smartgwt.client.util.PageKeyHandler;
      import com.smartgwt.client.util.SC;
      import com.smartgwt.client.widgets.IButton;
      import com.smartgwt.client.widgets.events.ClickEvent;
      import com.smartgwt.client.widgets.events.ClickHandler;
      import com.smartgwt.client.widgets.layout.VLayout;
      
      public class BuiltInDS extends VLayout implements EntryPoint {
          private IButton recreateBtn1;
          private IButton recreateBtn2;
      
          public void onModuleLoad() {
              KeyIdentifier debugKey = new KeyIdentifier();
              debugKey.setCtrlKey(true);
              debugKey.setKeyName("D");
      
              Page.registerKey(debugKey, new PageKeyHandler() {
                  public void execute(String keyName) {
                      SC.showConsole();
                  }
              });
      
              setWidth100();
              setHeight100();
      
              recreateBtn1 = new IButton("Recreate Window with title");
              recreateBtn1.setWidth(250);
              recreateBtn1.addClickHandler(new ClickHandler() {
                  @Override
                  public void onClick(ClickEvent event) {
                      SC.showPrompt("Title", "Recreate window with title message");
                      SmartGwtTimer timer = new SmartGwtTimer() {
                          @Override
                          public void run() {
                              SC.clearPrompt();
                          }
                      };
                      timer.schedule(2000);
                  }
              });
              addMember(recreateBtn1);
      
              recreateBtn2 = new IButton("Recreate Window without title");
              recreateBtn2.setWidth(250);
              recreateBtn2.addClickHandler(new ClickHandler() {
                  @Override
                  public void onClick(ClickEvent event) {
                      SC.showPrompt("Recreate window without title message");
                      SmartGwtTimer timer = new SmartGwtTimer() {
                          @Override
                          public void run() {
                              SC.clearPrompt();
                          }
                      };
                      timer.schedule(2000);
                  }
              });
              addMember(recreateBtn2);
      
              draw();
          }
      }
      Best regards
      Pavo

      Comment


        #4
        That was actually the existing behavior for showPrompt(), not something introduced by the fix. If you had, in the past, configured your skin file to show the title for prompt dialogs, you would've noticed that the last explicitly passed title persisted across all calls to showPrompt() that didn't take a title.

        However, we've modified showPrompt() to hide the title now if none is explicitly passed, as you requested. This will be in the nightly builds for SGWT 6.1p/SC 11.1p and newer branches, dated 2019-10-23 and beyond.

        Comment


          #5
          Hi Isomorphic,

          I have a new problem in this area: "showPrompt()" is never applied (line of the code 130 in my test case).
          Version: SmartClient Version: v12.0p_2019-11-13/PowerEdition Deployment (built 2019-11-13)

          Code:
          package com.smartgwt.sample.client;
          
          import com.google.gwt.core.client.EntryPoint;
          import com.smartgwt.client.Version;
          import com.smartgwt.client.core.KeyIdentifier;
          import com.smartgwt.client.data.DSRequest;
          import com.smartgwt.client.data.ResultSet;
          import com.smartgwt.client.data.events.DataArrivedEvent;
          import com.smartgwt.client.data.events.DataArrivedHandler;
          import com.smartgwt.client.rpc.RPCCallback;
          import com.smartgwt.client.rpc.RPCRequest;
          import com.smartgwt.client.rpc.RPCResponse;
          import com.smartgwt.client.types.ExportFormat;
          import com.smartgwt.client.util.Page;
          import com.smartgwt.client.util.PageKeyHandler;
          import com.smartgwt.client.util.SC;
          import com.smartgwt.client.widgets.Button;
          import com.smartgwt.client.widgets.IButton;
          import com.smartgwt.client.widgets.Window;
          import com.smartgwt.client.widgets.events.ClickEvent;
          import com.smartgwt.client.widgets.events.ClickHandler;
          import com.smartgwt.client.widgets.grid.ListGrid;
          import com.smartgwt.client.widgets.grid.ListGridField;
          import com.smartgwt.client.widgets.layout.VLayout;
          
          public class BuiltInDS extends VLayout implements EntryPoint {
              private IButton recreateBtn;
          
              public void onModuleLoad() {
                  KeyIdentifier debugKey = new KeyIdentifier();
                  debugKey.setCtrlKey(true);
                  debugKey.setKeyName("D");
          
                  Page.registerKey(debugKey, new PageKeyHandler() {
                      public void execute(String keyName) {
                          SC.showConsole();
                      }
                  });
          
                  setWidth100();
                  setHeight100();
          
                  recreateBtn = new IButton("Recreate");
                  recreateBtn.addClickHandler(new ClickHandler() {
                      @Override
                      public void onClick(ClickEvent event) {
                          new MyWindow().show();
                      }
                  });
                  addMember(recreateBtn);
                  new MyWindow().show();
                  draw();
              }
          
              private class MyWindow extends Window {
                  public MyWindow() {
                      setWidth(600);
                      setHeight(300);
                      setMembersMargin(0);
                      setModalMaskOpacity(70);
                      setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                      setTitle("img- vs object-tag issue" + getTitle());
                      setShowMinimizeButton(false);
                      setIsModal(true);
                      setShowModalMask(true);
                      centerInPage();
          
                      final ListGrid lg = new ListGrid();
                      lg.setDataSource("animals");
          
                      ListGridField diet = new ListGridField("diet");
                      ListGridField information = new ListGridField("information");
          
                      lg.setFields(diet, information);
          
                      lg.fetchData();
          
                      Button exportButton = new ExportButton(lg);
          
                      addItem(lg);
                      addItem(exportButton);
                  }
              }
          
              private class ExportButton extends Button {
                  public ExportButton(final ListGrid lg) {
                      super("Export");
                      addClickHandler(new ClickHandler() {
          
                          @Override
                          public void onClick(ClickEvent event) {
                              final ListGrid workLG = lg;
          
                              if (workLG != null && (
                              // If grouped
                              (workLG.isGrouped() && workLG.getOriginalResultSet() != null && workLG.getOriginalResultSet().lengthIsKnown())
                                      // If ungrouped
                                      || (!workLG.isGrouped() && workLG.getResultSet() != null && workLG.getResultSet().lengthIsKnown()))) {
                                  ResultSet workRS = workLG.isGrouped() ? workLG.getOriginalResultSet() : workLG.getResultSet();
          
                                  final long totalRows = workRS.getLength();
                                  final long loadedRows = workRS.getAllCachedRows().getLength();
          
                                  if (totalRows != loadedRows) {
                                      workRS.addDataArrivedHandler(new DataArrivedHandler() {
                                          @Override
                                          public void onDataArrived(DataArrivedEvent event) {
                                              // Most likely not needed but to make sure that this will be executed only in this case
                                              if (totalRows != loadedRows)
                                                  exportClientData(workLG);
                                          }
                                      });
                                      workRS.getRange(0, workRS.getLength());
                                  } else {
                                      exportClientData(workLG);
                                  }
                              }
                          }
                      });
                  }
              }
          
              private void exportClientData(ListGrid exportListGrid) {
                  final DSRequest exportRequest = new DSRequest() {
                      {
                          setExportAs(ExportFormat.OOXML);
                      }
                  };
          
                  SC.showPrompt("Never applied", "Test");
                  exportListGrid.exportClientData(exportRequest, new RPCCallback() {
                      @Override
                      public void execute(RPCResponse response, Object rawData, RPCRequest request) {
                          SC.clearPrompt();
                      }
                  });
              }
          }
          Best regards
          Pavo

          Comment


            #6
            It's not clear what you're reporting here - that you see a prompt, but no title is visible? If so, that's the design in some skins but not others, to have a simpler prompt.

            Comment


              #7
              Hi Isomorphic,

              I don't see a prompt at all, it never appear. Sorry, maybe I should open a new topic because last report is not related to "prompt title".

              Best regards
              Pavo

              Comment


                #8
                Hi Isomorphic,

                sorry, my fault. It doesn't appear because of small amount of records. All good here!

                Best regards
                Pavo

                Comment

                Working...
                X