Announcement Announcement Module
Collapse
No announcement yet.
Valkyrie best design direction to customize e.g. the default toolbar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valkyrie best design direction to customize e.g. the default toolbar

    Hello,

    I am building on top of Valkyrie master branch https://github.com/cmadsen/Valkyrie-RCP and for the GUI I am developing I would like to customize the default toolbar by adding a company logo on the right of the toolbar. I managed to implement this customization but by changing the default toolbar creation which is deeply buried within the framework. The code snippet below pretty much does what I want but this is a hack within the framework and not how it should be i.e. extending or redefining elements of the Application configuration etc.

    Note that I could try redefining the ComponentFactory but the change there would be "too early" because the buttons are not added yet.

    TIA,
    Best regards,
    Giovanni

    Line #377 of org.valkyriercp.command.support.CommandGroup.java


    Code:
    	public JComponent createToolBar(ButtonFactory buttonFactory) {
    		JComponent toolbar = getComponentFactory().createToolBar();
                    toolbar.setLayout(new BorderLayout(0, 0));
    		toolbar.setName(getText());
    		// add application logo
    		try {
    			ImageSource imageSource = applicationConfig.imageSource();
    			Image logoImage = imageSource.getImage("applicationInfo.logo");
    			ImagePanel imagePanel = new ImagePanel(logoImage);
    			toolbar.add(imagePanel, BorderLayout.EAST);
    		}
    		catch (NoSuchImageResourceException exception) {
    			exception.printStackTrace();
    		}
    
    		JPanel buttomPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    		bindMembers(buttomPanel, buttomPanel, buttonFactory, getToolBarButtonConfigurer());
    		toolbar.add(buttomPanel, BorderLayout.WEST);
    		toolbar.setEnabled(false);
    		toolbar.setVisible(true);
    		return toolbar;
    	}
Working...
X