/** * Set this control's converter to this HTML param. * @param strParamValue The value to set the field to. * @return The error code. */ public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { if (this.getConverter() != null) return this.getConverter().setString(strParamValue, bDisplayOption, iMoveMode); else return DBConstants.NORMAL_RETURN; } /**
/** * Set this control's converter to this HTML param. * @param strParamValue The value to set the field to. * @return The error code. */ public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { if (this.getConverter() != null) return this.getConverter().setString(strParamValue, bDisplayOption, iMoveMode); else return Constant.NORMAL_RETURN; } /**
/** * Get the converter for this screen field. * NOTE: Be careful, this method is just for convience and is required by the ScreenComponent * interface, although this is not the screen component. * @return The converter for this screen field. */ public Converter getConverter() { return this.getScreenField().getConverter(); // Utility method } /**
/** * Get the converter for this column. * This method is only used by FlexTreeHandler! * @param iSelectIndex The field to return. * @return The converter at this location. */ public Converter getTreeField(int iSelectIndex) { return this.getSField(iSelectIndex).getConverter(); } }
/** * Get the converter for this screen field. * NOTE: Be careful, this method is just for convenience and is required by the ScreenComponent * interface, although this is not the screen component. * @return The converter for this screen field. */ public Convert getConverter() { return this.getScreenField().getConverter(); // Utility method } /**
/** * Get the converter for this column. * This method is only used by FlexTreeHandler! * @param iSelectIndex The field to return. * @return The converter at this location. */ public Convert getTreeField(int iSelectIndex) { return this.getSField(iSelectIndex).getConverter(); } }
/** * Get the field column headings in HTML. * @param out The html out stream. * @exception DBException File exception. */ public void printHtmlHeading(PrintWriter out) { if (this.getScreenField().getConverter() == null) return; String strField = this.getScreenField().getConverter().getFieldDesc(); if ((strField == null) || (strField.length() == 0)) strField = " "; //?"<br>"; out.println("<th>" + strField + "</th>"); } }
/** * Get this field's current state in an object that can be used to set this * component's converter value using setConverterState(obj). * @return The field's value (class defined by the field type). */ public Object getFieldState() { if (this.getScreenField().getConverter() == null) return null; String string = this.getScreenField().getConverter().getString(); if (string == null) string = Constants.BLANK; return string; } /**
/** * Get this field's current state in an object that can be used to set this * component's converter value using setConverterState(obj). * @return The field's value (class defined by the field type). */ public Object getFieldState() { if (this.getScreenField().getConverter() == null) return null; String string = this.getScreenField().getConverter().getString(); if (string == null) string = Constants.BLANK; return string; } /**
/** * Set the field to this state. State is defined by the component. * @param objValue The value to set the field to (class of object depends on the control). * @param bDisplayOption Display the data on the screen if true. * @param iMoveMode INIT, SCREEN, or READ move mode. * @return Error code. */ public int setFieldState(Object objValue, boolean bDisplayOption, int iMoveMode) { if (this.getScreenField().getConverter() == null) return DBConstants.NORMAL_RETURN; if (!(objValue instanceof String)) return this.getScreenField().getConverter().setData(objValue, bDisplayOption, iMoveMode); else return this.getScreenField().getConverter().setString((String)objValue, bDisplayOption, iMoveMode); } /**
/** * Set the field to this state. State is defined by the component. * @param objValue The value to set the field to (class of object depends on the control). * @param bDisplayOption Display the data on the screen if true. * @param iMoveMode INIT, SCREEN, or READ move mode. * @return Error code. */ public int setFieldState(Object objValue, boolean bDisplayOption, int iMoveMode) { if (this.getScreenField().getConverter() == null) return DBConstants.NORMAL_RETURN; if (!(objValue instanceof String)) return this.getScreenField().getConverter().setData(objValue, bDisplayOption, iMoveMode); else return this.getScreenField().getConverter().setString((String)objValue, bDisplayOption, iMoveMode); } /**
/** * Retrieve (in HTML format) from this field. * (Only for XML/HTML fields). * @param bDisplayFormat Display (with html codes) or Input format? * @param bRawData If true return the Raw data (not through the converters)? * @return The HTML string. */ public String getSFieldValue(boolean bDisplayFormat, boolean bRawData) { Convert converter = this.getConverter(); if (converter == null) return Constant.BLANK; if (bRawData) { converter = converter.getField(); if (converter == null) return Constant.BLANK; } return converter.getString(); } /**
/** * Get the status of this object. * @param iFieldSeq The field sequence to retrieve. * @return The data. */ public Object getFieldData(int iSFieldSeq) { ScreenField sField = null; if (iSFieldSeq != -1) sField = m_gridScreen.getSField(this.getRelativeSField(iSFieldSeq)); if (sField != null) return sField.getConverter().getData(); return null; } /**
/** * Get the status of this object. * @param iFieldSeq The field sequence to retrieve. * @return The data. */ public Object getFieldData(int iSFieldSeq) { ScreenField sField = null; if (iSFieldSeq != -1) sField = m_gridScreen.getSField(this.getRelativeSField(iSFieldSeq)); if (sField != null) return sField.getConverter().getData(); return null; } /**
/** * Get the current string value in HTML. * @param out The html out stream. * @exception DBException File exception. */ public void printDisplayControl(PrintWriter out) { if (this.getScreenField().getConverter() != null) { String strFieldName = this.getScreenField().getConverter().getField().getFieldName(false, false); this.printInputControl(out, null, strFieldName, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? } else if (this.getScreenField().getParentScreen() instanceof GridScreen) { // These are command buttons such as "Form" or "Detail" this.printInputControl(out, null, null, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? } } }
/** * Get the field column headings in HTML. * @param out The html out stream. * @exception DBException File exception. */ public void printHtmlHeading(PrintWriter out) { if (this.getScreenField().getConverter() != null) super.printHtmlHeading(out); else if (this.getScreenField().getParentScreen() instanceof GridScreen) { // These are command buttons such as "Form" or "Detail" String strImage = "Form"; if (((SButtonBox)this.getScreenField()).getImageButtonName() != null) strImage = ((SButtonBox)this.getScreenField()).getImageButtonName(); out.println("<th align=\"center\" valign=\"center\"><img src=\"" + HtmlConstants.IMAGE_DIR + "buttons/" + strImage + ".gif\" width=\"16\" height=\"16\" alt=\"Open this record\"></th>"); } } /**
/** * Move the field's value to the control. */ public void fieldToControl() { if (this.getConverter() != null) { Object objValue = this.getScreenFieldView().getFieldState(); if (this.getScreenFieldView().getControl() != null) this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), objValue); } } /**
/** * Move the field's value to the control. */ public void fieldToControl() { if (this.getConverter() != null) { Object objValue = this.getScreenFieldView().getFieldState(); if (this.getScreenFieldView().getControl() != null) this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), objValue); } } /**
/** * Move the control's value to the field. * @return An error value. */ public int controlToField() { int iErrorCode = Constant.NORMAL_RETURN; if ((this.getScreenFieldView().getControl() != null) && (this.getConverter() != null)) { Object objValue = this.getScreenFieldView().getComponentState(this.getScreenFieldView().getControl()); iErrorCode = this.getScreenFieldView().setFieldState(objValue, Constant.DISPLAY, Constant.SCREEN_MOVE); } return iErrorCode; } /**
/** * Move the control's value to the field. * @return An error value. */ public int controlToField() { int iErrorCode = DBConstants.NORMAL_RETURN; if ((this.getScreenFieldView().getControl() != null) && (this.getConverter() != null)) { Object objValue = this.getScreenFieldView().getComponentState(this.getScreenFieldView().getControl()); iErrorCode = this.getScreenFieldView().setFieldState(objValue, Constants.DISPLAY, Constants.SCREEN_MOVE); } return iErrorCode; } /**