Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.main / src / main / java / org / gvsig / tools / main / usability / UsabilityAction.java @ 270

History | View | Annotate | Download (2.81 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {}  {{Task}}
26
 */
27
package org.gvsig.tools.main.usability;
28

    
29
import java.awt.Component;
30

    
31
import javax.swing.BoxLayout;
32
import javax.swing.JButton;
33
import javax.swing.JComponent;
34
import javax.swing.JPanel;
35
import javax.swing.JTabbedPane;
36

    
37
import org.gvsig.tools.main.MainAction;
38
import org.gvsig.tools.swing.api.ToolsSwingLocator;
39
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
40

    
41
/**
42
 * Shows the panel of usability components.
43
 * 
44
 * @author 2010- C?sar Ordi?ana - gvSIG team
45
 */
46
public class UsabilityAction extends MainAction {
47

    
48
    private static final long serialVersionUID = 6471916708466720365L;
49

    
50
    private static final UsabilitySwingManager manager =
51
        ToolsSwingLocator.getUsabilitySwingManager();
52

    
53
    /**
54
     * @see MainAction#MainAction(JTabbedPane)
55
     */
56
    public UsabilityAction(JTabbedPane tabbedPane) {
57
        super("Usability", tabbedPane);
58
        putValue(SHORT_DESCRIPTION, "Usability components");
59
    }
60

    
61
    @Override
62
    protected JComponent createComponent() {
63
        JTabbedPane tabbedPane = new JTabbedPane();
64
        tabbedPane.setTabPlacement(JTabbedPane.RIGHT);
65

    
66
        tabbedPane.addTab("JButton", createJButtonComponent());
67

    
68
        return tabbedPane;
69
    }
70

    
71
    @Override
72
    protected String getComponentTitle() {
73
        return "Usability";
74
    }
75

    
76
    private Component createJButtonComponent() {
77
        // Create the container panel
78
        JPanel panel = new JPanel();
79
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
80
        // panel.setLayout(new GridLayout(18, 1));
81
        // panel.setLayout(new );
82

    
83
        // Create buttons with different sizes
84
        StringBuffer text = new StringBuffer("012");
85
        for (int i = 4; i < 22; i++) {
86
            text.append(String.valueOf(i % 10));
87
            JButton button = manager.createJButton(text.toString());
88
            panel.add(button);
89
        }
90

    
91
        return panel;
92
    }
93

    
94
}