001: package net.sourceforge.squirrel_sql.plugins.graph;
002:
003: import net.sourceforge.squirrel_sql.fw.util.StringManager;
004: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
005:
006: import javax.swing.*;
007: import java.awt.*;
008:
009: public class ZoomPrintPanel extends JPanel {
010: private static final StringManager s_stringMgr = StringManagerFactory
011: .getStringManager(ZoomPrintPanel.class);
012:
013: static final int ZOOM_MIN_PERCENT = 10;
014: static final int ZOOM_MAX_PERCENT = 400;
015:
016: static final int EDGES_MIN_PERCENT = 10;
017: static final int EDGES_MAX_PERCENT = 150;
018:
019: JSlider sldZoom;
020: JCheckBox chkHideScrollBars;
021: JComboBox cboFormat;
022: JButton btnFormat;
023: JSlider sldEdges;
024: JCheckBox chkShowEdges;
025: JButton btnPrint;
026: JButton btnSaveImages;
027:
028: public ZoomPrintPanel(GraphPluginResources rsrc) {
029: setLayout(new GridLayout(1, 2, 20, 0));
030: add(createZoomPanel());
031: add(createPrintPanel(rsrc));
032: }
033:
034: private JPanel createPrintPanel(GraphPluginResources rsrc) {
035: JPanel ret = new JPanel(new BorderLayout());
036:
037: JPanel pnlLeft = new JPanel(new BorderLayout());
038:
039: // i18n[graph.showZoomPaper=Show/Zoom paper edges]
040: chkShowEdges = new JCheckBox(s_stringMgr
041: .getString("graph.showZoomPaper"));
042: pnlLeft.add(chkShowEdges, BorderLayout.WEST);
043:
044: JPanel pnlFormat = new JPanel(new BorderLayout());
045:
046: // i18n[graph.format=Format ...]
047: btnFormat = new JButton(s_stringMgr.getString("graph.format"));
048: pnlFormat.add(btnFormat, BorderLayout.WEST);
049: cboFormat = new JComboBox();
050: pnlFormat.add(cboFormat, BorderLayout.CENTER);
051:
052: pnlLeft.add(pnlFormat, BorderLayout.CENTER);
053:
054: ret.add(pnlLeft, BorderLayout.WEST);
055:
056: sldEdges = new JSlider(JSlider.HORIZONTAL, EDGES_MIN_PERCENT,
057: EDGES_MAX_PERCENT, 100);
058:
059: ret.add(sldEdges, BorderLayout.CENTER);
060:
061: btnPrint = new JButton(rsrc
062: .getIcon(GraphPluginResources.IKeys.PRINT_IMAGE));
063: Dimension printBtnPrefSize = btnPrint.getPreferredSize();
064: //printBtnPrefSize.width -=10;
065: btnPrint.setPreferredSize(printBtnPrefSize);
066: // i18n[graph.printGraph=Print graph]
067: btnPrint.setToolTipText(s_stringMgr
068: .getString("graph.printGraph"));
069:
070: btnSaveImages = new JButton(
071: rsrc
072: .getIcon(GraphPluginResources.IKeys.SAVE_IMAGES_TO_FILE));
073: Dimension btnCopyToClipPrefSize = btnPrint.getPreferredSize();
074: //btnCopyToClipPrefSize.width -=10;
075: btnSaveImages.setPreferredSize(btnCopyToClipPrefSize);
076: // i18n[graph.saveGraphImagesToFile=Copy graph to clipboard]
077: btnSaveImages.setToolTipText(s_stringMgr
078: .getString("graph.saveGraphImagesToFile"));
079:
080: JPanel pnlButtons = new JPanel(new GridLayout(1, 2));
081: pnlButtons.add(btnSaveImages);
082: pnlButtons.add(btnPrint);
083: ret.add(pnlButtons, BorderLayout.EAST);
084:
085: return ret;
086: }
087:
088: private JPanel createZoomPanel() {
089: JPanel ret = new JPanel(new BorderLayout());
090: // i18n[graph.zoom=Zoom]
091: ret.add(new JLabel(s_stringMgr.getString("graph.zoom")),
092: BorderLayout.WEST);
093:
094: sldZoom = new JSlider(JSlider.HORIZONTAL, ZOOM_MIN_PERCENT,
095: ZOOM_MAX_PERCENT, 100);
096: ret.add(sldZoom, BorderLayout.CENTER);
097:
098: // i18n[graph.hideScrollBars=Hide scrollbars]
099: chkHideScrollBars = new JCheckBox(s_stringMgr
100: .getString("graph.hideScrollBars"));
101: ret.add(chkHideScrollBars, BorderLayout.EAST);
102: return ret;
103: }
104:
105: }
|