Revision 43801 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/propertypage/BasePropertiesPageDialog.java
BasePropertiesPageDialog.java | ||
---|---|---|
6 | 6 |
import java.awt.event.ActionEvent; |
7 | 7 |
import java.awt.event.ActionListener; |
8 | 8 |
import java.util.List; |
9 |
|
|
9 | 10 |
import javax.swing.JComponent; |
10 | 11 |
import javax.swing.JTabbedPane; |
12 |
|
|
11 | 13 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
12 | 14 |
import org.gvsig.propertypage.PropertiesPage.SetPageEnabledEvent; |
13 | 15 |
import org.gvsig.tools.ToolsLocator; |
16 |
import org.gvsig.tools.dispose.Disposable; |
|
17 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
14 | 18 |
import org.gvsig.tools.i18n.I18nManager; |
15 | 19 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
16 | 20 |
import org.gvsig.tools.util.Invocable; |
... | ... | |
26 | 30 |
private List<PropertiesPage> pages = null; |
27 | 31 |
private int userAction = ACTION_ACCEPT; |
28 | 32 |
private JTabbedPane tabbedPane = null; |
29 |
|
|
33 |
|
|
30 | 34 |
public BasePropertiesPageDialog() { |
31 | 35 |
} |
32 | 36 |
|
... | ... | |
38 | 42 |
this.obj = obj; |
39 | 43 |
this.groupID = groupID; |
40 | 44 |
PropertiesPageManager manager = MapControlLocator.getPropertiesPageManager(); |
41 |
this.pages = manager.getPages(this.groupID,this.obj);
|
|
45 |
this.pages = manager.getPages(this.groupID,this.obj); |
|
42 | 46 |
initComponents(); |
43 | 47 |
} |
44 |
|
|
48 |
|
|
45 | 49 |
protected void initComponents() { |
46 |
I18nManager i18nManager = ToolsLocator.getI18nManager();
|
|
50 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
47 | 51 |
|
48 | 52 |
this.content.setLayout(new BorderLayout()); |
49 | 53 |
Component contents = createPropertiesPagesPanel(); |
... | ... | |
53 | 57 |
this.content.add(contents, BorderLayout.CENTER ); |
54 | 58 |
|
55 | 59 |
this.titleLabel.setText(""); |
56 |
|
|
60 |
|
|
57 | 61 |
this.acceptButton.setText(i18nManager.getTranslation("accept")); |
58 | 62 |
this.acceptButton.addActionListener( new ActionListener() { |
59 | 63 |
@Override |
... | ... | |
102 | 106 |
return tabbedPane; |
103 | 107 |
} |
104 | 108 |
} |
105 |
|
|
109 |
|
|
106 | 110 |
protected boolean useTabsAlwais() { |
107 | 111 |
return false; |
108 | 112 |
} |
109 |
|
|
113 |
|
|
110 | 114 |
public void whenAccept() { |
111 | 115 |
for( int i=0; i<this.pages.size(); i++ ) { |
112 | 116 |
PropertiesPage page = this.pages.get(i); |
... | ... | |
117 | 121 |
this.userAction = ACTION_ACCEPT; |
118 | 122 |
this.closeDialog(); |
119 | 123 |
} |
120 |
|
|
124 |
|
|
121 | 125 |
public void whenApply() { |
122 | 126 |
for( int i=0; i<this.pages.size(); i++ ) { |
123 | 127 |
PropertiesPage page = this.pages.get(i); |
... | ... | |
127 | 131 |
} |
128 | 132 |
this.userAction = ACTION_APPLY; |
129 | 133 |
} |
130 |
|
|
134 |
|
|
131 | 135 |
public void whenCancel() { |
132 | 136 |
for( int i=0; i<this.pages.size(); i++ ) { |
133 | 137 |
PropertiesPage page = this.pages.get(i); |
... | ... | |
138 | 142 |
this.userAction = ACTION_CANCEL; |
139 | 143 |
this.closeDialog(); |
140 | 144 |
} |
141 |
|
|
145 |
|
|
142 | 146 |
public int getUserAction() { |
143 | 147 |
return this.userAction; |
144 | 148 |
} |
145 |
|
|
149 |
|
|
146 | 150 |
protected void closeDialog() { |
147 | 151 |
this.setVisible(false); |
152 |
for (PropertiesPage propertiesPage : pages) { |
|
153 |
if(propertiesPage instanceof Disposable) { |
|
154 |
DisposeUtils.disposeQuietly((Disposable) propertiesPage); |
|
155 |
} |
|
156 |
} |
|
148 | 157 |
} |
149 | 158 |
|
150 | 159 |
@Override |
151 | 160 |
public JComponent asJComponent() { |
152 | 161 |
return this; |
153 | 162 |
} |
154 |
|
|
163 |
|
|
155 | 164 |
public void setEnabledAt(Invocable filter, boolean enabled) { |
156 | 165 |
if( this.tabbedPane==null ) { |
157 | 166 |
return; |
... | ... | |
163 | 172 |
} |
164 | 173 |
} |
165 | 174 |
} |
166 |
|
|
175 |
|
|
167 | 176 |
} |
Also available in: Unified diff