1 package org.xmlhammer.gui.output;
2
3 import javax.swing.JLabel;
4 import javax.swing.JTextField;
5
6 import org.bounce.FormLayout;
7 import org.xmlhammer.model.project.Type;
8
9 public class TypePanel extends DetailsPanel {
10
11 private static final long serialVersionUID = -845135182604250202L;
12
13 private JTextField namespaceField = null;
14 private JTextField nameField = null;
15
16 public TypePanel() {
17 super(new FormLayout(5,5), "type");
18
19 nameField = new JTextField();
20 nameField.setEditable(false);
21 add(new JLabel("Name:"), LABEL_CONSTRAINTS);
22 add(nameField, FormLayout.RIGHT_FILL);
23
24 namespaceField = new JTextField();
25 namespaceField.setEditable(false);
26 add(new JLabel("Namespace:"), LABEL_CONSTRAINTS);
27 add(namespaceField, FormLayout.RIGHT_FILL);
28 }
29
30 public void setType( Type type) {
31 if (type != null) {
32 namespaceField.setText(type.getNamespace());
33 nameField.setText(type.getName());
34 } else {
35 namespaceField.setText("");
36 nameField.setText("");
37 }
38
39 nameField.setCaretPosition(0);
40 namespaceField.setCaretPosition(0);
41 }
42 }