Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.swing / org.gvsig.scripting.swing.impl / src / main / java / org / gvsig / scripting / swing / impl / composer / JRemoveHelpPanel.java @ 478

History | View | Annotate | Download (3.46 KB)

1
package org.gvsig.scripting.swing.impl.composer;
2

    
3
import java.awt.Dimension;
4
import java.awt.GridBagConstraints;
5
import java.awt.GridBagLayout;
6
import java.awt.Insets;
7
import java.awt.event.ActionEvent;
8
import java.awt.event.ActionListener;
9
import java.io.File;
10
import java.util.List;
11

    
12
import javax.swing.JComponent;
13
import javax.swing.JLabel;
14
import javax.swing.JList;
15
import javax.swing.JOptionPane;
16
import javax.swing.JPanel;
17
import javax.swing.JScrollPane;
18
import javax.swing.JTextField;
19
import javax.swing.ListSelectionModel;
20

    
21
import org.gvsig.scripting.ScriptingManager;
22
import org.gvsig.scripting.swing.api.ScriptingUIManager;
23
import org.gvsig.scripting.swing.impl.DialogPanel;
24

    
25

    
26
public class JRemoveHelpPanel extends JPanel implements DialogPanel, ActionListener{
27
        /**
28
         * 
29
         */
30
        private static final long serialVersionUID = -4299714728279029924L;
31
        private ScriptingUIManager uimanager;
32
        private ScriptingManager manager;
33
        private JRemoveHelpModel model;
34
        
35
        JTextField from = null;
36
        JTextField name =null;
37
        JList list = null;
38

    
39
        public JRemoveHelpPanel(ScriptingUIManager uimanager, JRemoveHelpModel model){
40
                this.uimanager = uimanager;
41
                this.manager = this.uimanager.getManager();
42
                this.model= model;
43
                
44
                model.setAction(JNewScriptModel.ACTION_CANCEL);
45
                
46
                setLayout(new GridBagLayout());
47
                GridBagConstraints gbc = new GridBagConstraints();
48
                gbc.insets = new Insets(25,10,0,5);
49
                gbc.weightx = 0.5;
50
                gbc.fill = GridBagConstraints.HORIZONTAL;
51
                gbc.gridx = 0;
52
                gbc.gridy = 0;        
53
                
54
//                List<File> helpRoots = this.manager.getHelpManager().getHelpRoots();
55
                
56
//                Object[] elements = this.manager.getHelpManager().getFolder().list();
57
//                
58
//                if(elements.length>0){
59
//                        list = new JList(elements); //data has type Object[]
60
//                        list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
61
//                        list.setLayoutOrientation(JList.VERTICAL);
62
//                        list.setVisibleRowCount(-1);
63
//                        JScrollPane listScroller = new JScrollPane(list);
64
//                        listScroller.setPreferredSize(new Dimension(250, 100));
65
//        
66
//                        add(new JLabel(this.uimanager.getTranslation("Javadoc_remove")+": "),gbc);
67
//                        gbc.insets = new Insets(10,10,15,5);
68
//                        gbc.gridy = 1;
69
//                        add(list, gbc);
70
//                }else{
71
                        gbc.insets = new Insets(25,10,15,5);
72
                        add(new JLabel(this.uimanager.getTranslation("no_Javadoc_remove")),gbc);
73
//                }
74
                        
75
        }
76

    
77
        public void actionAccept() {
78
                if(list!=null){
79
                        model.setHelps(list.getSelectedValues());
80
                }
81
                try {
82
                        model.validate();
83
                } catch (Exception e) {
84
                        JOptionPane.showMessageDialog(null, e.getMessage(), "Info", JOptionPane.INFORMATION_MESSAGE);
85
                        return;
86
                }
87
                
88
                model.setAction(JRenameModel.ACTION_ACCEPT);
89
                setVisible(false);
90
                
91
//                if(list!=null){
92
//                        //Borrar el directorio
93
//                        model.helps = list.getSelectedValues();
94
//                        for (int i=0;i<helps.length;i++){
95
//                                this.manager.getHelpManager().removeHelp(helps[i].toString());
96
//                        }
97
//                        //Recargar JavaHelp
98
//                        this.manager.getHelpManager().reloadHelp();
99
//                        JOptionPane.showMessageDialog(null, "Deleting JavaDocs successfully", "Info", JOptionPane.INFORMATION_MESSAGE);
100
//                }
101
//                setVisible(false);
102
//                uimanager.showWindow(uimanager.getAPIHelp(),"JavaDoc");
103
        }
104

    
105
        public void actionApply() {
106
        }
107

    
108
        public void actionCancel() {
109
                setVisible(false);
110
        }
111

    
112
        public boolean isVisibleAccept() {
113
                return true;
114
        }
115

    
116
        public boolean isVisibleApply() {
117
                return false;
118
        }
119

    
120
        public boolean isVisibleCancel() {
121
                return true;
122
        }
123

    
124
        public void actionPerformed(ActionEvent arg0) {
125
                
126

    
127
        }
128
        public JComponent getJComponent() {
129
                return this;
130
        }
131
        
132
}