root / tags / v2_0_0_Build_2050 / extensions / org.gvsig.annotation.app / org.gvsig.annotation.app.extension / src / main / java / org / gvsig / annotation / app / extension / AnnotationPreferencesPage.java @ 38685
History | View | Annotate | Download (4.42 KB)
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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib��ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
package org.gvsig.annotation.app.extension; |
43 |
|
44 |
import java.awt.GridBagConstraints; |
45 |
import java.awt.Insets; |
46 |
|
47 |
import javax.swing.ImageIcon; |
48 |
import javax.swing.JLabel; |
49 |
import javax.swing.JPanel; |
50 |
import javax.swing.JTextField; |
51 |
|
52 |
import org.gvsig.andami.IconThemeHelper; |
53 |
import org.gvsig.andami.PluginServices; |
54 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
55 |
import org.gvsig.andami.preferences.StoreException; |
56 |
import org.gvsig.annotation.AnnotationLocator; |
57 |
import org.gvsig.annotation.AnnotationManager; |
58 |
import org.gvsig.annotation.swing.AnnotationSwingLocator; |
59 |
import org.gvsig.annotation.swing.JAnnotationPreferencesPanel; |
60 |
/**
|
61 |
* Default configuration page.
|
62 |
* <b><b>
|
63 |
* Here the user can establish what settings wants to use by default annotations.
|
64 |
*
|
65 |
*
|
66 |
* @author Vicente Caballero Navarro
|
67 |
*/
|
68 |
public class AnnotationPreferencesPage extends AbstractPreferencePage { |
69 |
/**
|
70 |
*
|
71 |
*/
|
72 |
private static final long serialVersionUID = -472617080926223575L; |
73 |
protected String id; |
74 |
//private ImageIcon icon;
|
75 |
private JTextField txtDefaultText; |
76 |
// private JComboBox cmbDefaultTypeFont;
|
77 |
// private JComboBox cmbDefaultStyleFont;
|
78 |
// private JTextField txtDefaultRotate;
|
79 |
// private JTextField txtDefaultHeight;
|
80 |
// private ColorChooserPanel jccDefaultColor;
|
81 |
private JAnnotationPreferencesPanel panel = null; |
82 |
|
83 |
private AnnotationManager annotationManager = null; |
84 |
|
85 |
|
86 |
/**
|
87 |
* Creates a new panel containing View preferences settings.
|
88 |
*
|
89 |
*/
|
90 |
public AnnotationPreferencesPage() {
|
91 |
super();
|
92 |
id = this.getClass().getName();
|
93 |
this.annotationManager = AnnotationLocator.getManager();
|
94 |
} |
95 |
|
96 |
public void initializeValues() { |
97 |
getPanel(); // init UI
|
98 |
} |
99 |
|
100 |
public String getID() { |
101 |
return id;
|
102 |
} |
103 |
|
104 |
public String getTitle() { |
105 |
return PluginServices.getText(this, "annotation_preferences"); |
106 |
} |
107 |
|
108 |
public JPanel getPanel() { |
109 |
if (panel==null) { |
110 |
addComponent(new JLabel(PluginServices.getText(this,"text")), |
111 |
txtDefaultText = new JTextField(), GridBagConstraints.BOTH, new Insets(4,0,4,8)); |
112 |
panel = AnnotationSwingLocator.getSwingManager().createAnnotationPreferences(); |
113 |
addComponent(panel); |
114 |
} |
115 |
return this; |
116 |
} |
117 |
|
118 |
public void storeValues() throws StoreException { |
119 |
annotationManager.setDefaultFontColor(panel.getDefaultFontColor()); |
120 |
annotationManager.setDefaultTextValue(txtDefaultText.getText()); |
121 |
annotationManager.setDefaultFontType(panel.getDefaultFontType()); |
122 |
annotationManager.setDefaultFontStyle(panel.getDefaultFontStyle()); |
123 |
annotationManager.setDefaultFontHeight(panel.getDefaultFontHeight()); |
124 |
annotationManager.setDefaultFontRotation(panel.getDefaultFontRotation()); |
125 |
} |
126 |
|
127 |
|
128 |
public void initializeDefaults() { |
129 |
txtDefaultText.setText(annotationManager.getDefaultTextValue()); |
130 |
panel.setDefaultFontType(annotationManager.getDefaultFontType()); |
131 |
panel.setDefaultFontStyle(annotationManager.getDefaultFontStyle()); |
132 |
panel.setDefaultFontHeight(annotationManager.getDefaultFontHeight()); |
133 |
panel.setDefaultFontColor(annotationManager.getDefaultFontColor()); |
134 |
panel.setDefaultFontRotation(annotationManager.getDefaultFontRotation()); |
135 |
} |
136 |
|
137 |
public ImageIcon getIcon() { |
138 |
return IconThemeHelper.getImageIcon("annotation-preferences"); |
139 |
} |
140 |
|
141 |
public boolean isValueChanged() { |
142 |
return super.hasChanged(); |
143 |
} |
144 |
|
145 |
public void setChangesApplied() { |
146 |
setChanged(false);
|
147 |
} |
148 |
} |