diff options
Diffstat (limited to 'source/com/c2kernel/gui/tabs/outcome/form/field')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/ArrayEditField.java | 41 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java | 39 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/BooleanEditField.java | 37 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java | 38 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/DecimalEditField.java | 45 | ||||
| -rwxr-xr-x | source/com/c2kernel/gui/tabs/outcome/form/field/FieldConstraints.java | 51 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/ImageEditField.java | 10 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/IntegerEditField.java | 39 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/outcome/form/field/ListOfValues.java | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/LongStringEditField.java | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java | 62 |
11 files changed, 190 insertions, 184 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);
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java index c7934c0..341c33a 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java @@ -23,10 +23,10 @@ import com.c2kernel.utils.Language; public class ArrayTableModel extends AbstractTableModel {
ArrayList<Object> contents = new ArrayList<Object>();
- Class type;
+ Class<?> type;
int numCols = 1;
boolean readOnly = false;
-
+
public ArrayTableModel(SimpleType type) {
super();
this.type = OutcomeStructure.getJavaClass(type.getTypeCode());
@@ -35,7 +35,7 @@ public class ArrayTableModel extends AbstractTableModel { public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
-
+
public void setData(String data) {
contents.clear();
StringTokenizer tok = new StringTokenizer(data);
@@ -43,16 +43,16 @@ public class ArrayTableModel extends AbstractTableModel { contents.add(OutcomeStructure.getTypedValue(tok.nextToken(), type));
fireTableStructureChanged();
}
-
+
public String getData() {
if (contents.size() == 0) return "";
- Iterator iter = contents.iterator();
+ Iterator<Object> iter = contents.iterator();
StringBuffer result = new StringBuffer(iter.next().toString());
while (iter.hasNext())
result.append(" ").append(iter.next().toString());
return result.toString();
}
-
+
public void addField() {
contents.add(OutcomeStructure.getTypedValue("", type));
fireTableStructureChanged();
@@ -62,45 +62,52 @@ public class ArrayTableModel extends AbstractTableModel { contents.remove(contents.size()-1);
fireTableStructureChanged();
}
-
- public Class<?> getColumnClass(int columnIndex) {
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
return type;
}
- public int getColumnCount() {
+ @Override
+ public int getColumnCount() {
return numCols;
}
-
+
public int getArrayLength() {
return contents.size();
}
-
+
public void setColumnCount(int newCols) {
numCols = newCols;
fireTableStructureChanged();
}
- public String getColumnName(int column) {
+ @Override
+ public String getColumnName(int column) {
return Language.translate("Value");
}
- public int getRowCount() {
+ @Override
+ public int getRowCount() {
return (contents.size()/numCols)+1;
}
- public Object getValueAt(int arg0, int arg1) {
+ @Override
+ public Object getValueAt(int arg0, int arg1) {
int index = arg1+(arg0 * numCols);
if (index >= contents.size())
return null;
return contents.get(arg1+(arg0 * numCols));
}
- public boolean isCellEditable(int rowIndex, int columnIndex) {
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
if (columnIndex+(rowIndex*numCols) > contents.size()-1) return false;
return !readOnly;
}
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
contents.set(columnIndex+(rowIndex*numCols), aValue);
}
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/BooleanEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/BooleanEditField.java index 5776f73..c831eb4 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/BooleanEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/BooleanEditField.java @@ -17,51 +17,58 @@ import com.c2kernel.utils.Logger; * All rights reserved.
**************************************************************************/
public class BooleanEditField extends StringEditField {
-
+
JCheckBox checkbox;
-
+
public BooleanEditField() {
checkbox = new JCheckBox();
checkbox.setSelected(false);
checkbox.addFocusListener(this);
}
-
- public String getText() {
+
+ @Override
+ public String getText() {
return String.valueOf(checkbox.isSelected());
}
- public void setText(String text) {
+ @Override
+ public void setText(String text) {
boolean newState = false;
try {
newState = Boolean.valueOf(text).booleanValue();
} catch (Exception ex) {
Logger.error("Invalid value for checkbox: "+text);
}
- checkbox.setSelected(newState);
+ checkbox.setSelected(newState);
}
- public void setEditable(boolean editable) {
+ @Override
+ public void setEditable(boolean editable) {
super.setEditable(editable);
checkbox.setEnabled(editable);
}
- public Component getControl() {
+ @Override
+ public Component getControl() {
return checkbox;
}
-
- public String getDefaultValue() {
+
+ @Override
+ public String getDefaultValue() {
return "false";
- }
-
+ }
+
/** don't reserve the item finder for a boolean */
- public void focusGained(FocusEvent e) {
+ @Override
+ public void focusGained(FocusEvent e) {
helpPane.setHelp(name, helpText);
}
-
+
/**
*
*/
- public JTextComponent makeTextField() {
+ @Override
+ public JTextComponent makeTextField() {
// not used by boolean
return null;
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java index 303a870..ef56046 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java @@ -19,9 +19,9 @@ import com.c2kernel.scripting.Script; import com.c2kernel.utils.Logger;
/*******************************************************************************
- *
+ *
* $Revision: 1.4 $ $Date: 2005/08/16 13:59:56 $
- *
+ *
* Copyright (C) 2003 CERN - European Organization for Nuclear Research All
* rights reserved.
******************************************************************************/
@@ -40,28 +40,33 @@ public class ComboField extends StringEditField { this.listNode = listNode;
createLOV();
}
-
- public String getDefaultValue() {
+
+ @Override
+ public String getDefaultValue() {
if (vals.getDefaultKey() != null)
return vals.get(vals.getDefaultKey()).toString();
else
return "";
}
- public String getText() {
+ @Override
+ public String getText() {
return vals.get(comboModel.getSelectedItem()).toString();
}
- public JTextComponent makeTextField() {
+ @Override
+ public JTextComponent makeTextField() {
// not used by this control
return null;
}
- public void setText(String text) {
+ @Override
+ public void setText(String text) {
comboModel.setSelectedItem(text);
}
- public Component getControl() {
+ @Override
+ public Component getControl() {
return comboField;
}
@@ -76,12 +81,12 @@ public class ComboField extends StringEditField { if (lovType.equals("PathList"))
populateLOVFromLDAP(param);
}
-
+
// handle enumerations
// TODO: should be ANDed with above results
if (content.hasFacet(Facet.ENUMERATION)) {
//ListOfValues andList = new ListOfValues();
- Enumeration enums = content.getFacets(Facet.ENUMERATION);
+ Enumeration<?> enums = content.getFacets(Facet.ENUMERATION);
while (enums.hasMoreElements()) {
Facet thisEnum = (Facet)enums.nextElement();
vals.put(thisEnum.getValue(), thisEnum.getValue(), false);
@@ -99,8 +104,8 @@ public class ComboField extends StringEditField { */
private void populateLOVFromLDAP(String param) {
// TODO '/root/path;prop=val;prop=val'
-
-
+
+
}
private void populateLOVFromScript(String scriptName) {
@@ -116,12 +121,14 @@ public class ComboField extends StringEditField { }
}
- public void setDecl(AttributeDecl model) throws StructuralException {
+ @Override
+ public void setDecl(AttributeDecl model) throws StructuralException {
super.setDecl(model);
createLOV();
}
- public void setDecl(ElementDecl model) throws StructuralException {
+ @Override
+ public void setDecl(ElementDecl model) throws StructuralException {
super.setDecl(model);
createLOV();
}
@@ -130,7 +137,8 @@ public class ComboField extends StringEditField { *
*/
- public void setEditable(boolean editable) {
+ @Override
+ public void setEditable(boolean editable) {
comboField.setEditable(editable);
}
}
\ No newline at end of file diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/DecimalEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/DecimalEditField.java index d77dff3..fabaed8 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/DecimalEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/DecimalEditField.java @@ -26,44 +26,50 @@ public class DecimalEditField extends StringEditField { field.setToolTipText("This field must contains a decimal number e.g. 3.14159265");
}
- public String getText() {
+ @Override
+ public String getText() {
return field.getText();
}
- public void setText(String text) {
+ @Override
+ public void setText(String text) {
field.setText(text);
}
-
- public String getDefaultValue() {
+
+ @Override
+ public String getDefaultValue() {
return "0.0";
- }
-
- public JTextComponent makeTextField() {
+ }
+
+ @Override
+ public JTextComponent makeTextField() {
return new DecimalTextField();
}
-
+
private class DecimalTextField extends JTextField {
public DecimalTextField() {
super();
setHorizontalAlignment(RIGHT);
}
- protected Document createDefaultModel() {
+ @Override
+ protected Document createDefaultModel() {
return new Decimal();
}
}
-
+
private class Decimal extends PlainDocument {
BigDecimal currentVal = new BigDecimal(0.0);
- public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+ @Override
+ public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if (str == null || str.equals("")) {
return;
}
-
+
String proposedResult = null;
if (getLength() == 0) {
@@ -73,23 +79,24 @@ public class DecimalEditField extends StringEditField { currentBuffer.insert(offs, str);
proposedResult = currentBuffer.toString();
}
-
+
try {
currentVal = parse(proposedResult);
super.insertString(offs, str, a);
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
}
-
+
}
- public void remove(int offs, int len) throws BadLocationException {
+ @Override
+ public void remove(int offs, int len) throws BadLocationException {
String currentText = this.getText(0, getLength());
String beforeOffset = currentText.substring(0, offs);
String afterOffset = currentText.substring(len + offs, currentText.length());
String proposedResult = beforeOffset + afterOffset;
-
+
if (proposedResult.length() == 0) { // empty is ok
super.remove(offs, len);
return;
@@ -97,17 +104,17 @@ public class DecimalEditField extends StringEditField { try {
currentVal = parse(proposedResult);
super.remove(offs, len);
- } catch (Exception e) {
+ } catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
}
- }
+ }
public BigDecimal parse(String proposedResult) throws NumberFormatException {
BigDecimal value = new BigDecimal(0);
if ( proposedResult.length() != 0) {
- value = new BigDecimal(proposedResult);
+ value = new BigDecimal(proposedResult);
}
return value;
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/FieldConstraints.java b/source/com/c2kernel/gui/tabs/outcome/form/field/FieldConstraints.java deleted file mode 100755 index d09cd91..0000000 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/FieldConstraints.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.c2kernel.gui.tabs.outcome.form.field;
-
-import java.util.Enumeration;
-
-import org.exolab.castor.types.AnyNode;
-import org.exolab.castor.xml.schema.Annotation;
-import org.exolab.castor.xml.schema.AppInfo;
-import org.exolab.castor.xml.schema.XMLType;
-
-/**************************************************************************
- *
- * $Revision: 1.1 $
- * $Date: 2005/04/26 06:48:12 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-public class FieldConstraints {
-
- XMLType content;
- ListOfValues lov;
- int rows = 1;
-
- public FieldConstraints(XMLType content) {
- this.content = content;
- Enumeration e = content.getAnnotations();
- while (e.hasMoreElements()) {
- Annotation note = (Annotation)e.nextElement();
- for (Enumeration f = note.getAppInfo(); f.hasMoreElements();) {
- addAppInfo((AppInfo)f.nextElement());
- }
- }
- }
-
- private void addAppInfo(AppInfo element) {
- Enumeration e = element.getObjects();
- while (e.hasMoreElements()) {
- AnyNode node = (AnyNode)e.nextElement();
-
- }
- }
-
- public ListOfValues getLOV() {
- return lov;
- }
-
- public int getRows() {
- return rows;
- }
-}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ImageEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ImageEditField.java index b0bb079..716a073 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ImageEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ImageEditField.java @@ -31,15 +31,17 @@ public class ImageEditField extends StringEditField { static JFileChooser chooser = new JFileChooser();
static {
chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {
+ @Override
public String getDescription() {
return "Image Files";
}
+ @Override
public boolean accept(File f) {
return (f.isDirectory() || (f.isFile() && (f.getName()
.endsWith(".gif")
|| f.getName().endsWith(".jpg")
- || f.getName().endsWith(".jpeg")
+ || f.getName().endsWith(".jpeg")
|| f.getName().endsWith(".png"))));
}
});
@@ -51,6 +53,7 @@ public class ImageEditField extends StringEditField { imagePanel = Box.createVerticalBox();
browseButton = new JButton("Browse");
browseButton.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
int returnVal = chooser.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
@@ -77,18 +80,22 @@ public class ImageEditField extends StringEditField { imagePanel.add(browseButton);
}
+ @Override
public String getDefaultValue() {
return "";
}
+ @Override
public Component getControl() {
return imagePanel;
}
+ @Override
public String getText() {
return encodedImage == null ? "" : encodedImage;
}
+ @Override
public void setText(String text) {
encodedImage = text;
if (text != null && text.length() > 0) {
@@ -98,6 +105,7 @@ public class ImageEditField extends StringEditField { }
}
+ @Override
public void setEditable(boolean editable) {
browseButton.setVisible(false);
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/IntegerEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/IntegerEditField.java index 7c858a4..e2c3df4 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/IntegerEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/IntegerEditField.java @@ -19,44 +19,50 @@ import javax.swing.text.PlainDocument; * All rights reserved.
**************************************************************************/
public class IntegerEditField extends StringEditField {
-
+
public IntegerEditField() {
super();
field.setToolTipText("This field must contains a whole number e.g. 3");
}
- public String getText() {
+ @Override
+ public String getText() {
return field.getText();
}
- public void setText(String text) {
+ @Override
+ public void setText(String text) {
field.setText(text);
}
- public String getDefaultValue() {
+ @Override
+ public String getDefaultValue() {
return "0";
}
-
- public JTextComponent makeTextField() {
+
+ @Override
+ public JTextComponent makeTextField() {
return new IntegerTextField();
}
-
+
private class IntegerTextField extends JTextField {
public IntegerTextField() {
super();
setHorizontalAlignment(RIGHT);
}
- protected Document createDefaultModel() {
+ @Override
+ protected Document createDefaultModel() {
return new IntegerDocument();
}
}
-
+
private class IntegerDocument extends PlainDocument {
BigInteger currentVal = new BigInteger("0");
- public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+ @Override
+ public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if (str == null || str.equals("")) {
return;
@@ -71,17 +77,18 @@ public class IntegerEditField extends StringEditField { currentBuffer.insert(offs, str);
proposedResult = currentBuffer.toString();
}
-
+
try {
currentVal = parse(proposedResult);
super.insertString(offs, str, a);
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
}
-
+
}
- public void remove(int offs, int len) throws BadLocationException {
+ @Override
+ public void remove(int offs, int len) throws BadLocationException {
String currentText = this.getText(0, getLength());
String beforeOffset = currentText.substring(0, offs);
@@ -95,17 +102,17 @@ public class IntegerEditField extends StringEditField { try {
currentVal = parse(proposedResult);
super.remove(offs, len);
- } catch (Exception e) {
+ } catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
}
- }
+ }
public BigInteger parse(String proposedResult) throws NumberFormatException {
BigInteger value = new BigInteger("0");
if ( proposedResult.length() != 0) {
- value = new BigInteger(proposedResult);
+ value = new BigInteger(proposedResult);
}
return value;
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ListOfValues.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ListOfValues.java index 3204766..f95c5c9 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ListOfValues.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ListOfValues.java @@ -18,14 +18,14 @@ public class ListOfValues extends HashMap<String, Object> { public ListOfValues() {
super();
}
-
+
public String put(String key, String value, boolean isDefaultKey) {
if (isDefaultKey) defaultKey = key;
return (String)super.put(key, value);
}
-
+
public String getDefaultKey() {
return defaultKey;
}
-
+
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/LongStringEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/LongStringEditField.java index b782c65..140d7f2 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/LongStringEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/LongStringEditField.java @@ -26,10 +26,12 @@ public class LongStringEditField extends StringEditField { field.setToolTipText(Language.translate("This field can contain any string."));
}
- public JTextComponent makeTextField() {
+ @Override
+ public JTextComponent makeTextField() {
return new JTextArea();
}
- public Component getControl() {
+ @Override
+ public Component getControl() {
if (bigScroller == null) {
bigScroller = new JScrollPane(field);
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java index 310ee2e..a9b55a4 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java @@ -42,33 +42,33 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { HelpPane helpPane;
String helpText;
protected JTextComponent field;
-
+
boolean isValid = true;
boolean editable = true;
String name;
-
- public StringEditField() {
+
+ public StringEditField() {
field = makeTextField();
if (field != null)
field.addFocusListener(this);
}
-
+
private static StringEditField getFieldForType(SimpleType type) {
// handle lists special
- if (type instanceof ListType)
+ if (type instanceof ListType)
return new ArrayEditField(type.getBuiltInBaseType());
// is a combobox
if (type.hasFacet(Facet.ENUMERATION))
return new ComboField(type, null);
//find LOVscript
- Enumeration e = type.getAnnotations();
+ Enumeration<?> e = type.getAnnotations();
while (e.hasMoreElements()) {
Annotation note = (Annotation)e.nextElement();
- for (Enumeration f = note.getAppInfo(); f.hasMoreElements();) {
+ for (Enumeration<?> f = note.getAppInfo(); f.hasMoreElements();) {
AppInfo thisAppInfo = (AppInfo)f.nextElement();
- for (Enumeration g = thisAppInfo.getObjects(); g.hasMoreElements();) {
+ for (Enumeration<?> g = thisAppInfo.getObjects(); g.hasMoreElements();) {
AnyNode appInfoNode = (AnyNode)g.nextElement();
if (appInfoNode.getLocalName().equals("ScriptList")
|| appInfoNode.getLocalName().equals("LDAPList")) {
@@ -82,12 +82,12 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { if (type.getLength()!=null) length = type.getLength().longValue();
else if (type.getMaxLength()!=null) length = type.getMaxLength().longValue();
else if (type.getMinLength()!=null) length = type.getMinLength().longValue();
-
+
// find base type if derived
if (!(type.isBuiltInType()))
- type = type.getBuiltInBaseType();
+ type = type.getBuiltInBaseType();
// else derive the class
- Class contentClass = OutcomeStructure.getJavaClass(type.getTypeCode());
+ Class<?> contentClass = OutcomeStructure.getJavaClass(type.getTypeCode());
// disable list edits for the moment
if (contentClass.equals(Boolean.class))
return new BooleanEditField();
@@ -96,7 +96,7 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { else if (contentClass.equals(BigDecimal.class))
return new DecimalEditField();
else if (contentClass.equals(ImageIcon.class))
- return new ImageEditField();
+ return new ImageEditField();
else if (length > 60)
return new LongStringEditField();
else return new StringEditField();
@@ -107,7 +107,7 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { newField.setDecl(model);
return newField;
}
-
+
public static StringEditField getEditField(ElementDecl model) throws StructuralException {
try {
XMLType baseType = model.getType();
@@ -120,7 +120,7 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { throw new StructuralException("No type defined in model");
}
}
-
+
public void setDecl(AttributeDecl model) throws StructuralException {
this.model=model;
this.content=model.getSimpleType();
@@ -132,7 +132,7 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { this.model=model;
this.name = model.getName();
XMLType type = model.getType();
-
+
// derive base type
if (type.isSimpleType())
this.content = (SimpleType)type;
@@ -141,9 +141,9 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { if (this.content == null) throw new StructuralException("No declared base type of element");
- //
+ //
if (model.getFixedValue() != null) setEditable(false);
-
+
}
public void setData(Attr newData) throws StructuralException {
@@ -178,26 +178,28 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { public Node getData() {
return data;
}
-
+
public String getDefaultValue() {
return "";
}
-
+
public void setHelp(HelpPane helpPane, String helpText) {
this.helpPane = helpPane;
this.helpText = helpText;
}
- public void focusLost(FocusEvent e) {
+ @Override
+ public void focusLost(FocusEvent e) {
if (MainFrame.itemFinder != null)
MainFrame.itemFinder.clearConsumer(this);
updateNode();
}
- public void focusGained(FocusEvent e) {
+ @Override
+ public void focusGained(FocusEvent e) {
helpPane.setHelp(name, helpText);
if (editable && MainFrame.itemFinder != null)
- MainFrame.itemFinder.setConsumer(this, "Insert");
+ MainFrame.itemFinder.setConsumer(this, "Insert");
}
public void updateNode() {
@@ -213,23 +215,25 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { /**
* Read domkey from barcode input
*/
- public void push(DomainPath key) {
+ @Override
+ public void push(DomainPath key) {
setText(key.getName());
}
/**
* Read string from barcode input
*/
- public void push(String key) {
+ @Override
+ public void push(String key) {
setText(key);
}
-
+
public void setEditable(boolean editable) {
this.editable = editable;
if (field != null)
field.setEditable(editable);
}
-
+
public String getText() {
return field.getText();
}
@@ -237,15 +241,15 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { public void setText(String text) {
field.setText(text);
}
-
+
public JTextComponent makeTextField() {
return new JTextField();
}
-
+
public Component getControl() {
return field;
}
-
+
public void grabFocus() {
getControl().requestFocus();
}
|
