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

History | View | Annotate | Download (10.4 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.JTree;
22
import javax.swing.table.TableModel;
23
import javax.swing.text.JTextComponent;
24
import javax.swing.tree.TreeModel;
25
import org.gvsig.tools.bookmarksandhistory.Bookmarks;
26
import org.gvsig.tools.bookmarksandhistory.History;
27
import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController;
28
import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController;
29
import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController;
30
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController;
31
import org.gvsig.tools.swing.api.pickercontroller.FilePickerController;
32
import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController;
33
import org.gvsig.tools.swing.api.pickercontroller.PickerController;
34

    
35

    
36
public interface ToolsSwingManager {
37

    
38
    public ActionListenerSupport createActionListenerSupport();
39

    
40
    public JListWithCheckbox createJListWithCheckbox(JList wrappedList);
41

    
42
    public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel);
43

    
44
    public ComboBoxModel createComboBoxModel(TreeModel treeModel);
45

    
46
    /**
47
     * @param txtLabel
48
     * @param btnShowDialog
49
     * @param sldAlpha
50
     * @param allowNull
51
     * @return 
52
     * @deprecated use createColorPickerController
53
     */
54
    public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull);
55
    /**
56
     * @param txtLabel
57
     * @param btnShowDialog
58
     * @return 
59
     * @deprecated use createColorPickerController
60
     */
61
    public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog);
62
    /**
63
     * @param txtLabel
64
     * @param btnShowDialog
65
     * @param sldAlpha
66
     * @return 
67
     * @deprecated use createColorPickerController
68
     */
69
    public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha);
70
    
71
    
72
    /**
73
     * Create a buffered Image of the given size and type.
74
     * In this context, buffered image means editable image (admits setRGB etc)
75
     * If the size is bigger of max physical size of buffered image, creates a file mapped buffered Image.
76
     *
77
     * @param w width in pixels of the requested image
78
     * @param h height in pixels of the requested image
79
     * @param type image type (refers to bands, etc. see {@link Image}
80
     * @return a buffered (editable) image of the desired size and type
81
     * @see setMaxPhysicalSizeOfBufferedImage
82
     * @see getMaxPhysicalSizeOfBufferedImage
83
     *
84
     */
85
    public BufferedImage createBufferedImage(int w, int h, int type);
86

    
87

    
88
    /**
89
     * Create a file mapped buffered Image of the given size and type.
90
     * In this context, buffered image means editable image (admits setRGB etc)
91
     *
92
     * @param w width in pixels of the requested image
93
     * @param h height in pixels of the requested image
94
     * @param type image type (refers to bands, etc. see {@link Image}
95
     * @return a buffered (editable) image of the desired size and type
96
     */
97
    public BufferedImage createVirtualBufferedImage(int w, int h, int type);
98

    
99
    public BufferedImage copyBufferedImage(BufferedImage img);
100

    
101
    /**
102
     * Sets the max physical size of buffered image creates by this manager.
103
     *
104
     * @param dimension
105
     * @see createBufferedImage
106
     * @see createVirtualBufferedImage
107
     */
108
    public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension);
109

    
110
    /**
111
     * Return the max physical size of buffered image creates by this manager.
112
     *
113
     * @return
114
     * @see createBufferedImage
115
     * @see createVirtualBufferedImage
116
     */
117
    public Dimension getMaxPhysicalSizeOfBufferedImage();
118

    
119
    /**
120
     * Alpha blending is the process of combining a translucent foreground color with a background 
121
     * 
122
     * https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
123
     * 
124
     * @param bgColor
125
     * @param fgColor
126
     * @return 
127
     */    
128
    public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor);
129
    
130
    public Color opaqueColor(Color src);
131

    
132
    public void translate(JComponent component);
133
    
134
    public void translate(AbstractButton component);
135

    
136
    public void translate(JLabel component);
137
    
138
    public void translate(JTabbedPane component);
139

    
140
    public void setDefaultPopupMenu(final JTextComponent component);
141
    
142
    public void setDefaultPopupMenu(final JComboBox component);
143

    
144
    public void setDefaultPopupMenu(final JTextComponent component, String title);    
145

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

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

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

    
160
    public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile);
161

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

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

    
166
    public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile);
167

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

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

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

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

    
178
    public void addClearButton(final JTextComponent text);
179

    
180
    public void addClearButton(JComboBox combo);
181
    
182
    public SimpleImage createSimpleImage();
183
    
184
    public SimpleImage createSimpleImage(Object source);
185
    
186
    public DropDown createDropDown(JComboBox combo);
187
    
188
    public DropDown createDropDown(JLabel label);
189

    
190
    public DropDown createDropDown(AbstractButton button);
191

    
192
    public DropDown createDropDown(JComponent component);
193
    
194
    /**
195
     * Contructor for creating a CompoundIcon where the icons are
196
     * layed out HORIZONTAL, the gap is 0 and the X/Y alignments will
197
     * default to CENTER.
198
     *
199
     * @param icons the Icons to be painted as part of the CompoundIcon
200
     * 
201
     * @return the CompoundIcon
202
     */
203
    public CompoundIcon createCompoundIcon(Icon... icons);
204

    
205
    /**
206
     * Contructor for creating a CompoundIcon where the gap is 0 and
207
     * the X/Y alignments will default to CENTER.
208
     *
209
     * @param orientation the orientation used to lay out the icons for painting. 
210
     * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
211
     * @param icons the Icons to be painted as part of the CompoundIcon
212
     * 
213
     * @return the CompoundIcon
214
     */
215
    public CompoundIcon createCompoundIcon(int orientation, Icon... icons);
216

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

    
230
    /**
231
     * Create a CompoundIcon specifying all the properties.
232
     *
233
     * @param orientation the orientation used to lay out the icons for painting. 
234
     * Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED.
235
     * @param gap the gap between the icons
236
     * @param alignmentX the X alignment of the icons. Common values are SwingConstants.LEFT,
237
     * SwingConstants.CENTER, SwingConstants.RIGHT.
238
     * @param alignmentY the Y alignment of the icons. Common values are SwingConstants.TOP,
239
     * SwingConstants.CENTER, SwingConstants.BOTTOM.
240
     * @param icons the Icons to be painted as part of the CompoundIcon
241
     * 
242
     * @return the CompoundIcon
243
     */
244
    public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons);
245
    
246
    public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button);
247
    
248
    public HistoryController createHistoryController(History history, JButton button);
249

    
250
    public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn);
251
    
252
    public FilteredListModel createFilteredListModel();
253
    
254
    public FilteredTreeModel createFilteredTreeModel(JTree tree);
255
    
256
    public FilteredListController createFilteredListController(JList list, JTextComponent text, JButton button);
257
    
258
    public FilteredTreeController createFilteredTreeController(JTree list, JTextComponent text, JButton button);
259
    
260
    public JLabel createTitledSeparator(String title, int height, int titlePosition, int titleJustification);
261

    
262
    public JLabel createTitledSeparator(String title);
263

    
264
    public JWebBrowser createJWebBrowser();
265
    
266
    public void registerJWebBrowserFactory(JWebBrowserFactory factory);
267
}