summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java41
1 files changed, 24 insertions, 17 deletions
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java
index e7dc8bc..742d1b4 100755..100644
--- a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java
+++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java
@@ -25,7 +25,7 @@ import com.c2kernel.utils.Language;
**************************************************************************/
public class ArrayEditField extends StringEditField implements ActionListener {
-
+
Box arrayBox;
Box expandBox;
Box editBox;
@@ -34,20 +34,20 @@ public class ArrayEditField extends StringEditField implements ActionListener {
JButton expandButton;
JButton contractButton;
JButton addButton;
- JButton removeButton;
+ JButton removeButton;
ArrayTableModel arrayModel;
JLabel arrayLabel = new JLabel("Array");
boolean panelShown = false;
boolean readOnly = false;
-
+
public ArrayEditField(SimpleType type) {
- arrayBox = Box.createVerticalBox();
+ arrayBox = Box.createVerticalBox();
arrayBox.add(arrayLabel);
arrayButton = new JButton(Language.translate("Show"));
arrayButton.addActionListener(this);
arrayButton.setActionCommand("toggle");
arrayBox.add(arrayButton);
-
+
expandBox = Box.createHorizontalBox();
expandButton = new JButton(">>");
expandButton.setToolTipText("Increase the number of columns displaying this array");
@@ -58,15 +58,15 @@ public class ArrayEditField extends StringEditField implements ActionListener {
contractButton.setToolTipText("Decrease the number of columns displaying this array");
contractButton.addActionListener(this);
contractButton.setActionCommand("contract");
-
+
expandBox.add(contractButton);
expandBox.add(Box.createHorizontalGlue());
expandBox.add(expandButton);
-
+
arrayModel = new ArrayTableModel(type);
if (arrayModel.getColumnCount() < 2) contractButton.setEnabled(false);
arrayView = new JScrollPane(new JTable(arrayModel));
-
+
editBox = Box.createHorizontalBox();
addButton = new JButton("+");
addButton.setToolTipText("Add a field to the end of this array");
@@ -75,7 +75,7 @@ public class ArrayEditField extends StringEditField implements ActionListener {
removeButton = new JButton("-");
removeButton.setToolTipText("Remove the last field from this array");
removeButton.addActionListener(this);
- removeButton.setActionCommand("remove");
+ removeButton.setActionCommand("remove");
editBox.add(addButton);
editBox.add(Box.createHorizontalGlue());
editBox.add(removeButton);
@@ -83,32 +83,37 @@ public class ArrayEditField extends StringEditField implements ActionListener {
/**
*
*/
- public String getDefaultValue() {
+ @Override
+ public String getDefaultValue() {
return "";
}
/**
*
*/
- public String getText() {
+ @Override
+ public String getText() {
return arrayModel.getData();
}
/**
*
*/
- public void setText(String text) {
+ @Override
+ public void setText(String text) {
arrayModel.setData(text);
arrayLabel.setText("Array ("+arrayModel.getArrayLength()+" values)");
}
/**
*
*/
- public Component getControl() {
+ @Override
+ public Component getControl() {
return arrayBox;
}
/**
*
*/
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("toggle")) {
arrayBox.removeAll();
if (panelShown) {
@@ -122,7 +127,7 @@ public class ArrayEditField extends StringEditField implements ActionListener {
arrayBox.add(Box.createVerticalStrut(7));
arrayBox.add(arrayButton);
arrayBox.add(Box.createVerticalStrut(7));
- arrayBox.add(expandBox);
+ arrayBox.add(expandBox);
arrayBox.add(Box.createVerticalStrut(7));
arrayBox.add(arrayView);
if (!readOnly) arrayBox.add(editBox);
@@ -138,7 +143,7 @@ public class ArrayEditField extends StringEditField implements ActionListener {
else if (e.getActionCommand().equals("remove")) {
arrayModel.removeField();
arrayLabel.setText("Array ("+arrayModel.getArrayLength()+" values)");
- }
+ }
else {
int currentCols = arrayModel.getColumnCount();
if (e.getActionCommand().equals("extend"))
@@ -154,10 +159,12 @@ public class ArrayEditField extends StringEditField implements ActionListener {
/**
*
*/
- public JTextComponent makeTextField() {
+ @Override
+ public JTextComponent makeTextField() {
// not used by array
return null;
}
+ @Override
public void setEditable(boolean editable) {
readOnly = !editable;
arrayModel.setReadOnly(!readOnly);