Results 1 to 6 of 6

Thread: toolbar buttons with dropdown menu

  1. #1
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default toolbar buttons with dropdown menu

    I'm looking for an implementation of a toolbar button that includes a "drop down" menu. You can find this on lots of recent UI's (like eclipse) for a toolbar action that offers a series of options (like the run command, or the previous searches, etc.).

    What I'm wondering is if anyone has created such a thing for RCP? I'd like to offer a "recent searches" toolbar button using this model.

    If anyone has any pointers, that'd be great!

    Thanks.
    Larry.

  2. #2

    Default I had thought that Jide had gotten theirs from someone else,

    but I can't find out where, at least not at the moment.

    Hmm... I know Santhosh Kumar is doing some stuff with or
    for them or something like that, so I found this link:

    http://www.jroller.com/page/santhosh...tton_for_swing

    If you look at the next several blog posts, he does some other stuff too.

  3. #3

    Default

    Hi Larry

    I am using the Jide Split Button. Of course this is not free you have to buy the Jide component suite.

    I had a few issues with integrating it into Spring. What I ended up doing was creating a JideSplitButtonCommand and overode the call to
    Code:
    createButton(String faceDescriptorId, ButtonFactory buttonFactory, CommandButtonConfigurer buttonConfigurer)
    to return an instanceof JideSplitButton. Not sure if this was the proper way to do this, but it worked.

    Trevor

  4. #4
    Join Date
    Jul 2007
    Location
    Overland Park, KS
    Posts
    10

    Default Larry, did you get this working?

    I have a similar need and would prefer to stick with open source solutions.

    Larry, did you get this drop down menu on the toolbar thing working?

    Did you use Santhosh Kumar's solution, or something else?

    If you used Santhosh's solution, how did you link it into Spring? It looks like I'd have to extend Avogadro's number of classes...

    -K

  5. #5
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    FYI, the JideSplitButton is now part of their 'Common Layer' that they've put into open source. The site for that project is https://jide-oss.dev.java.net/.

    I too use the JIDE solution, and it can be a little tricky to integrate into Spring RCP. Here's an example of one way I've done it.

    Code:
    private class StructureCommand extends ActionCommand{
    	private static final String ID = "structureCommand";
    
    	private JideSplitButton structureButton = null;
    		
    	public StructureCommand(){
    		super(ID);
    	}
    		
    	protected void doExecuteCommand() {
    	}
    		
    	public AbstractButton createButton(String arg0, ButtonFactory arg1,
    			CommandButtonConfigurer arg2) {
    		AbstractButton button = createSplitButton();
    		return button;
    	}
    		
    	// Maybe move this to a button factory implementation?
    	private JideSplitButton createSplitButton(){
    		structureButton = new JideSplitButton(getActionAdapter());
    		structureButton.setText(null);
    			
    		CommandGroup.createCommandGroup(
    	    		"structureCommandGroup", 
        			new Object[] {defaultCommand, meshRibbonCommand, ribbonsCommand, 
    	    			strandsCommand, cartoonsCommand,
    	    			rocketsCommand, traceCommand});
    			
    		ButtonGroup group = new ButtonGroup();
    			
    		JMenuItem defaultItem = new JRadioButtonMenuItem(defaultCommand.getActionAdapter());
    		defaultItem.setSelected(true);
    		group.add(defaultItem);
    		structureButton.add(defaultItem);
    			
    		JMenuItem meshRibbon = 
    				new JRadioButtonMenuItem(meshRibbonCommand.getActionAdapter());
    		group.add(meshRibbon);
    		structureButton.add(meshRibbon);
    			
    		JMenuItem ribbons = 
    			new JRadioButtonMenuItem(ribbonsCommand.getActionAdapter());
    		group.add(ribbons);
    		structureButton.add(ribbons);
    			
    		JMenuItem strand = 
    			new JRadioButtonMenuItem(strandsCommand.getActionAdapter());
    		group.add(strand);
    		structureButton.add(strand);
    			
    		JMenuItem cartoon = 
    			new JRadioButtonMenuItem(cartoonsCommand.getActionAdapter());
    		group.add(cartoon);
    		structureButton.add(cartoon);
    			
    		JMenuItem rockets = 
    			new JRadioButtonMenuItem(rocketsCommand.getActionAdapter());
    		group.add(rockets);
    		structureButton.add(rockets);
    			
    		JMenuItem trace = 
    			new JRadioButtonMenuItem(traceCommand.getActionAdapter());
    		group.add(trace);
    		structureButton.add(trace);
    			
    		return structureButton;
    	}
    }
    hope this helps,

    Jonny

  6. #6
    Join Date
    Jul 2007
    Location
    Overland Park, KS
    Posts
    10

    Default

    Thanks, I'll try the JIDE common layer. -K

Similar Threads

  1. Large Icons for ToolBar
    By afida in forum Swing
    Replies: 8
    Last Post: Feb 4th, 2010, 02:23 AM
  2. ShowViewMenu and toolbar buttons
    By lstreepy in forum Swing
    Replies: 6
    Last Post: Oct 9th, 2008, 09:55 AM
  3. Mnemonic set on toolbar buttons
    By tdunn in forum Swing
    Replies: 0
    Last Post: Oct 5th, 2005, 01:39 PM
  4. Dropdown list & custom types
    By davidkennedy in forum Web
    Replies: 1
    Last Post: Jul 27th, 2005, 07:09 PM
  5. Replies: 1
    Last Post: Feb 15th, 2005, 01:05 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
  •