예제 #1
0
 public void setEditable(boolean isEditable) {
   isEditable_ = isEditable;
   if (inputType_.equals("ALPHA") || inputType_.equals("KANJI") || inputType_.equals("NUMERIC")) {
     ((JTextField) component).setEditable(isEditable_);
     ((JTextField) component).setFocusable(isEditable_);
   }
   if (inputType_.equals("DATE")) {
     ((XFDateField) component).setEditable(isEditable_);
     ((XFDateField) component).setFocusable(isEditable_);
     int fieldWidth = XFUtility.getWidthOfDateValue(dialog_.getSession().getDateFormat(), 14);
     if (isEditable_) {
       this.setBounds(
           this.getBounds().x, this.getBounds().y, 150 + fieldWidth, XFUtility.FIELD_UNIT_HEIGHT);
     } else {
       this.setBounds(
           this.getBounds().x, this.getBounds().y, 124 + fieldWidth, XFUtility.FIELD_UNIT_HEIGHT);
     }
   }
   if (inputType_.equals("LISTBOX")) {
     ((JComboBox) component).setEditable(isEditable_);
     ((JComboBox) component).setFocusable(isEditable_);
   }
   if (inputType_.equals("CHECKBOX")) {
     ((JCheckBox) component).setEnabled(isEditable_);
     ((JCheckBox) component).setFocusable(isEditable_);
   }
 }
예제 #2
0
 public void setValue(Object value) {
   if (value == null) {
     value = "";
   }
   if (inputType_.equals("ALPHA") || inputType_.equals("KANJI") || inputType_.equals("NUMERIC")) {
     if (inputType_.equals("ALPHA") || inputType_.equals("KANJI")) {
       // ((JTextField)component).setText(value.toString());
       String strValue = value.toString();
       if (strValue.length() > size_) {
         strValue = strValue.substring(0, size_);
       }
       ((JTextField) component).setText(strValue);
     }
     if (inputType_.equals("NUMERIC")) {
       String stringValue = "";
       if (decimal_ == 0) {
         stringValue =
             XFUtility.getFormattedIntegerValue(
                 getStringNumber(value.toString()), new ArrayList<String>(), size_);
       } else {
         stringValue =
             XFUtility.getFormattedFloatValue(getStringNumber(value.toString()), decimal_);
       }
       ((JTextField) component).setText(stringValue);
     }
     if (isAutoSizing) {
       int width = this.getBounds().width - 130;
       if (metrics.stringWidth(value.toString()) > width) {
         this.setBounds(
             this.getBounds().x,
             this.getBounds().y,
             metrics.stringWidth(value.toString()) + 130,
             this.getBounds().height);
       }
     }
   }
   if (inputType_.equals("DATE")) {
     ((XFDateField) component).setValue(value.toString());
   }
   if (inputType_.equals("LISTBOX")) {
     for (int i = 0; i < valueList.size(); i++) {
       if (value == valueList.get(i) || value.toString().equals(valueList.get(i).toString())) {
         ((JComboBox) component).setSelectedIndex(i);
         break;
       }
     }
   }
   if (inputType_.equals("CHECKBOX")) {
     if (value == Boolean.TRUE || value.toString().equals("true")) {
       ((JCheckBox) component).setSelected(true);
     } else {
       ((JCheckBox) component).setSelected(false);
     }
   }
 }