Announcement

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

    MenuItem.setEnabled(Boolean.FALSE) quesiton

    SmartClient Version: v9.1p_2014-05-07/PowerEdition Deployment (built 2014-05-07)
    GWT 2.6.0
    IE-11

    Code:
    MenuItemIfFunction disableIfNotOwner = new MenuItemIfFunction() {
                @Override
                public boolean execute(Canvas target, Menu menu, MenuItem item) {
                    if(model.getView().getCreateByUserId() != user.getId())
                        return false;
                    else return true;
                }
            };
    MenuItem saveView = new MenuItem("Save");
            saveView.setIcon("menu/save.png");
            saveView.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
    
                public void onClick(MenuItemClickEvent event) {
                    viewMediator.saveView();
                }
            });
            saveView.setEnableIfCondition(disableIfNotOwner);
    I have a MenuItem where I set a conditional enable function.
    When the condition is true, the MenuItem works. When the condition is false, the MenuItem is not selectable, however the text for the MenuItem still remains the same as if it were enabled.
    Shouldn't the title to the MenuItem be greyed out?

    Is there another call I'm not aware of that greys out the MenuItem text?
    Last edited by Isomorphic; 26 Jun 2014, 13:33. Reason: Formatted code block

    #2
    Hello,

    Behind the scenes Smartclient adds a CSS class called "menuTitleFieldDisabled" to the disabled menu item that will control the look and feel of the text.

    Can you confirm that you have no custom CSS in place that interferes with this class?
    Can you also confirm what skin you are using?

    Regards,
    Isomorphic Software

    Comment


      #3
      We have no occurrence of 'menuTitleFieldDisabled' in our CSS. But we are using a custom skin. When I examine that MenuItem's text in the IE-11 dev console for Styles, this is the custom CSS in our skin that is getting applied:

      Code:
      .menu,
      .menuSelected,
      .menuOver,
      .menuSelectedOver,
      .menuDisabled,
      .treeMenuSelected,
      .treeMenuSelectedOver {
          font-family:Arial,Bitstream Vera Sans,sans-serif;
          letter-spacing: .02em;
          font-size:11px;
          color:#333333;
          padding-top:2px; padding-bottom:2px;
      }
      This was working in our previous version when we were on SmartGWT 2.x and GWT 1.7.x and since we upgraded to SmartGWT 4.1 and GWT 2.6.0 it seems to have broke.
      Last edited by JLivermore; 27 Jun 2014, 07:08.

      Comment


        #4
        We have confirmed that the disabled styling is working as expected with the standard skins, so there must be something going on with your custom skin which is causing the problem.

        Without seeing the problem in action we can't comment on what's going wrong. Can you upload your custom skin load_skin.js file and skin_styles.css and show us some code we can run to reproduce the problem? This should be just a trivially simple EntryPoint class which basically defines and draws a Menu with disabled item(s) which demonstrates the problem.

        Thanks
        Isomorphic Software

        Comment


          #5
          To follow up on this with a note on maintaining skins across SmartGWT version upgrades:
          Our recommendation (as stated in the Quick Start Guide), is that when creating a customized skin, developers you should keep skinning customizations localized to the end of skin_styles.css / load_skin.js or in a separate file.
          This means on a major version upgrade (where the underlying framework skin changes), you can easily re-apply the same changes to the updated framework skin.

          This is generally a better approach than simply copying your older custom skin file to the new build unaltered - because updated skins can contain new settings that bring large performance enhancements, so it's best to avoid cases where developers are trying to maintain a heavily customized skin from 2-3 versions back.

          Having said that, SmartGWT maintains backward compatibility wherever possible and if an existing customized skin is broken when you perform a version upgrade we will help troubleshoot the issue(s) you are seeing, but, as with any reports of issues with SmartGWT, we'll need a way to reproduce the problem and see what's going on.

          Regards
          Isomorphic Software

          Comment

          Working...
          X