gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.api / src / main / java / org / gvsig / tools / swing / api / ToolsSwingManager.java @ 2010
History | View | Annotate | Download (9.65 KB)
1 | 1251 | jjdelcerro | |
---|---|---|---|
2 | package org.gvsig.tools.swing.api; |
||
3 | |||
4 | 1628 | jjdelcerro | import java.awt.Color; |
5 | 1530 | fdiaz | import java.awt.Dimension; |
6 | import java.awt.Image; |
||
7 | 1758 | jjdelcerro | import java.awt.event.ActionListener; |
8 | 1530 | fdiaz | import java.awt.image.BufferedImage; |
9 | 1746 | jjdelcerro | import java.io.File; |
10 | 1640 | jjdelcerro | import javax.swing.AbstractButton; |
11 | 1424 | jjdelcerro | import javax.swing.ComboBoxModel; |
12 | 1947 | jjdelcerro | import javax.swing.Icon; |
13 | 1610 | jjdelcerro | import javax.swing.JButton; |
14 | 1377 | jjdelcerro | import javax.swing.JComboBox; |
15 | 1746 | jjdelcerro | import javax.swing.JComponent; |
16 | 1640 | jjdelcerro | import javax.swing.JLabel; |
17 | 1377 | jjdelcerro | import javax.swing.JList; |
18 | 1610 | jjdelcerro | import javax.swing.JSlider; |
19 | 1685 | jjdelcerro | import javax.swing.JTabbedPane; |
20 | 1610 | jjdelcerro | import javax.swing.JTextField; |
21 | 1997 | jjdelcerro | import javax.swing.table.TableModel; |
22 | 1698 | jjdelcerro | import javax.swing.text.JTextComponent; |
23 | 1377 | jjdelcerro | import javax.swing.tree.TreeModel; |
24 | 1986 | omartinez | import org.gvsig.tools.bookmarksandhistory.Bookmarks; |
25 | import org.gvsig.tools.bookmarksandhistory.History; |
||
26 | import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController; |
||
27 | import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController; |
||
28 | 1746 | jjdelcerro | import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
29 | import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
||
30 | import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
||
31 | import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController; |
||
32 | 1894 | jjdelcerro | import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
33 | 1251 | jjdelcerro | |
34 | 1377 | jjdelcerro | |
35 | 1251 | jjdelcerro | public interface ToolsSwingManager { |
36 | 1530 | fdiaz | |
37 | 1251 | jjdelcerro | public ActionListenerSupport createActionListenerSupport();
|
38 | 1530 | fdiaz | |
39 | 1377 | jjdelcerro | public JListWithCheckbox createJListWithCheckbox(JList wrappedList); |
40 | 1530 | fdiaz | |
41 | 1377 | jjdelcerro | public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel); |
42 | 1530 | fdiaz | |
43 | 1424 | jjdelcerro | public ComboBoxModel createComboBoxModel(TreeModel treeModel); |
44 | 1530 | fdiaz | |
45 | 1746 | jjdelcerro | /**
|
46 | 1766 | jjdelcerro | * @param txtLabel
|
47 | * @param btnShowDialog
|
||
48 | * @param sldAlpha
|
||
49 | * @param allowNull
|
||
50 | * @return
|
||
51 | 1746 | jjdelcerro | * @deprecated use createColorPickerController
|
52 | */
|
||
53 | 1610 | jjdelcerro | public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
54 | 1746 | jjdelcerro | /**
|
55 | 1766 | jjdelcerro | * @param txtLabel
|
56 | * @param btnShowDialog
|
||
57 | * @return
|
||
58 | 1746 | jjdelcerro | * @deprecated use createColorPickerController
|
59 | */
|
||
60 | 1610 | jjdelcerro | public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog); |
61 | 1746 | jjdelcerro | /**
|
62 | 1766 | jjdelcerro | * @param txtLabel
|
63 | * @param btnShowDialog
|
||
64 | * @param sldAlpha
|
||
65 | * @return
|
||
66 | 1746 | jjdelcerro | * @deprecated use createColorPickerController
|
67 | */
|
||
68 | 1610 | jjdelcerro | public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
69 | |||
70 | |||
71 | 1530 | fdiaz | /**
|
72 | * Create a buffered Image of the given size and type.
|
||
73 | * In this context, buffered image means editable image (admits setRGB etc)
|
||
74 | * If the size is bigger of max physical size of buffered image, creates a file mapped buffered Image.
|
||
75 | *
|
||
76 | * @param w width in pixels of the requested image
|
||
77 | * @param h height in pixels of the requested image
|
||
78 | * @param type image type (refers to bands, etc. see {@link Image}
|
||
79 | * @return a buffered (editable) image of the desired size and type
|
||
80 | * @see setMaxPhysicalSizeOfBufferedImage
|
||
81 | * @see getMaxPhysicalSizeOfBufferedImage
|
||
82 | *
|
||
83 | */
|
||
84 | public BufferedImage createBufferedImage(int w, int h, int type); |
||
85 | |||
86 | |||
87 | /**
|
||
88 | * Create a file mapped buffered Image of the given size and type.
|
||
89 | * In this context, buffered image means editable image (admits setRGB etc)
|
||
90 | *
|
||
91 | * @param w width in pixels of the requested image
|
||
92 | * @param h height in pixels of the requested image
|
||
93 | * @param type image type (refers to bands, etc. see {@link Image}
|
||
94 | * @return a buffered (editable) image of the desired size and type
|
||
95 | */
|
||
96 | public BufferedImage createVirtualBufferedImage(int w, int h, int type); |
||
97 | |||
98 | public BufferedImage copyBufferedImage(BufferedImage img); |
||
99 | |||
100 | /**
|
||
101 | * Sets the max physical size of buffered image creates by this manager.
|
||
102 | *
|
||
103 | * @param dimension
|
||
104 | * @see createBufferedImage
|
||
105 | * @see createVirtualBufferedImage
|
||
106 | */
|
||
107 | public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension); |
||
108 | |||
109 | /**
|
||
110 | * Return the max physical size of buffered image creates by this manager.
|
||
111 | *
|
||
112 | * @return
|
||
113 | * @see createBufferedImage
|
||
114 | * @see createVirtualBufferedImage
|
||
115 | */
|
||
116 | public Dimension getMaxPhysicalSizeOfBufferedImage(); |
||
117 | |||
118 | 1628 | jjdelcerro | /**
|
119 | * Alpha blending is the process of combining a translucent foreground color with a background
|
||
120 | *
|
||
121 | * https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
||
122 | *
|
||
123 | * @param bgColor
|
||
124 | * @param fgColor
|
||
125 | * @return
|
||
126 | */
|
||
127 | public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor); |
||
128 | |||
129 | 1632 | jjdelcerro | public Color opaqueColor(Color src); |
130 | 1640 | jjdelcerro | |
131 | 1746 | jjdelcerro | public void translate(JComponent component); |
132 | |||
133 | 1640 | jjdelcerro | public void translate(AbstractButton component); |
134 | |||
135 | public void translate(JLabel component); |
||
136 | 1685 | jjdelcerro | |
137 | public void translate(JTabbedPane component); |
||
138 | 1698 | jjdelcerro | |
139 | public void setDefaultPopupMenu(final JTextComponent component); |
||
140 | |||
141 | public void setDefaultPopupMenu(final JComboBox component); |
||
142 | |||
143 | public void setDefaultPopupMenu(final JTextComponent component, String title); |
||
144 | |||
145 | public void setDefaultPopupMenu(final JComboBox component, String title); |
||
146 | 1746 | jjdelcerro | |
147 | public ChangeListenerHelper createChangeListenerHelper();
|
||
148 | |||
149 | public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
||
150 | |||
151 | public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog); |
||
152 | |||
153 | public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
||
154 | |||
155 | public DatePickerController createDatePickerController(JTextField txtDate, JButton btnDate); |
||
156 | |||
157 | public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
||
158 | |||
159 | public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile); |
||
160 | |||
161 | public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle); |
||
162 | |||
163 | public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
||
164 | |||
165 | public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile); |
||
166 | |||
167 | public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle); |
||
168 | |||
169 | 1894 | jjdelcerro | public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath); |
170 | |||
171 | public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload); |
||
172 | |||
173 | 1750 | jjdelcerro | public void removeBorder(JComponent component); |
174 | 1758 | jjdelcerro | |
175 | 1796 | jjdelcerro | public void addClearButton(final JTextComponent text, final ActionListener action); |
176 | 1758 | jjdelcerro | |
177 | 1796 | jjdelcerro | public void addClearButton(final JTextComponent text); |
178 | 1758 | jjdelcerro | |
179 | 1862 | jjdelcerro | public void addClearButton(JComboBox combo); |
180 | |||
181 | 1840 | jjdelcerro | public SimpleImage createSimpleImage();
|
182 | |||
183 | public SimpleImage createSimpleImage(Object source); |
||
184 | 1884 | jjdelcerro | |
185 | public DropDown createDropDown(JComboBox combo); |
||
186 | |||
187 | public DropDown createDropDown(JLabel label); |
||
188 | 2010 | jjdelcerro | |
189 | public DropDown createDropDown(AbstractButton button); |
||
190 | |||
191 | public DropDown createDropDown(JComponent component); |
||
192 | 1884 | jjdelcerro | |
193 | 1947 | jjdelcerro | /**
|
194 | * Contructor for creating a CompoundIcon where the icons are
|
||
195 | * layed out HORIZONTAL, the gap is 0 and the X/Y alignments will
|
||
196 | * default to CENTER.
|
||
197 | *
|
||
198 | * @param icons the Icons to be painted as part of the CompoundIcon
|
||
199 | *
|
||
200 | * @return the CompoundIcon
|
||
201 | */
|
||
202 | public CompoundIcon createCompoundIcon(Icon... icons); |
||
203 | |||
204 | /**
|
||
205 | * Contructor for creating a CompoundIcon where the gap is 0 and
|
||
206 | * the X/Y alignments will default to CENTER.
|
||
207 | *
|
||
208 | * @param orientation the orientation used to lay out the icons for painting.
|
||
209 | * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
||
210 | * @param icons the Icons to be painted as part of the CompoundIcon
|
||
211 | *
|
||
212 | * @return the CompoundIcon
|
||
213 | */
|
||
214 | public CompoundIcon createCompoundIcon(int orientation, Icon... icons); |
||
215 | |||
216 | /**
|
||
217 | * Convenience contructor for creating a CompoundIcon where the X/Y
|
||
218 | * alignments will default to CENTER.
|
||
219 | *
|
||
220 | * @param orientation the orientation used to lay out the icons for painting.
|
||
221 | * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
||
222 | * @param gap the gap between the icons
|
||
223 | * @param icons the Icons to be painted as part of the CompoundIcon
|
||
224 | *
|
||
225 | * @return the CompoundIcon
|
||
226 | */
|
||
227 | public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons); |
||
228 | |||
229 | /**
|
||
230 | * Create a CompoundIcon specifying all the properties.
|
||
231 | *
|
||
232 | * @param orientation the orientation used to lay out the icons for painting.
|
||
233 | * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
||
234 | * @param gap the gap between the icons
|
||
235 | * @param alignmentX the X alignment of the icons. Common values are SwingConstants.LEFT,
|
||
236 | * SwingConstants.CENTER, SwingConstants.RIGHT.
|
||
237 | * @param alignmentY the Y alignment of the icons. Common values are SwingConstants.TOP,
|
||
238 | * SwingConstants.CENTER, SwingConstants.BOTTOM.
|
||
239 | * @param icons the Icons to be painted as part of the CompoundIcon
|
||
240 | *
|
||
241 | * @return the CompoundIcon
|
||
242 | */
|
||
243 | public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons); |
||
244 | |||
245 | 1986 | omartinez | public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button); |
246 | |||
247 | public HistoryController createHistoryController(History history, JButton button); |
||
248 | 1997 | jjdelcerro | |
249 | public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn); |
||
250 | 1251 | jjdelcerro | } |