svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / toolListeners / snapping / gui / DefaultConfigurePanel.java @ 40558
History | View | Annotate | Download (3.99 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.app.project.documents.view.toolListeners.snapping.gui; |
25 |
|
26 |
import java.awt.event.ActionListener; |
27 |
|
28 |
import javax.swing.JButton; |
29 |
import javax.swing.JDialog; |
30 |
import javax.swing.JLabel; |
31 |
import javax.swing.JPanel; |
32 |
|
33 |
import org.gvsig.andami.PluginServices; |
34 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
35 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
36 |
import org.gvsig.fmap.mapcontrol.tools.snapping.snappers.ISnapper; |
37 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
38 |
|
39 |
|
40 |
public class DefaultConfigurePanel extends JPanel implements IWindow { |
41 |
private ISnapper snapper;
|
42 |
private JLabel lblColor = null; |
43 |
private JButton bColor = null; |
44 |
private WindowInfo wi=null; |
45 |
private AcceptCancelPanel acceptCancelPanel;
|
46 |
/**
|
47 |
* This is the default constructor
|
48 |
*/
|
49 |
public DefaultConfigurePanel() {
|
50 |
super();
|
51 |
initialize(); |
52 |
} |
53 |
|
54 |
/**
|
55 |
* This method initializes this
|
56 |
*
|
57 |
* @return void
|
58 |
*/
|
59 |
private void initialize() { |
60 |
lblColor = new JLabel(); |
61 |
lblColor.setText("color");
|
62 |
this.setSize(269, 91); |
63 |
this.add(lblColor, null); |
64 |
this.add(getBColor(), null); |
65 |
this.add(getPAcceptCancel(),null); |
66 |
} |
67 |
public void setSnapper(ISnapper snapper) { |
68 |
this.snapper=snapper;
|
69 |
//((AbstractSnapper)this.snapper).setColor(Color.blue);
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* This method initializes bColor
|
74 |
*
|
75 |
* @return javax.swing.JButton
|
76 |
*/
|
77 |
private JButton getBColor() { |
78 |
if (bColor == null) { |
79 |
bColor = new JButton(); |
80 |
bColor.setText("...");
|
81 |
} |
82 |
return bColor;
|
83 |
} |
84 |
|
85 |
protected AcceptCancelPanel getPAcceptCancel() {
|
86 |
if (acceptCancelPanel==null) { |
87 |
ActionListener okAction = new java.awt.event.ActionListener() { |
88 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
89 |
|
90 |
if (PluginServices.getMainFrame() == null) { |
91 |
((JDialog) (getParent().getParent().getParent()
|
92 |
.getParent())).dispose(); |
93 |
} else {
|
94 |
PluginServices.getMDIManager().closeWindow(DefaultConfigurePanel.this); |
95 |
} |
96 |
} |
97 |
}; |
98 |
ActionListener cancelAction = new java.awt.event.ActionListener() { |
99 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
100 |
if (PluginServices.getMainFrame() != null) { |
101 |
PluginServices.getMDIManager().closeWindow(DefaultConfigurePanel.this); |
102 |
} else {
|
103 |
((JDialog) (getParent().getParent().getParent()
|
104 |
.getParent())).dispose(); |
105 |
} |
106 |
} |
107 |
}; |
108 |
acceptCancelPanel=new AcceptCancelPanel(okAction,cancelAction);
|
109 |
|
110 |
} |
111 |
return acceptCancelPanel;
|
112 |
} |
113 |
|
114 |
public WindowInfo getWindowInfo() {
|
115 |
if (wi==null) { |
116 |
wi=new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
|
117 |
wi.setWidth(this.getWidth());
|
118 |
wi.setHeight(this.getHeight());
|
119 |
wi.setTitle(PluginServices.getText(this,"propiedades")); |
120 |
} |
121 |
return wi;
|
122 |
} |
123 |
|
124 |
public Object getWindowProfile() { |
125 |
return WindowInfo.DIALOG_PROFILE;
|
126 |
} |
127 |
|
128 |
} // @jve:decl-index=0:visual-constraint="10,10"
|