Announcement Announcement Module
Collapse
No announcement yet.
Large Icons for ToolBar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Large Icons for ToolBar

    How do I configure commands to they use large icons for ToolBar and small (16x16) for menus. Also how do I add differenet views to Toolbar as Toggle Buttons. Similar to Show Window menu but Toggle buttons on Toolbar?

    Amad

  • #2
    Amad,

    You want a custom CommandButtonConfigurer applied to toolbar buttons. See DefaultCommandServices for how they are applied: you will want to set the button's icon to the large variant in the configure method.

    Currently there are no setter methods for changing the configurers but I can add those.

    I am also considering adding support for multiple face descriptors per command, but I have to think about that from a configuration standpoint (don't want to introduce complexity in command configuration if possible)

    Comment


    • #3
      Keith

      Thanks, I have looked DefaultButtonConfigurer and tried to implement it. But I guess I am not sure how to set the large icon on button as I don't know what command key was used? What I really want to do is able to specify icons in images.properties like

      deleteCommand.icon.small=delete-16x16.png
      deleteCommand.icon.large=delete-32x32.png

      or something similiar and then from face descriptor i can just get small or large icons and set them in configure.

      Here is what i have, which is very simple and don't know how do just set all the icons to large icons, I don't think i have enough information in this method?

      Code:
      public class ToolBarButtonConfigurer extends DefaultButtonConfigurer {
          public void configure(CommandFaceDescriptor face, AbstractButton button) {
              super.configure(face, button);
          }
      Regards,

      Amad

      Comment


      • #4
        Hmm... yea, I see what you mean. I'll see what I can do here: the simplest addition would be to enhance the CommandFaceDescriptor class: specifically, add a "large" command button icon info property, in addition to the existing buttonIconInfo property.

        I think it will also be beneficial to provide multiple face descriptors per command, to support different visual configurations for the same command.

        Comment


        • #5
          Amad,

          I just checked in initial support for: large icons (see CommandFaceDescriptor), as well as multiple face descriptors per command, as mentioned.

          See the ApplicationObjectConfigurer for how large icon support is configured--it's very similiar to what you described above.

          I have not yet hooked up the application object configurer for adding in configured face descriptors from a properties file.

          Keith

          Comment


          • #6
            Thanks Keith.. You'r the man!

            Comment


            • #7
              I prefer user large icons in toolbar, that's the way I did:
              Code:
              /**
               * Custom <code>CommandButtonConfigurer</code> for buttons on the toolbar.
               * <p>
               * Allows using large icons for toolbar.
               */
              public class BbToolBarCommandButtonConfigurer extends ToolBarCommandButtonConfigurer {
              
                  /**
                   * Indicates if large icons should be used.
                   */
                  private Boolean useLargeIcons;
              
                  /**
                   * Creates this command button configurer.
                   */
                  public BbToolBarCommandButtonConfigurer() {
              
              	super();
                  }
              
                  /**
                   * {@inheritDoc}
                   */
                  public void configure(AbstractButton button, AbstractCommand command, CommandFaceDescriptor faceDescriptor) {
              
              	super.configure(button, command, faceDescriptor);
              	faceDescriptor.configureIconInfo(button, this.getUseLargeIcons());
                  }
              
                  /**
                   * Gets the useLargeIcons.
                   * 
                   * @return the useLargeIcons
                   */
                  public Boolean getUseLargeIcons() {
              
              	if (this.useLargeIcons == null) {
              	    this.setUseLargeIcons(Boolean.TRUE);
              	}
              
              	return this.useLargeIcons;
                  }
              
                  /**
                   * Sets the useLargeIcons.
                   * 
                   * @param useLargeIcons
                   *            the useLargeIcons to set
                   */
                  public void setUseLargeIcons(Boolean useLargeIcons) {
              
              	Assert.notNull(useLargeIcons, "useLargeIcons");
              
              	this.useLargeIcons = useLargeIcons;
                  }
              }
              You, just need to configure it as follows:
              Code:
              <bean id="applicationServices" class="org.springframework.richclient.application.support.DefaultApplicationServices" >
                  <property name="registryEntries">
                      <map>
                         <entry key="org.springframework.richclient.command.CommandServices" value-ref="commandServices" />
                      </map>
                   </property>
              </bean>
              
              <bean id="commandServices" class="org.springframework.richclient.command.support.DefaultCommandServices" p:toolBarButtonConfigurer-ref="toolBarButtonConfigurer"/>
              
              <bean id="toolBarButtonConfigurer" class="org.bluebell.richclient.command.config.BbToolBarCommandButtonConfigurer" p:useLargeIcons="true" />
              I suggest merging my toolbar command button configurer implementation with the out of the box one.

              Comment


              • #8
                +1 on adding this to the default configurer.

                btw, do you have a way to toggle between large and small icons programmatically?
                Last edited by adamarmistead; Feb 3rd, 2010, 12:30 PM.

                Comment


                • #9
                  I'm sorry, not now.

                  Comment


                  • #10
                    Thanks for the code!

                    Comment

                    Working...
                    X