01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: SiteEditorToolBar.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.gui.ui;
09:
10: import javax.swing.*;
11:
12: import com.uwyn.rife.config.Config;
13: import com.uwyn.rife.gui.ui.actions.*;
14: import com.uwyn.rife.swing.JBorderlessToggleButton;
15:
16: public class SiteEditorToolBar extends EditorToolBar {
17: private ButtonGroup mToolsButtonGroup = null;
18: private JBorderlessToggleButton mSelectionButton = null;
19: private JBorderlessToggleButton mZoomButton = null;
20: private JBorderlessToggleButton mElementButton = null;
21: private JBorderlessToggleButton mConnectorButton = null;
22: private JBorderlessToggleButton mGridShowButton = null;
23: private JBorderlessToggleButton mGridSnapButton = null;
24:
25: public SiteEditorToolBar(EditorPane pane) {
26: super (pane);
27:
28: mToolsButtonGroup = new ButtonGroup();
29: EditorPaneToolAction action = null;
30:
31: mSelectionButton = new JBorderlessToggleButton();
32: action = new SitestructurePaneSelectionToolAction();
33: action.setEditorPane(pane);
34: mSelectionButton.setAction(action);
35: mSelectionButton.setSelected(true);
36: mToolsButtonGroup.add(mSelectionButton);
37: mZoomButton = new JBorderlessToggleButton();
38: action = new SitestructurePaneZoomToolAction();
39: action.setEditorPane(pane);
40: mZoomButton.setAction(action);
41: // mZoomButton.addMouseListener(this);
42: mToolsButtonGroup.add(mZoomButton);
43: mElementButton = new JBorderlessToggleButton();
44: action = new SitestructurePaneElementToolAction();
45: action.setEditorPane(pane);
46: mElementButton.setAction(action);
47: mToolsButtonGroup.add(mElementButton);
48: mConnectorButton = new JBorderlessToggleButton();
49: action = new SitestructurePaneConnectorToolAction();
50: action.setEditorPane(pane);
51: mConnectorButton.setAction(action);
52: mToolsButtonGroup.add(mConnectorButton);
53: mGridShowButton = new JBorderlessToggleButton();
54: action = new SitestructurePaneGridShowToolAction();
55: action.setEditorPane(pane);
56: mGridShowButton.setAction(action);
57: mGridShowButton.setSelected(Config.getRepInstance().getBool(
58: "GRID_SHOW"));
59: mGridSnapButton = new JBorderlessToggleButton();
60: action = new SitestructurePaneGridSnapToolAction();
61: action.setEditorPane(pane);
62: mGridSnapButton.setAction(action);
63: mGridSnapButton.setSelected(Config.getRepInstance().getBool(
64: "GRID_SNAP"));
65:
66: this .add(mSelectionButton);
67: this .add(new JToolBar.Separator());
68: this .add(mZoomButton);
69: this .add(new JToolBar.Separator());
70: this .add(mElementButton);
71: this .add(mConnectorButton);
72: this .add(new JToolBar.Separator());
73: this.add(mGridShowButton);
74: this.add(mGridSnapButton);
75: }
76: }
|