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 |
|
---|---|
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.JTextField; |
21 |
import javax.swing.table.TableModel; |
22 |
import javax.swing.text.JTextComponent; |
23 |
import javax.swing.tree.TreeModel; |
24 |
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 |
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 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
33 |
|
34 |
|
35 |
public interface ToolsSwingManager { |
36 |
|
37 |
public ActionListenerSupport createActionListenerSupport();
|
38 |
|
39 |
public JListWithCheckbox createJListWithCheckbox(JList wrappedList); |
40 |
|
41 |
public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel); |
42 |
|
43 |
public ComboBoxModel createComboBoxModel(TreeModel treeModel); |
44 |
|
45 |
/**
|
46 |
* @param txtLabel
|
47 |
* @param btnShowDialog
|
48 |
* @param sldAlpha
|
49 |
* @param allowNull
|
50 |
* @return
|
51 |
* @deprecated use createColorPickerController
|
52 |
*/
|
53 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
54 |
/**
|
55 |
* @param txtLabel
|
56 |
* @param btnShowDialog
|
57 |
* @return
|
58 |
* @deprecated use createColorPickerController
|
59 |
*/
|
60 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog); |
61 |
/**
|
62 |
* @param txtLabel
|
63 |
* @param btnShowDialog
|
64 |
* @param sldAlpha
|
65 |
* @return
|
66 |
* @deprecated use createColorPickerController
|
67 |
*/
|
68 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
69 |
|
70 |
|
71 |
/**
|
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 |
/**
|
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 |
public Color opaqueColor(Color src); |
130 |
|
131 |
public void translate(JComponent component); |
132 |
|
133 |
public void translate(AbstractButton component); |
134 |
|
135 |
public void translate(JLabel component); |
136 |
|
137 |
public void translate(JTabbedPane component); |
138 |
|
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 |
|
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 |
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 |
public void removeBorder(JComponent component); |
174 |
|
175 |
public void addClearButton(final JTextComponent text, final ActionListener action); |
176 |
|
177 |
public void addClearButton(final JTextComponent text); |
178 |
|
179 |
public void addClearButton(JComboBox combo); |
180 |
|
181 |
public SimpleImage createSimpleImage();
|
182 |
|
183 |
public SimpleImage createSimpleImage(Object source); |
184 |
|
185 |
public DropDown createDropDown(JComboBox combo); |
186 |
|
187 |
public DropDown createDropDown(JLabel label); |
188 |
|
189 |
public DropDown createDropDown(AbstractButton button); |
190 |
|
191 |
public DropDown createDropDown(JComponent component); |
192 |
|
193 |
/**
|
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 |
public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button); |
246 |
|
247 |
public HistoryController createHistoryController(History history, JButton button); |
248 |
|
249 |
public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn); |
250 |
} |