01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.properties.editors;
20:
21: import java.awt.Component;
22: import java.awt.Graphics;
23: import java.awt.Rectangle;
24:
25: import javax.swing.ImageIcon;
26:
27: import com.jeta.forms.store.properties.TabbedPaneProperties;
28: import com.jeta.open.gui.framework.JETADialog;
29: import com.jeta.open.gui.utils.JETAToolbox;
30: import com.jeta.open.i18n.I18N;
31: import com.jeta.swingbuilder.gui.components.tabpane.TabDesignerView;
32: import com.jeta.swingbuilder.gui.properties.JETAPropertyEditor;
33: import com.jeta.swingbuilder.gui.utils.FormDesignerUtils;
34: import com.jeta.swingbuilder.resources.Icons;
35:
36: /**
37: * @author Jeff Tassin
38: */
39: public class TabbedPaneEditor extends JETAPropertyEditor {
40: /**
41: * Used to render the value of our border
42: */
43: private ValuePainter m_value_painter;
44:
45: private static ImageIcon[] m_icon = { (ImageIcon) FormDesignerUtils
46: .loadImage(Icons.TABPANE_16) };
47:
48: /**
49: * ctor
50: */
51: public TabbedPaneEditor() {
52: m_value_painter = new ValuePainter(I18N
53: .getLocalizedMessage("tab designer"));
54: m_value_painter.setPreImages(m_icon);
55: }
56:
57: /**
58: * Invokes a dialog used to update the property
59: */
60: public void invokePropertyDialog(Component comp) {
61: TabDesignerView view = new TabDesignerView(
62: (TabbedPaneProperties) getValue());
63: JETADialog dlg = JETAToolbox.invokeDialog(view, comp, I18N
64: .getLocalizedMessage("TabbedPane Designer"));
65: if (dlg.isOk()) {
66: setValue(view.getTabbedPaneProperties());
67: }
68: }
69:
70: /**
71: * Determines whether this class renders itself using the
72: * paintValue(Graphics g, Rectangle rect) method. Generally, editors that
73: * are not JComponents are paintable.
74: */
75: public boolean isPaintable() {
76: return true;
77: }
78:
79: /**
80: * Method that renders the text on the given graphics context
81: */
82: public void paintValue(Graphics g, Rectangle rect) {
83: // forward the call to the value painter
84: m_value_painter.paintValue(g, rect);
85: }
86:
87: /**
88: * @return true since we have a custom editor dialog for this type
89: */
90: public boolean supportsCustomEditor() {
91: return true;
92: }
93: }
|