Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / project / documents / view / snapping / gui / DefaultConfigurePanel.java @ 10626

History | View | Annotate | Download (2.84 KB)

1
package com.iver.cit.gvsig.project.documents.view.snapping.gui;
2

    
3
import java.awt.event.ActionListener;
4

    
5
import javax.swing.JButton;
6
import javax.swing.JDialog;
7
import javax.swing.JLabel;
8
import javax.swing.JPanel;
9

    
10
import org.gvsig.gui.beans.AcceptCancelPanel;
11

    
12
import com.iver.andami.PluginServices;
13
import com.iver.andami.ui.mdiManager.IWindow;
14
import com.iver.andami.ui.mdiManager.WindowInfo;
15
import com.iver.cit.gvsig.project.documents.view.snapping.ISnapper;
16

    
17
public class DefaultConfigurePanel extends JPanel implements IWindow {
18
        private ISnapper snapper;
19
        private JLabel lblColor = null;
20
        private JButton bColor = null;
21
        private WindowInfo wi=null;
22
        private AcceptCancelPanel acceptCancelPanel;
23
        /**
24
         * This is the default constructor
25
         */
26
        public DefaultConfigurePanel() {
27
                super();
28
                initialize();
29
        }
30

    
31
        /**
32
         * This method initializes this
33
         *
34
         * @return void
35
         */
36
        private void initialize() {
37
                lblColor = new JLabel();
38
                lblColor.setText("color");
39
                this.setSize(269, 91);
40
                this.add(lblColor, null);
41
                this.add(getBColor(), null);
42
                this.add(getPAcceptCancel(),null);
43
        }
44
        public void setSnapper(ISnapper snapper) {
45
                this.snapper=snapper;
46
                //((AbstractSnapper)this.snapper).setColor(Color.blue);
47
        }
48

    
49
        /**
50
         * This method initializes bColor
51
         *
52
         * @return javax.swing.JButton
53
         */
54
        private JButton getBColor() {
55
                if (bColor == null) {
56
                        bColor = new JButton();
57
                        bColor.setText("...");
58
                }
59
                return bColor;
60
        }
61

    
62
        protected AcceptCancelPanel getPAcceptCancel() {
63
                if (acceptCancelPanel==null) {
64
                        ActionListener okAction = new java.awt.event.ActionListener() {
65
                                public void actionPerformed(java.awt.event.ActionEvent e) {
66

    
67
                                        if (PluginServices.getMainFrame() == null) {
68
                        ((JDialog) (getParent().getParent().getParent()
69
                                .getParent())).dispose();
70
                    } else {
71
                        PluginServices.getMDIManager().closeWindow(DefaultConfigurePanel.this);
72
                    }
73
                                }
74
                        };
75
                        ActionListener cancelAction = new java.awt.event.ActionListener() {
76
                                public void actionPerformed(java.awt.event.ActionEvent e) {
77
                    if (PluginServices.getMainFrame() != null) {
78
                        PluginServices.getMDIManager().closeWindow(DefaultConfigurePanel.this);
79
                    } else {
80
                        ((JDialog) (getParent().getParent().getParent()
81
                                        .getParent())).dispose();
82
                    }
83
                                }
84
                        };
85
                        acceptCancelPanel=new AcceptCancelPanel(okAction,cancelAction);
86

    
87
                }
88
                return acceptCancelPanel;
89
        }
90

    
91
        public WindowInfo getWindowInfo() {
92
                if (wi==null) {
93
                        wi=new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
94
                        wi.setWidth(this.getWidth());
95
                        wi.setHeight(this.getHeight());
96
                        wi.setTitle(PluginServices.getText(this,"propiedades"));
97
                }
98
                return wi;
99
        }
100

    
101
}  //  @jve:decl-index=0:visual-constraint="10,10"