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
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
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
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?
Regards,Code:public class ToolBarButtonConfigurer extends DefaultButtonConfigurer { public void configure(CommandFaceDescriptor face, AbstractButton button) { super.configure(face, button); }
Amad
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
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
Thanks Keith.. You'r the man!
I prefer user large icons in toolbar, that's the way I did:
You, just need to configure it as follows: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; } }
I suggest merging my toolbar command button configurer implementation with the out of the box one.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" />
+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.
I'm sorry, not now.