/** * 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; } /**
/** * Get the environment to use for this record owner. * @return Record owner's environment, or null to use the default enviroment. */ public ViewFactory getViewFactory() { if (this.getParentScreen() != null) return this.getParentScreen().getViewFactory(); return null; } /**
/** * 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 HTML input to the screen record fields. * @param strSuffix Only move fields with the suffix. * @return true if one was moved. * @exception DBException File exception. */ public int setSFieldToProperty(String strSuffix, boolean bDisplayOption, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (this.isInputField()) { String strFieldName = this.getSFieldParam(strSuffix); String strParamValue = this.getSFieldProperty(strFieldName); if (strParamValue != null) iErrorCode = this.setSFieldValue(strParamValue, bDisplayOption, iMoveMode); } return iErrorCode; } /**
bPrintControl = false; // ie., Don't print buttons if (sField.getConverter() == null) bPrintControl = false; if (screen == this) bPrintControl = false; // My children are the report detail (Not params). if (!sField.isInputField()) bPrintControl = false; if (!sField.isEnabled()) bPrintControl = false; if (bPrintControl) if (sField.getScreenFieldView() != null) String strData = sField.getSFieldValue(false, false); // Match HTML submit (input format/go through converters). strURL = Utility.addURLParam(strURL, sField.getSFieldParam(null, false), strData); // Don't need outside frame stuff in a window
if (!(this.getScreenField() instanceof BasePanel)) if (this.getScreenField().isInputField()) String strFieldName = this.getScreenField().getSFieldParam(strSuffix); String strParamValue = this.getSFieldProperty(strFieldName); int iErrorCode = this.getScreenField().setSFieldValue(strParamValue, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); if (iErrorCode != DBConstants.NORMAL_RETURN) String strError = ex.getMessage(this.getScreenField().getParentScreen().getTask()); String strFieldDesc = null; if (this.getScreenField().getConverter() != null) strFieldDesc = this.getScreenField().getConverter().getFieldDesc(); if ((strFieldDesc == null) || (strFieldDesc.length() == 0)) strFieldDesc = strFieldName; ScreenFieldView vField = ((BasePanel)this.getScreenField()).getSField(iIndex).getScreenFieldView(); if (vField.moveControlInput(strSuffix) == DBConstants.NORMAL_RETURN) iDefaultParamsFound = DBConstants.NORMAL_RETURN;
if (this.getScreenField().getConverter() != null) strFieldDesc = this.getScreenField().getConverter().getFieldDesc(); this.printHtmlControlDesc(out, strFieldDesc, iHtmlAttributes); if (this.getScreenField().isEnabled() == false) Convert converter = this.getScreenField().getConverter(); int iMaxSize = 10; //? if (converter != null) if (iMaxSize < 40) strSize = strMaxSize; String strValue = this.getScreenField().getSFieldValue(false, false);
if (sField.getConverter() != null) properties.put(sField.getSFieldParam(null, false), sField.getSFieldValue(false, false));
/** * Enable or disable this control. * @param bEnable If true, enable this field. */ public void setEnabled(boolean bEnable) { m_bEnabled = bEnable; if (this.getScreenFieldView() != null) this.getScreenFieldView().setEnabled(bEnable); } /**
/** * Set up the default screen control for this field. * @param itsLocation Location of this component on screen (ie., GridBagConstraint). * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). * @param converter The converter to set the screenfield to. * @param iDisplayFieldDesc Display the label? (optional). * @return Return the component or ScreenField that is created for this field. */ public ScreenField setupDefaultView(ScreenLocation itsLocation, BasePanel targetScreen, Converter converter, int iDisplayFieldDesc) { ScreenField screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc); ScreenField pSScreenField = new SCannedBox(targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, "Phone", ScreenConstants.DONT_DISPLAY_FIELD_DESC, this); pSScreenField.setRequestFocusEnabled(false); return screenField; } }
/** * Get the current string value in HTML.<p /> * May want to check GetRootScreen().GetScreenType() & INPUT/DISPLAY_MODE * @param out The html out stream. * @exception DBException File exception. */ public void printDisplayControl(PrintWriter out) { if (this.getScreenField().getConverter() == null) return; String strField = Utility.encodeXML(this.getScreenField().getSFieldValue(true, false)); if ((strField == null) || (strField.length() == 0)) strField = " "; //?"<br>"; String strHyperlink = ((Converter)this.getScreenField().getConverter()).getHyperlink(); if (strHyperlink != null) if (strHyperlink.length() > 0) strField = "<a href=\"" + strHyperlink + "\">" + strField + "<a>"; String strAlignment = this.getControlAlignment(); out.println("<td" + strAlignment + ">" + strField + "</td>"); } /**
/** * Set up the default control for this field. * @param itsLocation Location of this component on screen (ie., GridBagConstraint). * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). * @param iDisplayFieldDesc Display the label? (optional). * @return Return the component or ScreenField that is created for this field. */ public ScreenField setupDefaultView(ScreenLocation itsLocation, BasePanel targetScreen, Converter converter, int iDisplayFieldDesc) // Add this view to the list { ScreenField sField = null; BaseField field = (BaseField)this.getField(); if (field != null) { sField = field.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc); if (sField != null) if (sField.getConverter() == null) sField.setConverter(this); } else sField = new SEditText(itsLocation, targetScreen, converter, iDisplayFieldDesc); return sField; } }
BaseField fieldConverter = this.getScreenRecord().getField(BookingItineraryScreenRecord.ITINERARY_TEXT); fieldConverter.addComponent(m_sHtmlView); m_sHtmlView.setConverter(fieldConverter); m_sHtmlView.setSFieldValue(strText, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); fieldConverter.removeComponent(m_sHtmlView); m_sHtmlView.setConverter(null); ScreenFieldView sView = m_sHtmlView.getScreenFieldView(); if (sView instanceof org.jbundle.base.screen.view.swing.VScreenField)
String strFieldName = this.getScreenField().getSFieldParam(null, false); if (this.getScreenField().getParentScreen() instanceof GridScreen) GridScreen gridScreen = (GridScreen)this.getScreenField().getParentScreen(); Record record = gridScreen.getMainRecord(); try {
/** * Free. */ public void free() { super.free(); } /**
/** * Set up all the screen fields. */ public void setupSFields() { ScreenLocation itsLocation = null; itsLocation = this.getNextLocation(ScreenConstants.FLUSH_LEFT, ScreenConstants.FILL_REMAINDER); // NOTE NOTE NOTE. fieldConverter is only used to create the control, since the actual text is created from reading the URL BaseField fieldConverter = this.getScreenRecord().getField(BookingItineraryScreenRecord.ITINERARY_TEXT); m_sHtmlView = new SHtmlView(itsLocation, this, fieldConverter, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null); ScreenFieldView sView = m_sHtmlView.getScreenFieldView(); if (sView instanceof org.jbundle.base.screen.view.swing.VScreenField) { // Swing - get rid of scrollers and make transparent and get rid of the border. javax.swing.JEditorPane htmlPane = (javax.swing.JEditorPane)sView.getControl(); htmlPane.setEditable(false); ((org.jbundle.base.screen.view.swing.VHtmlView)sView).setupHyperLinkListener(this); htmlPane.setOpaque(false); java.awt.Component component = (java.awt.Component)sView.getControl(DBConstants.CONTROL_TOP); ((javax.swing.JScrollPane)component).setBorder(null); ((javax.swing.JScrollPane)component).setOpaque(false); ((javax.swing.JScrollPane)component).getViewport().setOpaque(false); } fieldConverter.removeComponent(m_sHtmlView); m_sHtmlView.setConverter(null); } /**
if (sField.isEnabled()) if (sField.isFocusTarget())
/** * Get the print options (view defined). * @return The HTML options. * @exception DBException File exception. */ public int getPrintOptions() throws DBException { int iToolbarOptions = super.getPrintOptions(); if (this.getScreenField().isEnabled() == false) // For display - no toolbars iToolbarOptions = iToolbarOptions & ~(HtmlConstants.PRINT_TOOLBAR_BEFORE | HtmlConstants.PRINT_TOOLBAR_BEFORE); return iToolbarOptions; } /**
/** * Move the focus to the next logical field. * @param sfCurrent The currently selected screen field. * @param iSelectField The screen field to select (next/prev/first/last). */ public void selectField(ScreenField sfCurrent, int iSelectField) { ScreenField sField = this.getComponentAfter(sfCurrent, iSelectField); if (sField != null) sField.requestFocus(); } /**
bRawData = true; // If you want the input format, don't go through the converters. return super.getSFieldValue(bDisplayFormat, bRawData);