1 package edu.psu.geovista.category;
2
3 /***
4 * Title:
5 * Description:
6 * Copyright: Copyright (c) 2001
7 * Company:
8 * @author
9 * @version 1.0
10 */
11
12 import java.awt.*;
13 import java.lang.*;
14 import java.util.*;
15 import java.awt.event.*;
16 import javax.swing.event.*;
17 import javax.swing.*;
18 import java.io.*;
19 import javax.swing.event.EventListenerList;
20 import java.awt.event.ActionEvent;
21 import java.awt.event.ActionListener;
22
23 public class SelectionRecords extends JPanel {
24
25 private static String DEFAULT_USERINFO = "new";
26 private static int DEFAULT_VERSION = 0;
27 private static String DEFAULT_THEORY = "not clear";
28 private static String DEFAULT_EXAMPLE_TYPE = "ideal";
29
30 private String userInfo = DEFAULT_USERINFO;
31 private int version = DEFAULT_VERSION;
32 private String theory = DEFAULT_THEORY;
33 private String exampleType = DEFAULT_EXAMPLE_TYPE;
34
35 private String userInfoStr = "User Info:";
36 private String versionStr = "Version (time) Info:";
37 private String theoryStr = "Theory Used:";
38 private String exampleTypeStr = "Example Type:";
39
40 private JLabel userInfoLabel;
41 private JLabel versionLabel;
42 private JLabel theoryLabel;
43 private JLabel exampleTypeLabel;
44
45 private JTextField userInfoField;
46 private JTextField versionField;
47 private JTextField theoryField;
48 private JTextField exampleTypeField;
49
50 private String entityInputStr = "Input records entities:";
51 private JLabel entityLabel;
52 private int[] selection; //one selection record.
53 private int[] classification;
54 private Object[] categoryRecord; //one record for a selection or classification event.
55 private Vector categoryRecords;
56
57 public SelectionRecords() {
58 super();
59 this.setLayout(new BorderLayout());
60 this.setSize(300, 300);
61 init();
62 }
63
64 public void setSelection(int[] selection){
65 this.selection = selection;
66 }
67
68 public int[] getSelection(){
69 return this.selection;
70 }
71
72 public void setClassification(int[] classes){
73 this.classification = classes;
74 }
75
76 public int[] getClassification(){
77 return this.classification;
78 }
79
80 public void setCategoryRecords (Vector categoryRecords){
81 this.categoryRecords = categoryRecords;
82 }
83
84 public Vector getCategoryRecords (){
85 return this.categoryRecords;
86 }
87
88 void init(){
89 this.categoryRecord = new Object[6];
90
91 JButton okButton;
92 JButton cancelButton;
93 okButton = new JButton("SAVE");
94 okButton.addActionListener(new java.awt.event.ActionListener() {
95 /***
96 * put your documentation comment here
97 * @param e
98 */
99 public void actionPerformed (ActionEvent e) {
100 okButton_actionPerformed(e);
101 }
102 });
103
104 cancelButton = new JButton("CANCEL");;
105 cancelButton.addActionListener(new java.awt.event.ActionListener() {
106 public void actionPerformed(ActionEvent e) {
107 cancelButton_actionPerformed(e);
108 }
109 });
110
111 entityLabel = new JLabel(entityInputStr);
112
113 userInfoLabel = new JLabel(userInfoStr);
114 versionLabel = new JLabel(versionStr);
115 theoryLabel = new JLabel(theoryStr);
116 exampleTypeLabel = new JLabel(exampleTypeStr);
117
118 userInfoField = new JTextField(16);
119 versionField = new JTextField(8);
120 theoryField = new JTextField(8);
121 exampleTypeField = new JTextField(8);
122
123 userInfoField.setText(userInfo);
124 versionField.setText((new Integer(version)).toString());
125 theoryField.setText(theory);
126 exampleTypeField.setText(exampleType);
127
128 JPanel userInfoPanel = new JPanel(new GridLayout(4,2));
129 userInfoPanel.add(userInfoLabel);
130 userInfoPanel.add(userInfoField);
131 userInfoPanel.add(versionLabel);
132 userInfoPanel.add(versionField);
133 userInfoPanel.add(theoryLabel);
134 userInfoPanel.add(theoryField);
135 userInfoPanel.add(exampleTypeLabel);
136 userInfoPanel.add(exampleTypeField);
137
138 JPanel buttonPanel = new JPanel (new BorderLayout());
139 buttonPanel.add(okButton, BorderLayout.WEST);
140 buttonPanel.add(cancelButton, BorderLayout.EAST);
141
142 this.add(entityLabel, BorderLayout.NORTH);
143 this.add(userInfoPanel, BorderLayout.CENTER);
144 this.add(buttonPanel, BorderLayout.SOUTH);
145
146 this.validate();
147 }
148
149 private void okButton_actionPerformed (ActionEvent e) {
150 this.userInfo = this.userInfoField.getText();
151 this.version = Integer.parseInt(this.versionField.getText());
152 this.theory = this.theoryField.getText();
153 this.exampleType = this.exampleTypeField.getText();
154 this.categoryRecord[0] = this.userInfo;
155 this.categoryRecord[1] = new Integer(this.version);
156 this.categoryRecord[2] = this.theory;
157 this.categoryRecord[3] = this.exampleType;
158 this.categoryRecord[4] = this.selection;
159 this.categoryRecord[5] = this.classification;
160 }
161
162 void cancelButton_actionPerformed(ActionEvent e){
163 //System.exit(0);
164 }
165
166 }
This page was automatically generated by Maven