Results 1 to 9 of 9

Thread: Large Icons for ToolBar

  1. #1
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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)
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default

    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

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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.
    Keith Donald
    Core Spring Development Team

  5. #5
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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
    Keith Donald
    Core Spring Development Team

  6. #6
    Join Date
    Aug 2004
    Location
    Northridge, CA
    Posts
    151

    Default

    Thanks Keith.. You'r the man!

  7. #7

    Default

    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.

  8. #8
    Join Date
    Mar 2009
    Location
    Oregon
    Posts
    116

    Default

    +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 at 11:30 AM.

  9. #9

    Default

    I'm sorry, not now.

Similar Threads

  1. Replies: 10
    Last Post: Apr 21st, 2011, 06:11 PM
  2. Saving large files to a db using hibernate?
    By Dan Washusen in forum Data
    Replies: 10
    Last Post: Sep 20th, 2006, 12:18 PM
  3. Managing large Spring XML config files
    By roshang in forum Architecture
    Replies: 7
    Last Post: Oct 12th, 2005, 10:16 AM
  4. dealing with large resultsets
    By heymjo in forum Data
    Replies: 3
    Last Post: Jul 3rd, 2005, 03:22 PM
  5. ApplicationContexts and Subsystems in Large App
    By steve_smith in forum Container
    Replies: 6
    Last Post: Nov 19th, 2004, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •