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 @ 2445
History | View | Annotate | Download (11.6 KB)
1 |
|
---|---|
2 |
package org.gvsig.tools.swing.api; |
3 |
|
4 |
import java.awt.Color; |
5 |
import java.awt.Dimension; |
6 |
import java.awt.Image; |
7 |
import java.awt.event.ActionListener; |
8 |
import java.awt.image.BufferedImage; |
9 |
import java.io.File; |
10 |
import javax.swing.AbstractButton; |
11 |
import javax.swing.ComboBoxModel; |
12 |
import javax.swing.Icon; |
13 |
import javax.swing.JButton; |
14 |
import javax.swing.JComboBox; |
15 |
import javax.swing.JComponent; |
16 |
import javax.swing.JLabel; |
17 |
import javax.swing.JList; |
18 |
import javax.swing.JSlider; |
19 |
import javax.swing.JTabbedPane; |
20 |
import javax.swing.JTable; |
21 |
import javax.swing.JTree; |
22 |
import javax.swing.table.TableModel; |
23 |
import javax.swing.text.JTextComponent; |
24 |
import javax.swing.tree.TreeModel; |
25 |
import org.apache.commons.lang3.StringUtils; |
26 |
import org.gvsig.tools.bookmarksandhistory.Bookmarks; |
27 |
import org.gvsig.tools.bookmarksandhistory.History; |
28 |
import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController; |
29 |
import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController; |
30 |
import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
31 |
import org.gvsig.tools.swing.api.pickercontroller.DataTypePickerController; |
32 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
33 |
import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
34 |
import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController; |
35 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
36 |
|
37 |
|
38 |
public interface ToolsSwingManager { |
39 |
|
40 |
public ActionListenerSupport createActionListenerSupport();
|
41 |
|
42 |
public JListWithCheckbox createJListWithCheckbox(JList wrappedList); |
43 |
|
44 |
public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel); |
45 |
|
46 |
public ComboBoxModel createComboBoxModel(TreeModel treeModel); |
47 |
|
48 |
/**
|
49 |
* @param txtLabel
|
50 |
* @param btnShowDialog
|
51 |
* @param sldAlpha
|
52 |
* @param allowNull
|
53 |
* @return
|
54 |
* @deprecated use createColorPickerController
|
55 |
*/
|
56 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
57 |
/**
|
58 |
* @param txtLabel
|
59 |
* @param btnShowDialog
|
60 |
* @return
|
61 |
* @deprecated use createColorPickerController
|
62 |
*/
|
63 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog); |
64 |
/**
|
65 |
* @param txtLabel
|
66 |
* @param btnShowDialog
|
67 |
* @param sldAlpha
|
68 |
* @return
|
69 |
* @deprecated use createColorPickerController
|
70 |
*/
|
71 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
72 |
|
73 |
|
74 |
/**
|
75 |
* Create a buffered Image of the given size and type.
|
76 |
* In this context, buffered image means editable image (admits setRGB etc)
|
77 |
* If the size is bigger of max physical size of buffered image, creates a file mapped buffered Image.
|
78 |
*
|
79 |
* @param w width in pixels of the requested image
|
80 |
* @param h height in pixels of the requested image
|
81 |
* @param type image type (refers to bands, etc. see {@link Image}
|
82 |
* @return a buffered (editable) image of the desired size and type
|
83 |
* @see setMaxPhysicalSizeOfBufferedImage
|
84 |
* @see getMaxPhysicalSizeOfBufferedImage
|
85 |
*
|
86 |
*/
|
87 |
public BufferedImage createBufferedImage(int w, int h, int type); |
88 |
|
89 |
|
90 |
/**
|
91 |
* Create a file mapped buffered Image of the given size and type.
|
92 |
* In this context, buffered image means editable image (admits setRGB etc)
|
93 |
*
|
94 |
* @param w width in pixels of the requested image
|
95 |
* @param h height in pixels of the requested image
|
96 |
* @param type image type (refers to bands, etc. see {@link Image}
|
97 |
* @return a buffered (editable) image of the desired size and type
|
98 |
*/
|
99 |
public BufferedImage createVirtualBufferedImage(int w, int h, int type); |
100 |
|
101 |
public BufferedImage copyBufferedImage(BufferedImage img); |
102 |
|
103 |
/**
|
104 |
* Sets the max physical size of buffered image creates by this manager.
|
105 |
*
|
106 |
* @param dimension
|
107 |
* @see createBufferedImage
|
108 |
* @see createVirtualBufferedImage
|
109 |
*/
|
110 |
public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension); |
111 |
|
112 |
/**
|
113 |
* Return the max physical size of buffered image creates by this manager.
|
114 |
*
|
115 |
* @return
|
116 |
* @see createBufferedImage
|
117 |
* @see createVirtualBufferedImage
|
118 |
*/
|
119 |
public Dimension getMaxPhysicalSizeOfBufferedImage(); |
120 |
|
121 |
/**
|
122 |
* Alpha blending is the process of combining a translucent foreground color with a background
|
123 |
*
|
124 |
* https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
125 |
*
|
126 |
* @param bgColor
|
127 |
* @param fgColor
|
128 |
* @return
|
129 |
*/
|
130 |
public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor); |
131 |
|
132 |
public Color opaqueColor(Color src); |
133 |
|
134 |
public void translate(JComponent component); |
135 |
|
136 |
public void translate(AbstractButton component); |
137 |
|
138 |
public void translate(JLabel component); |
139 |
|
140 |
public void translate(JTabbedPane component); |
141 |
|
142 |
public void translate(JComponent component, boolean wrap); |
143 |
|
144 |
public void translate(AbstractButton component, boolean wrap); |
145 |
|
146 |
public void translate(JLabel component, boolean wrap); |
147 |
|
148 |
public void translate(JTabbedPane component, boolean wrap); |
149 |
|
150 |
public void setDefaultPopupMenu(final JTextComponent component); |
151 |
|
152 |
public void setDefaultPopupMenu(final JComboBox component); |
153 |
|
154 |
public void setDefaultPopupMenu(final JTextComponent component, String title); |
155 |
|
156 |
public void setDefaultPopupMenu(final JComboBox component, String title); |
157 |
|
158 |
public ChangeListenerHelper createChangeListenerHelper();
|
159 |
|
160 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
161 |
|
162 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog); |
163 |
|
164 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
165 |
|
166 |
public DatePickerController createDatePickerController(JTextComponent txtDate, JButton btnDate); |
167 |
|
168 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
169 |
|
170 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile); |
171 |
|
172 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle); |
173 |
|
174 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
175 |
|
176 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile); |
177 |
|
178 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle); |
179 |
|
180 |
public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath); |
181 |
|
182 |
public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload); |
183 |
|
184 |
public void removeBorder(JComponent component); |
185 |
|
186 |
public void addClearButton(final JTextComponent text, final ActionListener action); |
187 |
|
188 |
public void addClearButton(final JTextComponent text); |
189 |
|
190 |
public void addClearButton(JComboBox combo); |
191 |
|
192 |
public boolean hasClearButton(final JComboBox combo); |
193 |
|
194 |
public boolean hasClearButton(final JTextComponent text); |
195 |
|
196 |
public void removeClearButton(final JComboBox combo); |
197 |
|
198 |
public void removeClearButton(final JTextComponent text); |
199 |
|
200 |
public SimpleImage createSimpleImage();
|
201 |
|
202 |
public SimpleImage createSimpleImage(Object source); |
203 |
|
204 |
public DropDown createDropDown(JComboBox combo); |
205 |
|
206 |
public DropDown createDropDown(JLabel label); |
207 |
|
208 |
public DropDown createDropDown(AbstractButton button); |
209 |
|
210 |
public DropDown createDropDown(JComponent component); |
211 |
|
212 |
/**
|
213 |
* Contructor for creating a CompoundIcon where the icons are
|
214 |
* layed out HORIZONTAL, the gap is 0 and the X/Y alignments will
|
215 |
* default to CENTER.
|
216 |
*
|
217 |
* @param icons the Icons to be painted as part of the CompoundIcon
|
218 |
*
|
219 |
* @return the CompoundIcon
|
220 |
*/
|
221 |
public CompoundIcon createCompoundIcon(Icon... icons); |
222 |
|
223 |
/**
|
224 |
* Contructor for creating a CompoundIcon where the gap is 0 and
|
225 |
* the X/Y alignments will default to CENTER.
|
226 |
*
|
227 |
* @param orientation the orientation used to lay out the icons for painting.
|
228 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
229 |
* @param icons the Icons to be painted as part of the CompoundIcon
|
230 |
*
|
231 |
* @return the CompoundIcon
|
232 |
*/
|
233 |
public CompoundIcon createCompoundIcon(int orientation, Icon... icons); |
234 |
|
235 |
/**
|
236 |
* Convenience contructor for creating a CompoundIcon where the X/Y
|
237 |
* alignments will default to CENTER.
|
238 |
*
|
239 |
* @param orientation the orientation used to lay out the icons for painting.
|
240 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
241 |
* @param gap the gap between the icons
|
242 |
* @param icons the Icons to be painted as part of the CompoundIcon
|
243 |
*
|
244 |
* @return the CompoundIcon
|
245 |
*/
|
246 |
public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons); |
247 |
|
248 |
/**
|
249 |
* Create a CompoundIcon specifying all the properties.
|
250 |
*
|
251 |
* @param orientation the orientation used to lay out the icons for painting.
|
252 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
|
253 |
* @param gap the gap between the icons
|
254 |
* @param alignmentX the X alignment of the icons. Common values are SwingConstants.LEFT,
|
255 |
* SwingConstants.CENTER, SwingConstants.RIGHT.
|
256 |
* @param alignmentY the Y alignment of the icons. Common values are SwingConstants.TOP,
|
257 |
* SwingConstants.CENTER, SwingConstants.BOTTOM.
|
258 |
* @param icons the Icons to be painted as part of the CompoundIcon
|
259 |
*
|
260 |
* @return the CompoundIcon
|
261 |
*/
|
262 |
public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons); |
263 |
|
264 |
public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button); |
265 |
|
266 |
public HistoryController createHistoryController(History history, JButton button); |
267 |
|
268 |
public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn); |
269 |
|
270 |
public FilteredListModel createFilteredListModel();
|
271 |
|
272 |
public FilteredTreeModel createFilteredTreeModel(JTree tree); |
273 |
|
274 |
public FilteredListController createFilteredListController(JList list, JTextComponent text, JButton button); |
275 |
|
276 |
public FilteredTreeController createFilteredTreeController(JTree list, JTextComponent text, JButton button); |
277 |
|
278 |
public JLabel createTitledSeparator(String title, int height, int titlePosition, int titleJustification); |
279 |
|
280 |
public JLabel createTitledSeparator(String title); |
281 |
|
282 |
public JWebBrowser createJWebBrowser();
|
283 |
|
284 |
public void registerJWebBrowserFactory(JWebBrowserFactory factory); |
285 |
|
286 |
public DataTypePickerController createDataTypePickerController(JComboBox cboDataType, JButton btnDataType, boolean allowNull); |
287 |
|
288 |
public TableColumnAdjuster createTableColumnAdjuster(JTable table); |
289 |
|
290 |
public MessageBarController createMessageBarController(JLabel txtLabel, int timeDuration); |
291 |
|
292 |
public String showZoomDialog(java.awt.Component parent, String title, String text, boolean editable); |
293 |
|
294 |
public DropDown createDropDownIcon(JLabel lblNull); |
295 |
|
296 |
public void putInClipboard(String data); |
297 |
|
298 |
public String getFromClipboard(); |
299 |
|
300 |
} |