[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Thu Dec 7 16:37:36 UTC 2006
gordonp
Thu Dec 7 11:37:36 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobySecondaryInputGUI.java
Log Message:
Updates to secondary article handling
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobySecondaryInputGUI.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.java 2006/10/25 02:33:22 1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.java 2006/12/07 16:37:36 1.2
@@ -2,6 +2,7 @@
package ca.ucalgary.seahawk.gui;
import org.biomoby.shared.data.MobyDataSecondaryInstance;
+import org.biomoby.shared.MobySecondaryData;
import java.awt.*;
import javax.swing.*;
import javax.swing.text.JTextComponent;
@@ -177,18 +178,21 @@
return makeEnumWidget(msdi);
}
// Otherwise build a widget based on the data type
- else if("Integer".equals(dataType)){
+ else if(MobySecondaryData.INTEGER_TYPE.equals(dataType)){
return makeIntWidget(msdi);
}
- else if("Float".equals(dataType)){
+ else if(MobySecondaryData.FLOAT_TYPE.equals(dataType)){
return makeFloatWidget(msdi);
}
- else if("String".equals(dataType)){
+ else if(MobySecondaryData.STRING_TYPE.equals(dataType)){
return makeStringWidget(msdi);
}
- else if("DateTime".equals(dataType)){
+ else if(MobySecondaryData.DATETIME_TYPE.equals(dataType)){
return makeDateTimeWidget(msdi);
}
+ else if(MobySecondaryData.BOOLEAN_TYPE.equals(dataType)){
+ return makeBooleanWidget(msdi);
+ }
else{
logger.warn("Unrecognized secondary input data type (" + dataType + ") in " + getClass());
return null;
@@ -219,6 +223,24 @@
return widget;
}
+ public Component makeBooleanWidget(MobyDataSecondaryInstance msdi){
+ String defaultValue = msdi.getDefaultValue();
+ if(defaultValue == null){
+ defaultValue = "false";
+ }
+
+ JPanel widget = new JPanel();
+ widget.add(makeJLabel(msdi));
+ JCheckBox checkbox = new JCheckBox();
+ checkbox.setSelected(defaultValue.toLowerCase().equals("true") ||
+ defaultValue.equals("1") ||
+ defaultValue.equals("T"));
+ data2widget.put(msdi, checkbox);
+ widget.add(checkbox);
+
+ return widget;
+ }
+
public Component makeStringWidget(MobyDataSecondaryInstance msdi){
String defaultValue = msdi.getDefaultValue();
if(defaultValue == null){
@@ -378,6 +400,7 @@
}
public Component makeDateTimeWidget(MobyDataSecondaryInstance msdi){
+ //TODO
return null;
}
More information about the MOBY-guts
mailing list