Statistics
| Revision:

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 @ 2297

History | View | Annotate | Download (11.1 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 setDefaultPopupMenu(final JTextComponent component);
143
    
144
    public void setDefaultPopupMenu(final JComboBox component);
145

    
146
    public void setDefaultPopupMenu(final JTextComponent component, String title);    
147

    
148
    public void setDefaultPopupMenu(final JComboBox component, String title);    
149

    
150
    public ChangeListenerHelper createChangeListenerHelper();
151
    
152
    public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull);
153
    
154
    public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog);
155
    
156
    public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha);
157
    
158
    public DatePickerController createDatePickerController(JTextComponent txtDate, JButton btnDate);
159

    
160
    public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon);
161

    
162
    public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile);
163

    
164
    public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle);
165

    
166
    public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon);
167

    
168
    public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile);
169

    
170
    public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle);
171

    
172
    public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath);
173

    
174
    public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload);
175

    
176
    public void removeBorder(JComponent component);
177
    
178
    public void addClearButton(final JTextComponent text,  final ActionListener action);
179

    
180
    public void addClearButton(final JTextComponent text);
181

    
182
    public void addClearButton(JComboBox combo);
183
    
184
    public boolean hasClearButton(final JComboBox combo);
185
    
186
    public boolean hasClearButton(final JTextComponent text);
187
    
188
    public void removeClearButton(final JComboBox combo);
189
    
190
    public void removeClearButton(final JTextComponent text);
191
    
192
    public SimpleImage createSimpleImage();
193
    
194
    public SimpleImage createSimpleImage(Object source);
195
    
196
    public DropDown createDropDown(JComboBox combo);
197
    
198
    public DropDown createDropDown(JLabel label);
199

    
200
    public DropDown createDropDown(AbstractButton button);
201

    
202
    public DropDown createDropDown(JComponent component);
203
    
204
    /**
205
     * Contructor for creating a CompoundIcon where the icons are
206
     * layed out HORIZONTAL, the gap is 0 and the X/Y alignments will
207
     * default to CENTER.
208
     *
209
     * @param icons the Icons to be painted as part of the CompoundIcon
210
     * 
211
     * @return the CompoundIcon
212
     */
213
    public CompoundIcon createCompoundIcon(Icon... icons);
214

    
215
    /**
216
     * Contructor for creating a CompoundIcon where the gap is 0 and
217
     * the X/Y alignments will default to CENTER.
218
     *
219
     * @param orientation the orientation used to lay out the icons for painting. 
220
     * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
221
     * @param icons the Icons to be painted as part of the CompoundIcon
222
     * 
223
     * @return the CompoundIcon
224
     */
225
    public CompoundIcon createCompoundIcon(int orientation, Icon... icons);
226

    
227
    /**
228
     * Convenience contructor for creating a CompoundIcon where the X/Y
229
     * alignments will default to CENTER.
230
     *
231
     * @param orientation the orientation used to lay out the icons for painting. 
232
     * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
233
     * @param gap the gap between the icons
234
     * @param icons the Icons to be painted as part of the CompoundIcon
235
     * 
236
     * @return the CompoundIcon
237
     */
238
    public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons);
239

    
240
    /**
241
     * Create a CompoundIcon specifying all the properties.
242
     *
243
     * @param orientation the orientation used to lay out the icons for painting. 
244
     * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
245
     * @param gap the gap between the icons
246
     * @param alignmentX the X alignment of the icons. Common values are SwingConstants.LEFT,
247
     * SwingConstants.CENTER, SwingConstants.RIGHT.
248
     * @param alignmentY the Y alignment of the icons. Common values are SwingConstants.TOP,
249
     * SwingConstants.CENTER, SwingConstants.BOTTOM.
250
     * @param icons the Icons to be painted as part of the CompoundIcon
251
     * 
252
     * @return the CompoundIcon
253
     */
254
    public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons);
255
    
256
    public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button);
257
    
258
    public HistoryController createHistoryController(History history, JButton button);
259

    
260
    public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn);
261
    
262
    public FilteredListModel createFilteredListModel();
263
    
264
    public FilteredTreeModel createFilteredTreeModel(JTree tree);
265
    
266
    public FilteredListController createFilteredListController(JList list, JTextComponent text, JButton button);
267
    
268
    public FilteredTreeController createFilteredTreeController(JTree list, JTextComponent text, JButton button);
269
    
270
    public JLabel createTitledSeparator(String title, int height, int titlePosition, int titleJustification);
271

    
272
    public JLabel createTitledSeparator(String title);
273

    
274
    public JWebBrowser createJWebBrowser();
275
    
276
    public void registerJWebBrowserFactory(JWebBrowserFactory factory);
277
    
278
    public DataTypePickerController createDataTypePickerController(JComboBox cboDataType, JButton btnDataType, boolean allowNull);
279
    
280
    public TableColumnAdjuster createTableColumnAdjuster(JTable table);
281
    
282
    public MessageBarController createMessageBarController(JLabel txtLabel, int timeDuration);
283
}