Revision 42909

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/GeneralViewPropertiesPage.java
10 10
import java.awt.GridBagLayout;
11 11
import java.awt.GridLayout;
12 12
import java.awt.Insets;
13
import java.awt.event.ActionListener;
14 13
import java.util.List;
14

  
15 15
import javax.swing.BorderFactory;
16 16
import javax.swing.JButton;
17 17
import javax.swing.JCheckBox;
......
21 21
import javax.swing.JLabel;
22 22
import javax.swing.JOptionPane;
23 23
import javax.swing.JPanel;
24

  
24 25
import org.cresques.cts.IProjection;
26

  
25 27
import org.gvsig.andami.PluginServices;
26
import org.gvsig.andami.ui.mdiManager.WindowInfo;
27 28
import org.gvsig.app.ApplicationLocator;
28 29
import org.gvsig.app.gui.JComboBoxUnits;
29 30
import org.gvsig.app.gui.panels.CRSSelectPanel;
......
35 36
import org.gvsig.app.project.documents.view.ViewManager;
36 37
import org.gvsig.fmap.crs.CRSFactory;
37 38
import org.gvsig.fmap.mapcontext.MapContext;
38
import org.gvsig.gui.beans.AcceptCancelPanel;
39 39
import org.gvsig.i18n.Messages;
40 40
import org.gvsig.propertypage.PropertiesPage;
41 41
import org.gvsig.tools.ToolsLocator;
42 42
import org.gvsig.tools.i18n.I18nManager;
43 43

  
44
/**
45
 * @author gvSIG team
46
 *
47
 */
44 48
public class GeneralViewPropertiesPage extends JPanel implements PropertiesPage {
45 49

  
46
    public static final int FIXED_WIDTH = 300;
50
    /**
51
     *
52
     */
53
    private static final long serialVersionUID = 1356416393907133043L;
47 54

  
55
    private JPanel propertiesPanel;
56

  
48 57
    private javax.swing.JLabel jLabelName = null;
49 58
    private javax.swing.JTextField txtName = null;
50 59
    private javax.swing.JLabel jLabelDate = null;
......
72 81
    private boolean isAcceppted = false;
73 82
    private JComboBox cmbDistanceArea = null;
74 83

  
84
    /**
85
     * @param view
86
     */
75 87
    public GeneralViewPropertiesPage(ViewDocument view) {
88
        super(new BorderLayout());
76 89
        this.view = view;
77 90
        initComponents();
78 91
    }
......
159 172
    }
160 173

  
161 174
    private void initComponents() {
162
        setLayout(new GridBagLayout());
163
        setBorder(BorderFactory.createEmptyBorder(4, 5, 4, 5));
175
        this.add(getCenterPanel(), BorderLayout.NORTH);
176
    }
164 177

  
165
        GridBagConstraints c = new GridBagConstraints();
166
        c.insets = new Insets(2, 5, 2, 5);
167
        c.gridy = -1;
178
    private Component getCenterPanel() {
179
        if (propertiesPanel == null) {
180
            propertiesPanel = new JPanel(new GridBagLayout());
168 181

  
169
        addRow(c, getJLabelName(), getTxtName());
170
        addRow(c, getJLabelDate(), getTxtDate());
171
        addRow(c, getJLabelOwner(), getTxtOwner());
172
        addRow(c, getJLabelMapUnits(), getCmbMapUnits());
173
        addRow(c, getJLabelDistanceUnits(), getCmbDistanceUnits());
174
        addRow(c, getJLabelAreaUnits(), getCmbDistanceArea());
182
            propertiesPanel.setLayout(new GridBagLayout());
183
            propertiesPanel.setBorder(BorderFactory.createEmptyBorder(4, 5, 4, 5));
175 184

  
176
        // some extra space
177
        addRow(c, new JLabel(" "), new JLabel(" "));
185
            GridBagConstraints c = new GridBagConstraints();
186
            c.insets = new Insets(2, 5, 2, 5);
187
            c.gridy = -1;
178 188

  
179
        GridLayout gl = new GridLayout(1,2);
180
        JPanel colorPanel = new JPanel(gl);
181
        colorPanel.add(getJLabelColor());
182
        JPanel secondHalfPanel = new JPanel(new GridBagLayout());
189
            addRow(propertiesPanel, c, getJLabelName(), getTxtName());
190
            addRow(propertiesPanel, c, getJLabelDate(), getTxtDate());
191
            addRow(propertiesPanel, c, getJLabelOwner(), getTxtOwner());
192
            addRow(propertiesPanel, c, getJLabelMapUnits(), getCmbMapUnits());
193
            addRow(propertiesPanel, c, getJLabelDistanceUnits(), getCmbDistanceUnits());
194
            addRow(propertiesPanel, c, getJLabelAreaUnits(), getCmbDistanceArea());
183 195

  
184
        GridBagConstraints c2 = new GridBagConstraints();
196
            // some extra space
197
            addRow(propertiesPanel, c, new JLabel(" "), new JLabel(" "));
185 198

  
186
        c2.fill = GridBagConstraints.BOTH;
187
        c2.weightx = 1.0;   //request any extra hor space
188
        c2.gridx = 0;
189
        c2.gridwidth = 1;
190
        c2.gridy = 0;
199
            GridLayout gl = new GridLayout(1,2);
200
            JPanel colorPanel = new JPanel(gl);
201
            colorPanel.add(getJLabelColor());
202
            JPanel secondHalfPanel = new JPanel(new GridBagLayout());
191 203

  
192
        JPanel auxPanel = new JPanel(new GridLayout(1,2));
193
        auxPanel.add(getLblColor(secondHalfPanel.getBackground()));
194
        auxPanel.add(new JLabel(""));
195
        secondHalfPanel.add(auxPanel, c2);
204
            GridBagConstraints c2 = new GridBagConstraints();
196 205

  
197
        c2.fill = GridBagConstraints.NONE;
198
        c2.weightx = 0.0;
199
        c2.gridx = 1;
200
        secondHalfPanel.add(getBtnColor(), c2);
206
            c2.fill = GridBagConstraints.BOTH;
207
            c2.weightx = 1.0;   //request any extra hor space
208
            c2.gridx = 0;
209
            c2.gridwidth = 1;
210
            c2.gridy = 0;
201 211

  
202
        colorPanel.add(secondHalfPanel);
212
            JPanel auxPanel = new JPanel(new GridLayout(1,2));
213
            auxPanel.add(getLblColor(secondHalfPanel.getBackground()));
214
            auxPanel.add(new JLabel(""));
215
            secondHalfPanel.add(auxPanel, c2);
203 216

  
204
        c.gridx = 0;
205
        c.gridwidth = 2;
206
        c.gridy++;
207
        add(colorPanel, c);
208
        c.gridwidth = 1;
217
            c2.fill = GridBagConstraints.NONE;
218
            c2.weightx = 0.0;
219
            c2.gridx = 1;
220
            secondHalfPanel.add(getBtnColor(), c2);
209 221

  
210
        c.anchor = GridBagConstraints.WEST;
211
        c.weightx = 0.0d;
212
        c.gridx = 0;
213
        c.gridwidth = GridBagConstraints.REMAINDER;
214
        c.gridy++;
215
        c.weightx = 1.0d;
216
        c.fill = GridBagConstraints.HORIZONTAL;
217
        add(getJPanelProj(), c);
222
            colorPanel.add(secondHalfPanel);
218 223

  
219
        // ============ set current as app default CRS
220
        c.anchor = GridBagConstraints.CENTER;
221
        c.gridy++;
222
        JPanel auxp = new JPanel(new BorderLayout());
223
        auxp.add(getSetAsDefaultCrsCheckbox(), BorderLayout.CENTER);
224
        add(auxp, c);
225
        // =============================
224
            c.gridx = 0;
225
            c.gridwidth = 2;
226
            c.gridy++;
227
            propertiesPanel.add(colorPanel, c);
228
            c.gridwidth = 1;
226 229

  
227
        // some extra space
228
        addRow(c, new JLabel(" "), new JLabel(" "));
230
            c.anchor = GridBagConstraints.WEST;
231
            c.weightx = 0.0d;
232
            c.gridx = 0;
233
            c.gridwidth = GridBagConstraints.REMAINDER;
234
            c.gridy++;
235
            c.weightx = 1.0d;
236
            c.fill = GridBagConstraints.HORIZONTAL;
237
            propertiesPanel.add(getJPanelProj(), c);
229 238

  
230
        c.anchor = GridBagConstraints.WEST;
231
        c.weightx = 0.0d;
232
        c.gridx = 0;
233
        c.gridy++;
234
        add(getJLabelComments(), c);
239
            // ============ set current as app default CRS
240
            c.anchor = GridBagConstraints.CENTER;
241
            c.gridy++;
242
            JPanel auxp = new JPanel(new BorderLayout());
243
            auxp.add(getSetAsDefaultCrsCheckbox(), BorderLayout.CENTER);
244
            propertiesPanel.add(auxp, c);
245
            // =============================
235 246

  
236
        c.fill = GridBagConstraints.BOTH;
237
        c.weightx = 1.0d;
238
        c.gridy++;
239
        c.gridwidth = 2;
240
        add(getJScrollPaneComments(), c);
247
            // some extra space
248
            addRow(propertiesPanel, c, new JLabel(" "), new JLabel(" "));
241 249

  
250
            c.anchor = GridBagConstraints.WEST;
251
            c.weightx = 0.0d;
252
            c.gridx = 0;
253
            c.gridy++;
254
            propertiesPanel.add(getJLabelComments(), c);
255

  
256
            c.fill = GridBagConstraints.BOTH;
257
            c.weightx = 1.0d;
258
            c.gridy++;
259
            c.gridwidth = 2;
260
            propertiesPanel.add(getJScrollPaneComments(), c);
261
        }
262
        return propertiesPanel;
242 263
    }
243 264

  
244 265

  
......
270 291

  
271 292
    private void updateSetAsDefaultCRSChk() {
272 293

  
273
        IProjection view_proj = this.jPanelProj.getCurProj();
294
        IProjection view_proj = this.getJPanelProj().getCurProj();
274 295
        String view_abbrev = view_proj.getAbrev();
275 296

  
276 297
        String curr_app_crs_def = getAppDefaultCRS();
......
284 305
        }
285 306
    }
286 307

  
287
    private void addRow(GridBagConstraints c, JComponent label, JComponent text) {
308
    private void addRow(JComponent panel, GridBagConstraints c, JComponent label, JComponent text) {
288 309
        c.anchor = GridBagConstraints.WEST;
289 310
        c.weightx = 0.0d;
290 311
        c.gridx = 0;
291 312
        c.gridy++;
292
        add(label, c);
313
        panel.add(label, c);
293 314

  
294 315
        c.fill = GridBagConstraints.HORIZONTAL;
295 316
        c.weightx = 1.0d;
296 317
        c.gridx = 1;
297
        add(text, c);
318
        panel.add(text, c);
298 319
    }
299 320

  
300 321

  
......
637 658
    }
638 659

  
639 660
    /**
661
     * @return ViewDocument
640 662
     * @see org.gvsig.andami.ui.mdiManager.SingletonWindow#getWindowModel()
641 663
     */
642 664
    public Object getWindowModel() {
......
644 666
    }
645 667

  
646 668

  
669
    /**
670
     * @return boolean
671
     */
647 672
    public boolean isAcceppted() {
648 673
        return isAcceppted;
649 674
    }

Also available in: Unified diff