/** * Initialize class fields. */ public void init(BaseField fldToCheck, BaseField fldToCompare) { BaseField falseField = new BooleanField(null, "Name", 1, "Name", new Boolean(false)); super.init(null, null, null, ">", falseField, true, fldToCheck, fldToCompare); } /**
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { boolean bResult = false; if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED))) bResult = resultset.getBoolean(iColumn); else bResult = resultset.getByte(iColumn) == 0 ? false: true; if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setState(bResult, false, DBConstants.READ_MOVE); } /**
/** * Set to the min or max. * false is highest for boolean fields. * @param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest. */ public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value { // By default compare as ASCII strings Boolean bFlag = Boolean.TRUE; // Lowest value (in SQL) if (iAreaDesc == DBConstants.END_SELECT_KEY) bFlag = Boolean.FALSE; // Highest value (in SQL - Alpha order) this.doSetData(bFlag, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); } /**
return iErrorCode; BooleanField fldAskForAnswer = new BooleanField(null, "Ask", DBConstants.DEFAULT_FIELD_LENGTH, null, null); fldAskForAnswer.setState(false); // Don't ask, I just moved all the answers to this module iErrorCode = this.addTourDetail(recTour, recTourHeader, recBookingPax, recBookingAnswer, dateStart, fldAskForAnswer); fldAskForAnswer.free(); if (recBookingPax != null) fldBookingPaxID.free();
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().getField(BookingAnswer.DESCRIPTION).setEnabled(false); Record recTourHeader = this.getRecord(TourHeader.TOUR_HEADER_FILE); Record recBooking = this.getRecord(Booking.BOOKING_FILE); m_fldModuleStart.setString(m_strModuleStartDate); this.getMainRecord().setKeyArea(BookingAnswer.BOOKING_ID_KEY); this.getMainRecord().addListener(new SubFileFilter(recBooking.getField(Booking.ID), BookingAnswer.BOOKING_ID, m_recBookingPax.getField(BookingPax.ID), BookingAnswer.BOOKING_PAX_ID, recTourHeader.getField(TourHeader.ID), BookingAnswer.MODULE_ID)); this.getMainRecord().addListener(new StringSubFileFilter(m_strTourOrOption, BookingAnswer.TOUR_OR_OPTION, m_strTourOrOptionID, BookingAnswer.TOUR_OR_OPTION_ID, null, null)); this.getMainRecord().addListener(new SubFileFilter(m_fldModuleStart, BookingAnswer.MODULE_START_DATE, null, null, null, null)); BooleanField fldTrue = new BooleanField(null, DBConstants.BLANK, DBConstants.DEFAULT_FIELD_LENGTH, DBConstants.BLANK, null); fldTrue.setState(true); this.getMainRecord().addListener(new FreeOnFreeHandler(fldTrue)); this.getMainRecord().addListener(new CompareFileFilter(BookingAnswer.ASK_FOR_ANSWER, fldTrue, DBConstants.EQUALS, null, false)); this.setAppending(false); this.getMainRecord().getField(BookingAnswer.SELECTED).addListener(new BookingAnswerSelectHandler(null)); } /**
/** * Get the Value of this field as a double. * For a boolean, return 0 for false 1 for true. * @return The value of this field. */ public double getValue() { // Get this field's value Boolean bField = (Boolean)this.getData(); // Get the physical data if (bField == null) return 0; boolean bValue = bField.booleanValue(); if (bValue == false) return 0; else return 1; } /**
return iErrorCode; BooleanField fldAskForAnswer = new BooleanField(null, "Ask", DBConstants.DEFAULT_FIELD_LENGTH, null, null); fldAskForAnswer.setState(false); // Don't ask, I just moved all the answers to this module iErrorCode = this.addTourDetail(recTour, recTourHeader, recBookingPax, recBookingAnswer, dateStart, fldAskForAnswer); fldAskForAnswer.free(); if (recBookingPax != null) fldBookingPaxID.free();
/** * Get the Value of this field as a double. * For a boolean, return 0 for false 1 for true. * @return The value of this field. */ public double getValue() { // Get this field's value Boolean bField = (Boolean)this.getData(); // Get the physical data if (bField == null) return 0; boolean bValue = bField.booleanValue(); if (bValue == false) return 0; else return 1; } /**
field = new StringField(this, DESCRIPTION, 30, null, null); if (iFieldSeq == 4) field = new BooleanField(this, AIR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 5) field = new BooleanField(this, CAR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 6) field = new BooleanField(this, HOTEL, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 7) field = new BooleanField(this, ITEM, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 8) field = new BooleanField(this, TOUR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 9) field = new BooleanField(this, TRANSPORTATION, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 10) field = new BooleanField(this, CRUISE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 11) field = new BooleanField(this, LAND, Constants.DEFAULT_FIELD_LENGTH, null, null); if (field == null) field = super.setupField(iFieldSeq);
BooleanField fldAskForAnswer = new BooleanField(null, "Ask", DBConstants.DEFAULT_FIELD_LENGTH, null, null); fldAskForAnswer.setState(false); // Don't ask, Use the current values iErrorCode = this.addTourDetail(recTour, recTourHeader, recBookingPax, recBookingAnswer, dateDeparture, fldAskForAnswer); fldAskForAnswer.free(); fldBookingPaxID.free();
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { boolean bResult = false; if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED))) bResult = resultset.getBoolean(iColumn); else bResult = resultset.getByte(iColumn) == 0 ? false: true; if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setState(bResult, false, DBConstants.READ_MOVE); } /**
/** * Get the Value of this field as a double. * For a boolean, return 0 for false 1 for true. * @return The value of this field. */ public double getValue() { // Get this field's value Boolean bField = (Boolean)this.getData(); // Get the physical data if (bField == null) return 0; boolean bValue = bField.booleanValue(); if (bValue == false) return 0; else return 1; } /**
/** * Set to the min or max. * false is highest for boolean fields. * @param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest. */ public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value { // By default compare as ASCII strings Boolean bFlag = Boolean.TRUE; // Lowest value (in SQL) if (iAreaDesc == DBConstants.END_SELECT_KEY) bFlag = Boolean.FALSE; // Highest value (in SQL - Alpha order) this.doSetData(bFlag, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); } /**
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new BooleanField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
BooleanField fldAskForAnswer = new BooleanField(null, "Ask", DBConstants.DEFAULT_FIELD_LENGTH, null, null); fldAskForAnswer.setState(false); // Don't ask, Use the current values iErrorCode = this.addTourDetail(recTour, recTourHeader, recBookingPax, recBookingAnswer, dateDeparture, fldAskForAnswer); fldAskForAnswer.free(); fldBookingPaxID.free();
/** * Move the physical binary data to this SQL parameter row. * @param resultset The resultset to get the SQL data from. * @param iColumn the column in the resultset that has my data. * @exception SQLException From SQL calls. */ public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { boolean bResult = false; if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED))) bResult = resultset.getBoolean(iColumn); else bResult = resultset.getByte(iColumn) == 0 ? false: true; if (resultset.wasNull()) this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value else this.setState(bResult, false, DBConstants.READ_MOVE); } /**
/** * Write the physical data in this field to a stream file. * @param daOut Output stream to add this field to. * @param bFixedLength If false (default) be sure to get the length from the stream. * @return boolean Success? */ public boolean write(DataOutputStream daOut, boolean bFixedLength) { try { Boolean boData = (Boolean)this.getData(); boolean bData; if (boData == null) bData = Boolean.FALSE.booleanValue(); // HACK else bData = boData.booleanValue(); daOut.writeBoolean(bData); return true; } catch (IOException ex) { ex.printStackTrace(); return false; } } }
/** * Set to the min or max. * false is highest for boolean fields. * @param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest. */ public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value { // By default compare as ASCII strings Boolean bFlag = Boolean.TRUE; // Lowest value (in SQL) if (iAreaDesc == DBConstants.END_SELECT_KEY) bFlag = Boolean.FALSE; // Highest value (in SQL - Alpha order) this.doSetData(bFlag, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE); } /**
field = new StringField(this, DESCRIPTION, 30, null, null); if (iFieldSeq == 4) field = new BooleanField(this, AIR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 5) field = new BooleanField(this, CAR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 6) field = new BooleanField(this, HOTEL, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 7) field = new BooleanField(this, ITEM, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 8) field = new BooleanField(this, TOUR, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 9) field = new BooleanField(this, TRANSPORTATION, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 10) field = new BooleanField(this, CRUISE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 11) field = new BooleanField(this, LAND, Constants.DEFAULT_FIELD_LENGTH, null, null); if (field == null) field = super.setupField(iFieldSeq);
/** * Write the physical data in this field to a stream file. * @param daOut Output stream to add this field to. * @param bFixedLength If false (default) be sure to get the length from the stream. * @return boolean Success? */ public boolean write(DataOutputStream daOut, boolean bFixedLength) { try { Boolean boData = (Boolean)this.getData(); boolean bData; if (boData == null) bData = Boolean.FALSE.booleanValue(); // HACK else bData = boData.booleanValue(); daOut.writeBoolean(bData); return true; } catch (IOException ex) { ex.printStackTrace(); return false; } } }