/** * Create a new instance of UIToolBarMain, with the given properties. * * @param oManager the IUIToolBarManager that is managing this toolbar. * @param parent the parent frame for the application. * @param nType the unique identifier for this toolbar. * @param isSimple is the user in simple interface mode. True for yes, false for advanced mode. */ public UIToolBarMain( IUIToolBarManager oManager, ProjectCompendiumFrame parent, int nType, boolean isSimple) { this.oParent = parent; this.oManager = oManager; this.nType = nType; this.bSimpleInterface = isSimple; tbrToolBar = new UIToolBar( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.mainToolbar")); // $NON-NLS-1$ tbrToolBar.setOrientation(DEFAULT_ORIENTATION); createToolBarItems(); }
/** * Create and return the toolbar with the node formatting options. * * @return UIToolBar, the toolbar with all the node formatting options. */ private UIToolBar createToolBar(int orientation) { tbrToolBar = new UIToolBar( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.name"), UIToolBar.NORTHSOUTH); // $NON-NLS-1$ tbrToolBar.setOrientation(orientation); tbrToolBar.setEnabled(false); CSH.setHelpIDString(tbrToolBar, "toolbars.formatlink"); // $NON-NLS-1$ GridBagLayout grid = new GridBagLayout(); linkPanel = new JPanel(grid); linkColourPanel = new JPanel(new BorderLayout()); linkColourPanel.setBackground(Color.black); JLabel label = new JLabel(" "); // $NON-NLS-1$ GridBagConstraints con5 = new GridBagConstraints(); con5.fill = GridBagConstraints.NONE; con5.anchor = GridBagConstraints.CENTER; grid.addLayoutComponent(label, con5); linkPanel.add(label); txtLinkColour = new JLabel(UIImages.get(BACKGROUND_COLOUR)); txtLinkColour.setBorder(null); txtLinkColour.setToolTipText( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectLinkColour")); //$NON-NLS-1$ txtLinkColour.setEnabled(false); txtLinkColour.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { int clickCount = e.getClickCount(); if (clickCount == 1 && txtLinkColour.isEnabled()) { onUpdateLinkColour(linkColourPanel.getBackground().getRGB()); } } }); linkColourPanel.add(txtLinkColour, BorderLayout.CENTER); GridBagConstraints con = new GridBagConstraints(); con.fill = GridBagConstraints.NONE; con.anchor = GridBagConstraints.CENTER; grid.addLayoutComponent(linkColourPanel, con); linkPanel.add(linkColourPanel); btLinkColour = new UIImageButton(UIImages.get(RIGHT_ARROW_ICON)); btLinkColour.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { int clickCount = e.getClickCount(); if (clickCount == 1 && txtLinkColour.isEnabled()) { if (oColorChooserDialog != null) { oColorChooserDialog.setColour(selectedLinkColour); } else { oColorChooserDialog = new UIColorChooserDialog(ProjectCompendium.APP, selectedLinkColour); } oColorChooserDialog.setVisible(true); Color oColour = oColorChooserDialog.getColour(); oColorChooserDialog.setVisible(false); if (oColour != null) { linkColourPanel.setBackground(oColour); onUpdateLinkColour(oColour.getRGB()); } } } }); linkPanel.add(btLinkColour); label = new JLabel(" "); // $NON-NLS-1$ GridBagConstraints con4 = new GridBagConstraints(); con4.fill = GridBagConstraints.NONE; con4.anchor = GridBagConstraints.CENTER; grid.addLayoutComponent(label, con4); linkPanel.add(label); tbrToolBar.add(linkPanel); CSH.setHelpIDString(txtLinkColour, "toolbars.formatlink"); // $NON-NLS-1$ tbrToolBar.add(createWeightChoiceBox()); tbrToolBar.add(createArrowChoiceBox()); tbrToolBar.add(createLinkStyleChoiceBox()); tbrToolBar.add(createLinkDashedChoiceBox()); return tbrToolBar; }