/** * The Field has Changed. * Reselect the grid screen. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). * Reselect the records. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_gridScreen != null) m_gridScreen.reSelectRecords(); if (m_sPopupBox != null) m_sPopupBox.reSelectRecords(); return DBConstants.NORMAL_RETURN; } }
/** * Get the default title for this screen. * Calls the getTitle method of this screen. * @param screenMain The screen to get the title string from. * @return The returned title for this screen. */ public String getTitle(ComponentParent screenMain) { String strScreenTitle = DBConstants.BLANK; if (screenMain != null) strScreenTitle = screenMain.getTitle(); return strScreenTitle; } }
/** * Remove a dependent screen. * @param screen The screen to remove. */ public void removeDependentScreen(ScreenParent screen) { if (m_depScreens == null) return; if (m_depScreens.contains(screen)) m_depScreens.removeElement(screen); screen.setDependentQuery(null); } /**
/** * 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 ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = createScreenComponent(ScreenModel.IMAGE_VIEW, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.OPEN); properties.put(ScreenModel.IMAGE, ScreenModel.OPEN); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; } /**
/** * Add the pax count screen fields to this toolbar. */ public void addToolbarFields(ComponentParent toolbar, Record recBooking) { Converter converter = null; converter = recBooking.getField(Booking.PAX); ScreenComponent sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.NEXT_INPUT_LOCATION, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); converter = recBooking.getField(Booking.SINGLE_PAX); sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); converter = new RoomConverter(recBooking.getField(Booking.DOUBLE_PAX), (short)2); sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); converter = new RoomConverter(recBooking.getField(Booking.TRIPLE_PAX), (short)3); sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); converter = new RoomConverter(recBooking.getField(Booking.QUAD_PAX), (short)4); sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); converter = recBooking.getField(Booking.CHILDREN); sField = converter.setupDefaultView(toolbar.getNextLocation(ScreenConstants.RIGHT_WITH_DESC, ScreenConstants.ANCHOR_DEFAULT), toolbar, ScreenConstants.DEFAULT_DISPLAY); sField.setEnabled(false); } /**
/** * Set up the default control for this field (using default params). * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). * @return Return the component or ScreenField that is created for this field. */ public ScreenComponent setupFieldView(ComponentParent targetScreen) { return this.setupDefaultView(targetScreen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), targetScreen, ScreenConstants.DISPLAY_DESC); } /**
/** * Enable/Disable the associated control(s). * @param state If false, disable all this field's screen fields. */ public void setEnabled(boolean bEnable) { if (m_vScreenField != null) { for (Enumeration<Object> e = m_vScreenField.elements() ; e.hasMoreElements() ;) { ((ScreenComponent)e.nextElement()).setEnabled(bEnable); } } } /**
/** * Constructor. * @param model The model object for this view object. * @param bEditableControl Is this control editable? */ public void init(ScreenComponent model, boolean bEditableControl) { super.init(model, bEditableControl); if (m_vDisplays == null) if (model.getConverter().getString() == null) this.scanTableItems(); } /**
/** * This is a utility method to simplify setting a single field to the field's property. * @return The error code on set. */ public int setSFieldToProperty() { int iErrorCode = DBConstants.NORMAL_RETURN; m_bJustChanged = false; for (int iComponent = 0; ; iComponent++) { ScreenComponent sField = this.getComponent(iComponent); if (sField == null) break; iErrorCode = sField.setSFieldToProperty(null, DBConstants.DISPLAY, DBConstants.READ_MOVE); } if (iErrorCode == DBConstants.NORMAL_RETURN) if (!this.isJustModified()) if (this.getComponent(0) != null) { ScreenComponent sField = this.getComponent(0); ComponentParent parentScreen = sField.getParentScreen(); String strParam = this.getFieldName(false, true); String strParamValue = parentScreen.getProperty(strParam); if (strParamValue != null) this.setString(strParamValue, DBConstants.DISPLAY, DBConstants.READ_MOVE); } return iErrorCode; } /**
/** * Add an Icon to the Icon list. * @param iIndex The icon's index. * @param icon The icon at this index. */ public void addIcon(Object icon, int iIndex) { m_rgIcons[iIndex] = icon; if (this.getScreenFieldView().getControl() instanceof ExtendedComponent) // Always ((ExtendedComponent)this.getScreenFieldView().getControl()).addIcon(icon, iIndex); } }
/** * SetupProductTypeCheckboxes Method. */ public void setupProductTypeCheckboxes(ScreenParent screen) { ProductType recProductType = (ProductType)screen.getRecord(ProductType.PRODUCT_TYPE_FILE); if (recProductType == null) recProductType = new ProductType((RecordOwner)screen); recProductType.setupProductTypeCheckboxes(screen, this, DBConstants.BLANK); }
/** * Display this field using all this field's screen fields. */ public void displayField() // init this field override for other value { if (m_vScreenField == null) return; for (Enumeration<Object> e = m_vScreenField.elements() ; e.hasMoreElements() ;) { ScreenComponent sField = (ScreenComponent)e.nextElement(); sField.fieldToControl(); // Display using the new value(s) } } /**
/** * User pressed a header button; change the key value to match (and reorder). */ public void clickColumn(int iIndex) { this.getOwner().setValue(iIndex - m_gridScreen.getNavCount()); // Set the grid value (will call this listener if change) } /**
/** * User pressed a header button; change the key value to match (and reorder). */ public void valueChanged(ListSelectionEvent e) { if (e.getFirstIndex() == e.getLastIndex()) if (e.getFirstIndex() > 0) // Column 0 is the form button this.clickColumn(e.getFirstIndex()); JTable control = (JTable)m_gridScreen.getControl(); control.clearSelection(); // Column selections not allowed } /**
/** * 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 ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.EMAIL); properties.put(ScreenModel.IMAGE, ScreenModel.EMAIL); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; } }
/** * Add icon to popup. */ public ScreenComponent setupPopupView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record screenField = this.setupIconView(itsLocation, targetScreen, converter, iDisplayFieldDesc, bIncludeBlankOption); if ((!(targetScreen instanceof GridScreenParent)) && (iDisplayFieldDesc != ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If it is not in a grid screen, add the description if (screenField != null) { itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR); iDisplayFieldDesc = ScreenConstants.DONT_DISPLAY_FIELD_DESC; } screenField = this.setupTablePopup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, -1, -1, bIncludeBlankOption, false); } return screenField; } }
/** * SetupProductTypeCheckboxes Method. */ public void setupProductTypeCheckboxes(ScreenParent screen) { ProductType recProductType = (ProductType)screen.getRecord(ProductType.PRODUCT_TYPE_FILE); if (recProductType == null) recProductType = new ProductType((RecordOwner)screen); recProductType.setupProductTypeCheckboxes(screen, this, DBConstants.BLANK); }
/** * Add another screen dependent on this record. * If this record is closed, so is the dependent screen. * @param screen Dependent screen to add. */ public void addDependentScreen(ScreenParent screen) { if (m_depScreens == null) m_depScreens = new Vector<ScreenParent>(); m_depScreens.addElement(screen); screen.setDependentQuery(this); } /**
/** * 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 ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.PHONE); properties.put(ScreenModel.IMAGE, ScreenModel.PHONE); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; } }
/** * 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 ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.FAX); properties.put(ScreenModel.IMAGE, ScreenModel.FAX); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; } }