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

View differences:

UsabilityAction.java
1 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
*/
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 22

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

  
29 29
import java.awt.Component;
......
45 45
 */
46 46
public class UsabilityAction extends MainAction {
47 47

  
48
	private static final long serialVersionUID = 6471916708466720365L;
48
    private static final long serialVersionUID = 6471916708466720365L;
49 49

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

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

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

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

  
68
		return tabbedPane;
69
	}
68
        return tabbedPane;
69
    }
70 70

  
71
	@Override
72
	protected String getComponentTitle() {
73
		return "Usability";
74
	}
71
    @Override
72
    protected String getComponentTitle() {
73
        return "Usability";
74
    }
75 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
	}
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 );
93 82

  
94
}
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
}

Also available in: Unified diff