gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.app / org.gvsig.view3d.app.common / src / main / java / org / gvsig / view3d / app / properties / General3DPreferencePage.java @ 509
History | View | Annotate | Download (4.77 KB)
1 |
package org.gvsig.view3d.app.properties; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
|
5 |
import javax.swing.ImageIcon; |
6 |
import javax.swing.JPanel; |
7 |
|
8 |
import org.gvsig.andami.IconThemeHelper; |
9 |
import org.gvsig.andami.PluginServices; |
10 |
import org.gvsig.andami.PluginsLocator; |
11 |
import org.gvsig.andami.PluginsManager; |
12 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
13 |
import org.gvsig.andami.preferences.StoreException; |
14 |
import org.gvsig.tools.ToolsLocator; |
15 |
import org.gvsig.tools.dynobject.DynObject; |
16 |
import org.gvsig.tools.i18n.I18nManager; |
17 |
import org.gvsig.view3d.swing.api.View3DSwingLocator; |
18 |
import org.gvsig.view3d.swing.api.View3DSwingManager; |
19 |
import org.gvsig.view3d.swing.api.properties.GeneralProperties3D; |
20 |
import org.gvsig.view3d.swing.api.properties.GeneralProperties3DPanel; |
21 |
|
22 |
public class General3DPreferencePage extends AbstractPreferencePage { |
23 |
|
24 |
private static final long serialVersionUID = -3384416698766077019L; |
25 |
|
26 |
public static final String ID = General3DPreferencePage.class.getName(); |
27 |
|
28 |
private GeneralProperties3DPanel propertiesPanel;
|
29 |
private DynObject pluginProperties;
|
30 |
private PluginServices plugin;
|
31 |
|
32 |
public General3DPreferencePage() {
|
33 |
initComponents(); |
34 |
} |
35 |
|
36 |
private void initComponents() { |
37 |
PluginsManager pluginManager = PluginsLocator.getManager(); |
38 |
this.plugin = pluginManager.getPlugin(this); |
39 |
this.pluginProperties = this.plugin.getPluginProperties(); |
40 |
|
41 |
initializeValues(); |
42 |
|
43 |
View3DSwingManager swingManager = View3DSwingLocator.getManager(); |
44 |
GeneralProperties3D generalProperties3D = |
45 |
swingManager.getGeneral3DProperties(); |
46 |
|
47 |
propertiesPanel = |
48 |
swingManager.createGeneralProperties3DPanel(generalProperties3D); |
49 |
|
50 |
this.setLayout(new BorderLayout()); |
51 |
this.add(propertiesPanel.asJComponent(), BorderLayout.NORTH); |
52 |
} |
53 |
|
54 |
public String getID() { |
55 |
return ID;
|
56 |
} |
57 |
|
58 |
public String getTitle() { |
59 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
60 |
return i18nManager.getTranslation("3D"); |
61 |
} |
62 |
|
63 |
public JPanel getPanel() { |
64 |
return this; |
65 |
} |
66 |
|
67 |
public void initializeValues() { |
68 |
|
69 |
} |
70 |
|
71 |
public void initializeDefaults() { |
72 |
|
73 |
} |
74 |
|
75 |
@Override
|
76 |
public boolean isResizeable() { |
77 |
return true; |
78 |
} |
79 |
|
80 |
public ImageIcon getIcon() { |
81 |
return IconThemeHelper.getImageIcon("general-properties-view-3d"); |
82 |
} |
83 |
|
84 |
public boolean isValueChanged() { |
85 |
return super.hasChanged(); |
86 |
} |
87 |
|
88 |
@Override
|
89 |
public void storeValues() throws StoreException { |
90 |
|
91 |
this.pluginProperties.setDynValue("defultViewWidth", |
92 |
propertiesPanel.getDefaultWidth()); |
93 |
this.pluginProperties.setDynValue("defultViewHeight", |
94 |
propertiesPanel.getDefaultHeight()); |
95 |
this.pluginProperties.setDynValue("atmosphereVisibility", |
96 |
propertiesPanel.getAtmosphereVisibility()); |
97 |
this.pluginProperties.setDynValue("minimapVisibility", |
98 |
propertiesPanel.getMinimapVisibility()); |
99 |
this.pluginProperties.setDynValue("northIndicatorVisibility", |
100 |
propertiesPanel.getNorthIndicatorVisibility()); |
101 |
this.pluginProperties.setDynValue("starsBackgroundVisibility", |
102 |
propertiesPanel.getStarsBackgroundVisiblity()); |
103 |
this.pluginProperties.setDynValue("scaleVisibility", |
104 |
propertiesPanel.getScaleVisiblity()); |
105 |
this.pluginProperties.setDynValue("viewportAnimation", |
106 |
propertiesPanel.getViewPortAnimation()); |
107 |
this.pluginProperties.setDynValue("cachePath", |
108 |
propertiesPanel.getCachePath()); |
109 |
|
110 |
this.plugin.savePluginProperties();
|
111 |
} |
112 |
|
113 |
@Override
|
114 |
public void setChangesApplied() { |
115 |
|
116 |
View3DSwingManager swingManager = View3DSwingLocator.getManager(); |
117 |
GeneralProperties3D generalProperties3D = |
118 |
swingManager.getGeneral3DProperties(); |
119 |
|
120 |
generalProperties3D.setDefaultViewWidth(propertiesPanel |
121 |
.getDefaultWidth()); |
122 |
generalProperties3D.setDefaultViewHeight(propertiesPanel |
123 |
.getDefaultHeight()); |
124 |
generalProperties3D.setAtmosphereVisibility(propertiesPanel |
125 |
.getAtmosphereVisibility()); |
126 |
generalProperties3D.setMinimapVisibility(propertiesPanel |
127 |
.getMinimapVisibility()); |
128 |
generalProperties3D.setNorthIndicatorVisibility(propertiesPanel |
129 |
.getNorthIndicatorVisibility()); |
130 |
generalProperties3D.setScaleVisibility(propertiesPanel |
131 |
.getScaleVisiblity()); |
132 |
generalProperties3D.setStarsBackgroundVisibility(propertiesPanel |
133 |
.getStarsBackgroundVisiblity()); |
134 |
generalProperties3D.setViewPortAnimation(propertiesPanel |
135 |
.getViewPortAnimation()); |
136 |
generalProperties3D.setCachePath(propertiesPanel.getCachePath()); |
137 |
|
138 |
swingManager.setGeneral3DProperties(generalProperties3D); |
139 |
} |
140 |
|
141 |
} |