Revision 39319

View differences:

tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/app/gui/panels/ColorPanel.java
1

  
2
/*
3
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
4
 * for visualizing and manipulating spatial features with geometry and attributes.
5
 *
6
 * Copyright (C) 2003 Vivid Solutions
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
 *
22
 * For more information, contact:
23
 *
24
 * Vivid Solutions
25
 * Suite #1A
26
 * 2328 Government Street
27
 * Victoria BC  V8T 5G5
28
 * Canada
29
 *
30
 * (250)385-6040
31
 * www.vividsolutions.com
32
 */
33

  
34
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
35
 *
36
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
37
 *
38
 * This program is free software; you can redistribute it and/or
39
 * modify it under the terms of the GNU General Public License
40
 * as published by the Free Software Foundation; either version 2
41
 * of the License, or (at your option) any later version.
42
 *
43
 * This program is distributed in the hope that it will be useful,
44
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
45
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
 * GNU General Public License for more details.
47
 *
48
 * You should have received a copy of the GNU General Public License
49
 * along with this program; if not, write to the Free Software
50
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
51
 *
52
 * For more information, contact:
53
 *
54
 *  Generalitat Valenciana
55
 *   Conselleria d'Infraestructures i Transport
56
 *   Av. Blasco Ib??ez, 50
57
 *   46010 VALENCIA
58
 *   SPAIN
59
 *
60
 *      +34 963862235
61
 *   gvsig@gva.es
62
 *      www.gvsig.gva.es
63
 *
64
 *    or
65
 *
66
 *   IVER T.I. S.A
67
 *   Salamanca 50
68
 *   46005 Valencia
69
 *   Spain
70
 *
71
 *   +34 963163400
72
 *   dac@iver.es
73
 */
74
package org.gvsig.app.gui.panels;
75

  
76
import java.awt.BasicStroke;
77
import java.awt.Color;
78
import java.awt.Graphics;
79
import java.awt.Graphics2D;
80

  
81
import javax.swing.JPanel;
82

  
83

  
84
/**
85
 * Displays a colour.
86
 */
87
public class ColorPanel extends JPanel {
88
    private Color fillColor = Color.red;
89
    private Color lineColor = Color.green;
90
    private int margin = 0;
91

  
92
    public ColorPanel() {
93
        setBackground(Color.white);
94
    }
95

  
96
    protected void paintComponent(Graphics g) {
97
        super.paintComponent(g);
98

  
99
        //Before I simply set the ColorPanel's background colour. But I found this
100
        //caused weird paint effects e.g. a second copy of the panel appearing
101
        //at the top left corner of the rendered image. [Jon Aquino].
102
        //<<TODO:DESIGN>> Use the GraphicsState class [Jon Aquino]
103
        Color originalColor = g.getColor();
104
        g.setColor(getBackground());
105
        ((Graphics2D)g).setStroke(fillStroke);
106
        g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
107
        g.setColor(fillColor);
108
        g.fillRect(margin, margin, getWidth() - 1 - margin - margin,
109
            getHeight() - 1 - margin - margin);
110

  
111
        if (lineColor != null) {
112
            g.setColor(lineColor);
113
            ((Graphics2D)g).setStroke(lineStroke);
114

  
115
            //-1 to ensure the rectangle doesn't extend past the panel [Jon Aquino]
116
            g.drawRect(margin, margin, getWidth() - 1 - margin - margin,
117
                getHeight() - 1 - margin - margin);
118
        }
119

  
120
        //<<TODO:DESIGN>> Put the next line in a finally block [Jon Aquino]
121
        g.setColor(originalColor);
122
    }
123

  
124
    /** Workaround for bug 4238829 in the Java bug database */
125
    public void setBounds(int x, int y, int w, int h) {
126
        super.setBounds(x, y, w, h);
127
        validate();
128
    }
129

  
130
    public void setFillColor(Color fillColor) {
131
        this.fillColor = fillColor;
132
    }
133

  
134
    /**
135
     * @param lineColor the new line colour, or null to not draw the line
136
     */
137
    public void setLineColor(Color lineColor) {
138
        this.lineColor = lineColor;
139
    }
140

  
141
    public void setMargin(int margin) {
142
        this.margin = margin;
143
    }
144
    public Color getFillColor() {
145
        return fillColor;
146
    }
147

  
148
    public Color getLineColor() {
149
        return lineColor;
150
    }
151
    
152
    private BasicStroke fillStroke = new BasicStroke(1);
153
    private int lineWidth = 1;
154
    private BasicStroke lineStroke = new BasicStroke(lineWidth);
155
    
156
    public void setLineWidth(int lineWidth) {
157
        lineStroke = new BasicStroke(lineWidth);
158
        this.lineWidth = lineWidth;
159
    }
160
    
161
    public int getLineWidth() {
162
        return lineWidth;
163
    }
164

  
165
}
0 166

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/app/gui/panels/ColorChooserPanel.java
1

  
2
/*
3
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
4
 * for visualizing and manipulating spatial features with geometry and attributes.
5
 *
6
 * Copyright (C) 2003 Vivid Solutions
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
 *
22
 * For more information, contact:
23
 *
24
 * Vivid Solutions
25
 * Suite #1A
26
 * 2328 Government Street
27
 * Victoria BC  V8T 5G5
28
 * Canada
29
 *
30
 * (250)385-6040
31
 * www.vividsolutions.com
32
 */
33

  
34
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
35
 *
36
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
37
 *
38
 * This program is free software; you can redistribute it and/or
39
 * modify it under the terms of the GNU General Public License
40
 * as published by the Free Software Foundation; either version 2
41
 * of the License, or (at your option) any later version.
42
 *
43
 * This program is distributed in the hope that it will be useful,
44
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
45
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
 * GNU General Public License for more details.
47
 *
48
 * You should have received a copy of the GNU General Public License
49
 * along with this program; if not, write to the Free Software
50
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
51
 *
52
 * For more information, contact:
53
 *
54
 *  Generalitat Valenciana
55
 *   Conselleria d'Infraestructures i Transport
56
 *   Av. Blasco Ib??ez, 50
57
 *   46010 VALENCIA
58
 *   SPAIN
59
 *
60
 *      +34 963862235
61
 *   gvsig@gva.es
62
 *      www.gvsig.gva.es
63
 *
64
 *    or
65
 *
66
 *   IVER T.I. S.A
67
 *   Salamanca 50
68
 *   46005 Valencia
69
 *   Spain
70
 *
71
 *   +34 963163400
72
 *   dac@iver.es
73
 */
74
package org.gvsig.app.gui.panels;
75

  
76
import java.awt.Color;
77
import java.awt.Dimension;
78
import java.awt.GridBagConstraints;
79
import java.awt.GridBagLayout;
80
import java.awt.GridLayout;
81
import java.awt.event.ActionEvent;
82
import java.awt.event.ActionListener;
83
import java.util.ArrayList;
84
import java.util.Iterator;
85

  
86
import javax.swing.BorderFactory;
87
import javax.swing.JButton;
88
import javax.swing.JCheckBox;
89
import javax.swing.JColorChooser;
90
import javax.swing.JFrame;
91
import javax.swing.JLabel;
92
import javax.swing.JPanel;
93
import javax.swing.JSlider;
94
import javax.swing.SwingUtilities;
95
import javax.swing.event.ChangeEvent;
96
import javax.swing.event.ChangeListener;
97

  
98
import org.gvsig.i18n.Messages;
99

  
100

  
101

  
102
/**
103
 * A custom Colour Scheme Browser - custom choices based on JColorChooser.
104
 */
105

  
106
public class ColorChooserPanel extends JPanel {
107
	private GridBagLayout gridBagLayout1 = new GridBagLayout();
108
	private JButton changeButton = new JButton();
109

  
110

  
111
    //{DEFECT-PREVENTION} In accessors, it's better to use "workbench = newWorkbench"
112
    //rather than "this.workbench = workbench", because otherwise if you misspell the
113
    //argument, Java won't complain! We should do this everywhere. [Jon Aquino]
114
    private JPanel outerColorPanel = new JPanel();
115
    private ColorPanel colorPanel = new ColorPanel();
116
    private Color color = Color.black;
117
//    private int alpha;
118
    private Dimension dim = new Dimension(100, 22);
119
    private Dimension dim2 = new Dimension(dim.width, dim.height*2+5);
120
    private ArrayList<ActionListener> actionListeners = new ArrayList<ActionListener>();
121
    private boolean withTransp;
122
    private boolean withTranspPerc;
123
	private boolean withNoFill;
124
    private JCheckBox chkUseColor;
125
	private JSlider sldTransparency;
126
	private JLabel lblTransparency;
127
	private boolean muteSldTransparency = false;
128
	private double perc = 0.392156863 ;/*100/255*/
129
	private ChangeListener sldAction = new ChangeListener() {
130
		public void stateChanged(ChangeEvent e) {
131
			if (!muteSldTransparency) {
132
				int alphaValue = sldTransparency.getValue();
133
				setAlpha(alphaValue);
134

  
135
				if(withTranspPerc) {
136
					int percValue = (int) (alphaValue * perc);
137
					lblTransparency.setText( String.valueOf(percValue) + "%");
138
				}
139
				fireActionPerformed();
140
			}
141
		}
142

  
143
	};
144

  
145

  
146
    public ColorChooserPanel() {
147
        this(false);
148
    }
149

  
150
    /**
151
	 * Constructor method
152
	 *
153
	 * @param withTransparencySlider boolean that specifies if the user
154
	 * wants a slider with the color chooser panel to control the transparency
155
	 * of the selected color.Also, it will appear a text which specifies the transparency percentage.
156
	 * @param withNoFill boolean that specifies if the color chooser panel
157
	 * allows a null value for the color selected (true case). If this values
158
	 * is false, when the color selected is null then black color is assigned
159
	 * automatically.
160
	 */
161
    public ColorChooserPanel(boolean withTransparencySlider) {
162
    	this(withTransparencySlider,false);
163

  
164
    }
165

  
166
	/**
167
	 * Constructor method
168
	 *
169
	 * @param withTransparencySlider boolean that specifies if the user
170
	 * wants a slider with the color chooser panel to control the transparency
171
	 * of the selected color.
172
	 * @param withNoFill boolean that specifies if the color chooser panel
173
	 * allows a null value for the color selected (true case). If this values
174
	 * is false, when the color selected is null then black color is assigned
175
	 * automatically.
176
	 */
177
	public ColorChooserPanel(boolean withTransparencySlider, boolean withNoFill) {
178

  
179
		this.withTransp=withTransparencySlider;
180
		this.withTranspPerc=withTransparencySlider;
181
		this.withNoFill=withNoFill;
182

  
183
		try {
184
			if (withTransp) {
185
				sldTransparency = new JSlider(0, 255);
186
				sldTransparency.addChangeListener(sldAction);
187
				int width = withNoFill ? dim2.width - 40 : dim2.width;
188
				sldTransparency.setPreferredSize(new Dimension(width-5, dim2.height/2));
189
				sldTransparency.setToolTipText(Messages.getText("transparencia"));
190

  
191
				if(withTranspPerc) {
192
					lblTransparency = new JLabel();
193
					int percValue = (int) (sldTransparency.getValue() * perc);
194
					lblTransparency.setText(String.valueOf(percValue) +"%");
195
					lblTransparency.setPreferredSize(new Dimension(40,20));
196
				}
197

  
198
				sldTransparency.setValue(255);
199

  
200
			}
201
			jbInit();
202
			colorPanel.setLineColor(null);
203
			changeButton.setToolTipText(Messages.getText("browse"));
204

  
205
		} catch (Exception e) {
206
			e.printStackTrace();
207
		}
208
	}
209

  
210
	private void jbInit() throws Exception {
211
		JPanel pane = new JPanel(new GridBagLayout());
212
		GridBagConstraints c = new GridBagConstraints();
213

  
214
		changeButton.setText("...");
215
		changeButton.addActionListener(new java.awt.event.ActionListener() {
216
			public void actionPerformed(ActionEvent e) {
217
				changeButton_actionPerformed(e);
218
			}
219
		});
220
		outerColorPanel.setBorder(BorderFactory.createLoweredBevelBorder());
221
		outerColorPanel.setPreferredSize(new Dimension(dim.width/2, dim.height));
222
		outerColorPanel.setBackground(Color.white);
223

  
224

  
225
		c.fill = GridBagConstraints.HORIZONTAL;
226
		c.gridx = 1;
227
		c.gridy = 0;
228
		c.gridwidth = 2;
229
		pane.add(outerColorPanel,c);
230

  
231
		c.fill = GridBagConstraints.HORIZONTAL;
232
		c.gridx = 3;
233
		c.gridy = 0;
234
		c.gridwidth = 1;
235
		pane.add(changeButton,c);
236
		outerColorPanel.add(colorPanel);
237

  
238
		if(withNoFill) {
239
			chkUseColor = new JCheckBox();
240
			chkUseColor.setSelected(true);
241
			c.fill = GridBagConstraints.HORIZONTAL;
242
			c.gridwidth = 1;
243
			c.gridx = 0;
244
			c.gridy = 1;
245

  
246

  
247
			chkUseColor.addActionListener(new java.awt.event.ActionListener() {
248
				public void actionPerformed(ActionEvent e) {
249
					useColor_actionPerformed(e);
250
				}
251
			});
252
			pane.add(chkUseColor,c);
253
		}
254

  
255

  
256
		if (withTransp) {
257

  
258
			c.fill = GridBagConstraints.HORIZONTAL;
259
			c.gridwidth = 3;
260
			c.gridx = 1;
261
			c.gridy = 1;
262
			pane.add(sldTransparency,c);
263

  
264

  
265
			if(withTranspPerc) {
266
				c.fill = GridBagConstraints.HORIZONTAL;
267
				c.gridwidth = 3;
268
				c.gridx = 4;
269
				c.gridy = 1;
270
				pane.add(lblTransparency,c);
271
			}
272

  
273
		}
274

  
275
		add(pane);
276
	}
277

  
278
    private void changeButton_actionPerformed(ActionEvent e) {
279
    	Color newColor = JColorChooser.showDialog(SwingUtilities.windowForComponent(this), Messages.getText("choose_color"), color);
280

  
281
        if (newColor == null) {
282
            return;
283
        }
284

  
285
        setColor(newColor);
286
        fireActionPerformed();
287
    }
288

  
289
    /**
290
	 * Returns true if the check box of the color chooser panel is selected.
291
	 * False otherwise.
292
	 * @return boolean true if the check box is selected. Otherwise, false.
293
	 */
294
	public boolean getUseColorisSelected() {
295
		if(withNoFill)
296
			return chkUseColor.isSelected();
297
		return false;
298
	}
299
	/**
300
	 * Sets the check box of the color chooser panel
301

  
302
	 * @param b boolean true if the user wants to select it.Otherwise, false.
303
	 */
304
	public void setUseColorIsSelected(boolean b) {
305
		if(withNoFill)
306
			chkUseColor.setSelected(b);
307
	}
308
	/**
309
	 * Controls the events when the check box of the color chooser panel
310
	 * is modified
311
	 *
312
	 * @param e Action Event
313
	 */
314
	private void useColor_actionPerformed(ActionEvent e) {
315
		if(chkUseColor.isSelected())
316
			setColor(color);
317
		else setColor(null);
318
		fireActionPerformed();
319
	}
320

  
321
     public void addActionListener(ActionListener l) {
322
        actionListeners.add(l);
323
    }
324

  
325
    public void removeActionListener(ActionListener l) {
326
        actionListeners.remove(l);
327
    }
328

  
329
    protected void fireActionPerformed() {
330
        for (Iterator<ActionListener> i = actionListeners.iterator(); i.hasNext();) {
331
            i.next().actionPerformed(new ActionEvent(this, 0, null));
332
        }
333
    }
334
	/**
335
	 * Sets the color of the chooser panel.
336
	 *
337
	 * @param color Color to be selected.
338
	 */
339
	public void setColor(Color color) {
340

  
341
		if( color != null) {
342
			this.color = color;
343
			setAlpha(color.getAlpha());
344
			updateColorPanel();
345
		}
346

  
347
	}
348

  
349
	/**
350
	 * Sets the alpha value of the color selected in the color chooser
351
	 * panel.
352
	 *
353
	 * @param alpha Alpha value of the color.
354
	 */
355
	public void setAlpha(int alpha) {
356
		muteSldTransparency = true;
357

  
358
		if (color != null)
359
			color=alphaColor(color,alpha);
360

  
361
		if (withTransp) {
362
			sldTransparency.setValue(alpha);
363
			sldTransparency.validate();
364
			int percValue = (int) (alpha * perc);
365
			lblTransparency.setText( String.valueOf(percValue)+ "%");
366
		}
367

  
368
		updateColorPanel();
369
		muteSldTransparency = false;
370
//		fireActionPerformed();
371
	}
372

  
373
	public int getAlpha() {
374
		if (withTransp) {
375
			return sldTransparency.getValue();
376
		} else {
377
			return color.getAlpha();
378
		}
379

  
380
	}
381

  
382
    private void updateColorPanel() {
383
        colorPanel.setFillColor(color);
384
        colorPanel.repaint();
385
    }
386

  
387

  
388
	/**
389
	 * Obtains the selected color in the color chooser panel.
390
	 *
391
	 * @return color the selected color
392
	 */
393
	public Color getColor() {
394
		return color;
395
	}
396

  
397
	public void disabledWithTransparency() {
398
		changeButton.setEnabled(false);
399
		if(withNoFill)
400
			chkUseColor.setEnabled(false);
401

  
402
	}
403

  
404
	@Override
405
	public void setEnabled(boolean newEnabled) {
406

  
407
		changeButton.setEnabled(newEnabled);
408
		if(withTransp) {
409
			sldTransparency.setEnabled(newEnabled);
410
		}
411
		if(withTranspPerc) {
412
			lblTransparency.setEnabled(newEnabled);
413
		}
414
		if(withNoFill) {
415
			chkUseColor.setEnabled(newEnabled);
416
		}
417

  
418
	}
419

  
420
	public static void main(String[] args) {
421
		JFrame f = new JFrame();
422

  
423
		final ColorChooserPanel ce2 = new ColorChooserPanel(true,true);
424

  
425
		JPanel content = new JPanel(new GridLayout(2, 1));
426

  
427
		content.add(ce2);
428

  
429

  
430
		f.setContentPane(content);
431
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
432
		f.pack();
433
		f.setVisible(true);
434

  
435
	}
436

  
437
    private Color alphaColor(Color color, int alpha) {
438
        return new Color(color.getRed(), color.getGreen(), color.getBlue(),
439
            alpha);
440
    }
441

  
442
}
0 443

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/awt/event/specificCaretPosition/ISpecificCaretPosition.java
1
package org.gvsig.gui.awt.event.specificCaretPosition;
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
/**
44
 * Interface with the prototype of methods to have a component with an specific
45
 *   caret position
46
 * 
47
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
48
 */
49
public interface ISpecificCaretPosition {
50
	public static final int LEFT_POSITIONS = 1;
51
	public static final int RIGHT_POSITIONS = 2;
52
	public static final int LIKE_JTEXTCOMPONENT = 3;
53
	
54
	/**
55
	 * Gets the position of text that will be seen
56
	 *
57
	 * @return The position of text that will be seen (LEFT_POSITIONS, RIGHT_POSITIONS or LIKE_JTEXTCOMPONENT)
58
	 */
59
	public int getCaretPositionMode();
60

  
61
	/**
62
	 * Sets the position of text that will be seen
63
	 * 
64
	 * @param caretPositionMode The position of text that will be seen (LEFT_POSITIONS, RIGHT_POSITIONS or LIKE_JTEXTCOMPONENT)
65
	 */
66
	public void setCaretPositionMode(int caretPositionMode);
67
}
0 68

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/awt/event/specificCaretPosition/SpecificCaretPositionListeners.java
1
package org.gvsig.gui.awt.event.specificCaretPosition;
2

  
3
import java.awt.event.FocusAdapter;
4
import java.awt.event.FocusEvent;
5

  
6
import javax.swing.event.CaretEvent;
7
import javax.swing.event.CaretListener;
8
import javax.swing.event.DocumentEvent;
9
import javax.swing.event.DocumentListener;
10
import javax.swing.text.JTextComponent;
11

  
12
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
13
 *
14
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
29
 *
30
 * For more information, contact:
31
 *
32
 *  Generalitat Valenciana
33
 *   Conselleria d'Infraestructures i Transport
34
 *   Av. Blasco Ib??ez, 50
35
 *   46010 VALENCIA
36
 *   SPAIN
37
 *
38
 *      +34 963862235
39
 *   gvsig@gva.es
40
 *      www.gvsig.gva.es
41
 *
42
 *    or
43
 *
44
 *   IVER T.I. S.A
45
 *   Salamanca 50
46
 *   46005 Valencia
47
 *   Spain
48
 *
49
 *   +34 963163400
50
 *   dac@iver.es
51
 */
52

  
53
/**
54
 * This class has a method which adds the necessary listeners for convert a JTextComponent to another which can be configurated
55
 *   its 'text visible positions when isn't edited' behaviour: left positions, right positions or like JTextComponent (doesn't change text visible positions)
56
 * 
57
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
58
 */
59
public class SpecificCaretPositionListeners {
60
	/**
61
	 * Adds three listeners to a JTextComponent component:
62
	 *  - A FocusListener -> if this component loses its focus -> set caret position to 0
63
	 *  - A DocumentListener -> if this component doesn't have the focus and its caret position has changed -> set caret position to 0
64
	 *  - A CaretListener -> sometimes DocumentListener doesn't take effect, but this listener does
65
	 * @param component
66
	 */
67
	public static void setListeners(final JTextComponent component) {
68
		// The Focus Listener
69
		component.addFocusListener(new FocusAdapter() {
70
			/*
71
			 *  (non-Javadoc)
72
			 * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
73
			 */
74
			public void focusLost(FocusEvent e) {
75
				switch (((ISpecificCaretPosition)component).getCaretPositionMode()) {
76
					case ISpecificCaretPosition.LEFT_POSITIONS:
77
						(component).setCaretPosition(0);
78
						break;
79
					case ISpecificCaretPosition.RIGHT_POSITIONS:
80
						(component).setCaretPosition(component.getDocument().getLength());
81
						break;
82
					case ISpecificCaretPosition.LIKE_JTEXTCOMPONENT: // Do nothing
83
						break;
84
				}
85
			}
86
		});
87
		
88
		// The Document Listener
89
		component.getDocument().addDocumentListener(new DocumentListener() {
90
			/*
91
			 *  (non-Javadoc)
92
			 * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
93
			 */
94
			public void changedUpdate(DocumentEvent e) {				
95
				if (!component.isFocusOwner()) {
96
					switch (((ISpecificCaretPosition)component).getCaretPositionMode()) {
97
						case ISpecificCaretPosition.LEFT_POSITIONS:
98
							(component).setCaretPosition(0);
99
							break;
100
						case ISpecificCaretPosition.RIGHT_POSITIONS:
101
							(component).setCaretPosition(component.getDocument().getLength());
102
							break;
103
						case ISpecificCaretPosition.LIKE_JTEXTCOMPONENT: // Do nothing
104
							break;
105
					}
106
				}
107
			}
108

  
109
			/*
110
			 *  (non-Javadoc)
111
			 * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
112
			 */
113
			public void insertUpdate(DocumentEvent e) {
114
				if (!component.isFocusOwner()) {
115
					switch (((ISpecificCaretPosition)component).getCaretPositionMode()) {
116
						case ISpecificCaretPosition.LEFT_POSITIONS:
117
							(component).setCaretPosition(0);
118
							break;
119
						case ISpecificCaretPosition.RIGHT_POSITIONS:
120
							(component).setCaretPosition(component.getDocument().getLength());
121
							break;
122
						case ISpecificCaretPosition.LIKE_JTEXTCOMPONENT: // Do nothing
123
							break;
124
					}
125
				}
126
			}
127

  
128
			/*
129
			 *  (non-Javadoc)
130
			 * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
131
			 */
132
			public void removeUpdate(DocumentEvent e) {
133
				if (!component.isFocusOwner()) {
134
					switch (((ISpecificCaretPosition)component).getCaretPositionMode()) {
135
						case ISpecificCaretPosition.LEFT_POSITIONS:
136
							(component).setCaretPosition(0);
137
							break;
138
						case ISpecificCaretPosition.RIGHT_POSITIONS:
139
							(component).setCaretPosition(component.getDocument().getLength());
140
							break;
141
						case ISpecificCaretPosition.LIKE_JTEXTCOMPONENT: // Do nothing
142
							break;
143
					}
144
				}
145
			}			
146
		});
147

  
148
		// The Caret Listener
149
		component.addCaretListener(new CaretListener() {
150
			/*
151
			 *  (non-Javadoc)
152
			 * @see javax.swing.event.CaretListener#caretUpdate(javax.swing.event.CaretEvent)
153
			 */
154
			public void caretUpdate(CaretEvent e) {				
155
				if (!component.isFocusOwner()) {
156
					switch (((ISpecificCaretPosition)component).getCaretPositionMode()) {
157
						case ISpecificCaretPosition.LEFT_POSITIONS:
158
							if ((component).getCaretPosition() != 0)
159
								(component).setCaretPosition(0);
160
							break;
161
						case ISpecificCaretPosition.RIGHT_POSITIONS:
162
							if ((component).getCaretPosition() != component.getDocument().getLength())
163
							(component).setCaretPosition(component.getDocument().getLength());
164
							break;
165
						case ISpecificCaretPosition.LIKE_JTEXTCOMPONENT: // Do nothing
166
							break;
167
					}
168
				}
169
			}
170
		});
171
	}
172
}
0 173

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/util/StatusComponent.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.util;
20

  
21
import java.util.ArrayList;
22

  
23
import javax.swing.JComponent;
24
/**
25
 * Clase para poder cambiar el estado de un componente y sus componentes hijos.
26
 *
27
 * Tiene dos formas de uso:
28
 *
29
 * 1.- Desactivar un componente y todos sus hijos sin necesidad de guardar su
30
 *     estado. Para este caso solo es necesario usar el m?todo est?tico
31
 *     setDisabled(componente). El hecho de que no exista un activar es que para
32
 *     desactivar esta claro que queremos desactivar un componente y sus hijos,
33
 *     pero a la hora de activar no todos los hijos deben estar activos, para
34
 *     estos casos es necesario ver la segunda opci?n.
35
 *
36
 * 2.- Desactivar un componente guardando todos sus estados y volver a recuperar
37
 *     sus estados como estaba inicialmente. Ejemplo:
38
 *
39
 *     // Creamos el StatusComponent asoci?ndolo al componente en cuesti?n
40
 *     StatusComponent statusComponent = new StatusComponent(miControl);
41
 *
42
 *     // Desactivamos el componente y sus hijos guardando todos los estados.
43
 *     statusComponent.setEnabled(false);
44
 *
45
 *     ......
46
 *     // Activamos el componente recuperando su estado inicial
47
 *     statusComponent.setEnabled(true);
48
 *
49
 * @version 07/09/2007
50
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
51
 */
52
public class StatusComponent {
53
	private ArrayList<StatusComponentStruct> statusList = new ArrayList<StatusComponentStruct>();
54
	private boolean    enabled   = true;
55
	private JComponent component = null;
56

  
57
	/**
58
	 * Estructura de datos para poder tener el estado de un componente
59
	 * @version 07/09/2007
60
	 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
61
	 */
62
	public class StatusComponentStruct {
63
		private JComponent object;
64
		private boolean enabled;
65

  
66
		public boolean isEnabled() {
67
			return enabled;
68
		}
69

  
70
		public void setEnabled(boolean enabled) {
71
			this.enabled = enabled;
72
		}
73

  
74
		public JComponent getObject() {
75
			return object;
76
		}
77

  
78
		public void setObject(JComponent object) {
79
			this.object = object;
80
		}
81
	}
82

  
83
	/**
84
	 * Construye un StatusComponent. Es necesario pasarle el componente que
85
	 * queremos tratar.
86
	 * @param component
87
	 */
88
	public StatusComponent(JComponent component) {
89
		this.component = component;
90
	}
91

  
92
	/**
93
	 * Recupera el estado de un componente y todos sus hijos, vaciando la pila de
94
	 * estados. Eso quiere decir que no se podra volver a recuperar su estado sin
95
	 * haberlo guardado previamente.
96
	 * @param component
97
	 */
98
	private void restoreStatus(JComponent component) {
99
		boolean auxEnabled = false;
100
		boolean finded = false;
101
		// Buscar estado de dicho componente
102
		for (int i = 0; i < statusList.size(); i++) {
103
			StatusComponentStruct auxStatus = (StatusComponentStruct) statusList.get(i);
104
			if (auxStatus.getObject() == component) {
105
				auxEnabled = auxStatus.isEnabled();
106
				statusList.remove(i);
107
				finded = true;
108
				break;
109
			}
110
		}
111

  
112
		// Asignar su estado
113
		if (finded)
114
			component.setEnabled(auxEnabled);
115

  
116
		for (int i = 0; i < component.getComponentCount(); i++)
117
			if (component.getComponent(i) instanceof JComponent)
118
				restoreStatus((JComponent) component.getComponent(i));
119
	}
120

  
121
	/**
122
	 * Desactivar el componente y todos sus hijos sin guardar los estados. Hay que
123
	 * tener cuidado con no confundirlo con setEnabled(false). Este metodo nunca
124
	 * guardara el estado, asi que no se podra recuperar despues dicho estado.
125
	 * @param component
126
	 */
127
	static public void setDisabled(JComponent component) {
128
		component.setEnabled(false);
129
		for (int i = 0; i < component.getComponentCount(); i++)
130
			if (component.getComponent(i) instanceof JComponent)
131
				setDisabled((JComponent) component.getComponent(i));
132
	}
133

  
134
	/**
135
	 * Guarda el estado de un componente. Este proceso es recursivo. El estado
136
	 * se guarda en un array y este array no es vaciado inicialmente. La idea es
137
	 * guardar en un disabled y recuperar en un enabled y asegurarse que no puede
138
	 * ocurrir un disabled o un enabled dos veces.
139
	 * @param component
140
	 */
141
	private void saveComponentsStatus(JComponent component) {
142
		// Guardar estado
143
		StatusComponentStruct auxStatus = new StatusComponentStruct();
144
		auxStatus.setEnabled(component.isEnabled());
145
		auxStatus.setObject(component);
146
		statusList.add(auxStatus);
147

  
148
		for (int i = 0; i < component.getComponentCount(); i++)
149
			if (component.getComponent(i) instanceof JComponent)
150
				saveComponentsStatus((JComponent) component.getComponent(i));
151
	}
152

  
153
	/**
154
	 * Activa o desactiva un componente y todos sus componentes hijos. No se puede
155
	 * activar o desactivar dos veces seguidas. Siendo ignoradas las peticiones
156
	 * repetitivas.
157
	 * @param enabled
158
	 */
159
	public void setEnabled(boolean enabled) {
160
		// Si el estado ha cambiado, hacemos algo
161
		if (this.enabled != enabled) {
162
			if (enabled) {
163
				restoreStatus(component);
164
			} else {
165
				saveComponentsStatus(component);
166
				setDisabled(component);
167
			}
168
			this.enabled = enabled;
169
		}
170
	}
171

  
172
	/**
173
	 * @return the enabled
174
	 */
175
	public boolean isEnabled() {
176
		return enabled;
177
	}
178
}
0 179

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/DefaultColorTablePainter.java
1
package org.gvsig.gui;
2

  
3
import java.awt.Color;
4
import java.awt.Graphics2D;
5
import java.awt.Rectangle;
6
import java.util.ArrayList;
7
import java.util.List;
8

  
9
public class DefaultColorTablePainter implements ColorTablePainter {
10
	private class ColorItem {
11
		Color color = null;
12
		double value =0;
13
		
14
		ColorItem(double value, Color color) {
15
			this.color = color;
16
			this.value = value;
17
		}
18
		
19
		Color getColor() {
20
			return color;
21
		}
22
		
23
		double getValue() {
24
			return value;
25
		}
26
	}
27
	
28
	List<ColorItem> colorItems = null;
29
	
30
	DefaultColorTablePainter() {
31
		this.colorItems = new ArrayList<ColorItem>();
32
		int n = 256;
33
		for( int i=0; i<n; i++) {
34
                Color color = Color.getHSBColor((float) i / (float) n, 0.85f, 1.0f);
35
                this.colorItems.add( new ColorItem(i,color));
36
        }
37

  
38
	}
39
	
40
	public Color[] getColors() {
41
		Color[] colors = new Color[colorItems.size()];
42
		for (int i = 0; i < colors.length; i++) {
43
			colors[i] = ((ColorItem) colorItems.get(i)).getColor();
44
		}
45
		return colors;	
46
	}
47

  
48
	public String getTableName() {
49
		return "Default colot table";
50
	}
51

  
52
	public void paint(Graphics2D g, boolean isSelected) {
53
		Rectangle area = g.getClipBounds();
54
		area.y=0;
55
		area.x=0;
56
		int x1 = area.x;
57
		int x2 = area.x + area.width - 1;
58

  
59
		if( this.colorItems.size() > 0 ) {
60
			double min = colorItems.get(0).getValue();
61
            double max = colorItems.get(colorItems.size() - 1).getValue();
62
            for (int i = area.x; i < (area.x + area.width - 1); i++) {
63
				double pos = min + (((max - min) * (i - area.x)) / (area.width - 2));
64
				g.setColor(this.colorItems.get((int) pos).getColor());
65
				g.drawLine(i, area.y, i, area.y + area.height);
66
			}
67
		} else {
68
			g.setColor(new Color(224, 224, 224));
69
			g.fillRect(x1, area.y, x2 - x1, area.height - 1);
70
		}
71
		if (isSelected) {
72
			g.setColor(Color.black);
73
		} else {
74
			g.setColor(new Color(96, 96, 96));
75
		}
76
		g.drawRect(x1, area.y, x2 - x1, area.height - 1);
77
	}
78

  
79
}
0 80

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/ColorTablesFactory.java
1
package org.gvsig.gui;
2

  
3
import java.util.List;
4

  
5
public interface ColorTablesFactory {
6
	public List<ColorTablePainter> createColorTables();
7
}
0 8

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/DefaultColorTablesFactory.java
1
package org.gvsig.gui;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5

  
6
public class DefaultColorTablesFactory implements ColorTablesFactory {
7
	private List<ColorTablePainter> colorTables;
8

  
9
	public DefaultColorTablesFactory() {
10
		this.colorTables = new ArrayList<ColorTablePainter>();
11
		this.colorTables.add(new DefaultColorTablePainter());
12
	}
13
	
14
	public List<ColorTablePainter> createColorTables() {
15
		return this.colorTables;
16
	}
17

  
18
}
0 19

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/beans/progresspanel/LogControl.java
1
package org.gvsig.gui.beans.progresspanel;
2

  
3
/* gvSIG. Geographic Information System of the Valencian Government
4
 *
5
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
6
 * of the Valencian Government (CIT)
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 * 
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *  
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
21
 * MA  02110-1301, USA.
22
 * 
23
 */
24

  
25
/**
26
 * <code>LogControl</code>. Objeto para un control b?sico de un log. Para a?adir
27
 * y reemplazar la ?ltima l?nea a?adida.
28
 *
29
 * @version 27/03/2007
30
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
31
 */
32
public class LogControl {
33
	String text = "";
34

  
35
	/**
36
	 * A?ade una l?nea al log.
37
	 * @param line
38
	 */
39
	public void addLine(String line) {
40
		if (text.length() > 0)
41
			text += "\n";
42
		text += line;
43
	}
44

  
45
	/**
46
	 * Reemplaza la ?ltima l?nea a?adida al log.
47
	 * @param line
48
	 */
49
	public void replaceLastLine(String line) {
50
		int index = text.lastIndexOf("\n");
51
		if (index < 0)
52
			index = 0;
53
		text = text.substring(0, index);
54
		addLine(line);
55
	}
56

  
57
	/**
58
	 * Establece el texto completo del log.
59
	 * @param value
60
	 */
61
	public void setText(String value) {
62
		text = value;
63
	}
64

  
65
	/**
66
	 * Devuelve el contenido del log.
67
	 * @return String
68
	 */
69
	public String getText() {
70
		return text;
71
	}
72
}
0 73

  
tags/v2_0_0_Build_2059/libraries/libUIComponent/src/org/gvsig/gui/beans/progresspanel/ProgressPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *  
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.gui.beans.progresspanel;
23

  
24
import java.awt.Dialog;
25
import java.awt.Dimension;
26
import java.awt.FlowLayout;
27
import java.awt.Frame;
28
import java.awt.GraphicsConfiguration;
29
import java.awt.HeadlessException;
30
import java.awt.Toolkit;
31

  
32
import javax.swing.JDialog;
33
import javax.swing.JLabel;
34
import javax.swing.JPanel;
35
import javax.swing.JProgressBar;
36
import javax.swing.JScrollPane;
37
import javax.swing.JTextPane;
38

  
39
import org.gvsig.gui.beans.Messages;
40
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
41
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
42
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
43
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
44

  
45
/**
46
 * <code>ProgressPanel</code>. Muestra una ventana de di?logo para representar
47
 * una barra de progreso con su ventana de registro.
48
 *
49
 * @version 15/07/2008
50
 *
51
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
52
 */
53
public class ProgressPanel extends JDialog {
54
	private static final long serialVersionUID = 4321011219898234352L;
55

  
56
	private JPanel              jPanel              = null;
57
	private JLabel              jLabel              = null;
58
	private JLabel              jLabel1             = null;
59
	private JPanel              jPanel1             = null;
60
	private JPanel              njp                 = null;
61
	private DefaultButtonsPanel defaultButtonsPanel = null;
62
	private JProgressBar        jProgressBar        = null;
63
	private JScrollPane         jScrollPane         = null;
64
	private JTextPane           jTextPane           = null;
65
	private LogControl          text                = new LogControl();
66
	private long                startTime           = System.currentTimeMillis();
67
	private boolean             showPause           = true;
68

  
69
	/**
70
	 * Constructor
71
	 */
72
	public ProgressPanel() {
73
		super();
74
		initialize();
75
	}
76

  
77
	public ProgressPanel(boolean showPause) {
78
		super();
79
		this.showPause = showPause;
80
		initialize();
81
	}
82
	
83
	/**
84
	 * @see JDialog#JDialog(Dialog, boolean)
85
	 */
86
	public ProgressPanel(Dialog owner, boolean modal) throws HeadlessException {
87
		super(owner, modal);
88
		initialize();
89
	}
90

  
91
	/**
92
	 * @see JDialog#JDialog(Dialog, String, boolean, GraphicsConfiguration)
93
	 */
94
	public ProgressPanel(Dialog owner, String title, boolean modal,	GraphicsConfiguration gc) throws HeadlessException {
95
		super(owner, title, modal, gc);
96
		initialize();
97
	}
98

  
99
	/**
100
	 * @see JDialog#JDialog(Dialog, String, boolean)
101
	 */
102
	public ProgressPanel(Dialog owner, String title, boolean modal)
103
			throws HeadlessException {
104
		super(owner, title, modal);
105
		initialize();
106
	}
107

  
108
	/**
109
	 * @see JDialog#JDialog(Dialog, String)
110
	 */
111
	public ProgressPanel(Dialog owner, String title) throws HeadlessException {
112
		super(owner, title);
113
		initialize();
114
	}
115

  
116
	/**
117
	 * @see JDialog#JDialog(Dialog)
118
	 */
119
	public ProgressPanel(Dialog owner) throws HeadlessException {
120
		super(owner);
121
		initialize();
122
	}
123

  
124
	/**
125
	 * @see JDialog#JDialog(Frame, boolean)
126
	 */
127
	public ProgressPanel(Frame owner, boolean modal) throws HeadlessException {
128
		super(owner, modal);
129
		initialize();
130
	}
131

  
132
	/**
133
	 * @see JDialog#JDialog(Frame, String, boolean, GraphicsConfiguration)
134
	 */
135
	public ProgressPanel(Frame owner, String title, boolean modal, GraphicsConfiguration gc) {
136
		super(owner, title, modal, gc);
137
		initialize();
138
	}
139

  
140
	/**
141
	 * @see JDialog#JDialog(Frame, String, boolean)
142
	 */
143
	public ProgressPanel(Frame owner, String title, boolean modal)
144
			throws HeadlessException {
145
		super(owner, title, modal);
146
		initialize();
147
	}
148

  
149
	/**
150
	 * @see JDialog#JDialog(Frame, String)
151
	 */
152
	public ProgressPanel(Frame owner, String title) throws HeadlessException {
153
		super(owner, title);
154
		initialize();
155
	}
156

  
157
	/**
158
	 * @see JDialog#JDialog(Frame)
159
	 */
160
	public ProgressPanel(Frame owner) throws HeadlessException {
161
		super(owner);
162
		initialize();
163
	}	
164
	
165
	/**
166
	 * This method initializes this
167
	 */
168
	private void initialize() {
169
		njp = new JPanel();
170
		njp.setLayout(new java.awt.BorderLayout(5, 5));
171
		njp.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 15, 5, 15));
172
		this.setContentPane(njp);
173
		this.setResizable(false);
174
		njp.add(getJPanel(), java.awt.BorderLayout.NORTH);
175
		njp.add(getJPanel1(), java.awt.BorderLayout.CENTER);
176
		njp.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
177
		showLog(false);
178
		setPercent(0);
179
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
180
		this.setLocation(
181
				(int) (d.getWidth() - this.getWidth()) >> 1,
182
				(int) (d.getHeight() - this.getHeight()) >> 1);
183
		this.setVisible(true);
184
	}
185

  
186
	/**
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff