Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.IntegerNullable


    public void setAttribute (Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
        Instrument instrument = this.findInstrument(attribute.getName());
        if (instrument instanceof ConfigValueInst) {
            DataValue theAttribute = null;
            if (attribute.getValue() instanceof java.lang.Integer) {
                theAttribute = new IntegerData((Integer)attribute.getValue());
            }
            if (attribute.getValue() instanceof java.lang.Double) {
                theAttribute = new DoubleData((Double)attribute.getValue());
            }
            if (attribute.getValue() instanceof java.lang.String) {
View Full Code Here


     * read was <code>null</code>, then the resulting IntegerNullable class will have it's Null property set to true.
     * @param pColumnID the ordinal number of the column to read
     * @return a IntegerNullable instance containing the value of the column in the database
     */
    public IntegerNullable getIntegerNullable(int pColumnID) {
        IntegerNullable in = new IntegerNullable();

        try {
            int intr = resultSet.getInt(pColumnID);
            if (resultSet.wasNull()) {
                in.setIsNull(true);
            } else {
                in.setValue(intr);
            }

            return in;
        } catch (SQLException e) {
          throw processException(e);
View Full Code Here

     * @return a IntegerNullable instance containing the value of the column in the database
     * @throws UsageException with reason code of SP_ER_PARAMETERERROR if no column with the passed name exists in the database
     */
    public IntegerNullable getIntegerNullable(String pColumnName) {
        try {
            IntegerNullable in = new IntegerNullable();

            int intr = resultSet.getInt(pColumnName);
            if (resultSet.wasNull()) {
                in.setIsNull(true);
            } else {
                in.setValue(intr);
            }

            return in;
        } catch (SQLException e) {
          throw processException(e);
View Full Code Here

            }
            else if (IntegerData.class.equals(subjectType)) {
                subject.setValue(new IntegerData(element.getIntegerValue()));
            }
            else if (IntegerNullable.class.equals(subjectType)) {
                subject.setValue(new IntegerNullable(element.getIntegerValue()));
            }
            else if (IntegerData.class.isAssignableFrom(subjectType)) {
                try {
                    IntegerData anIntData = (IntegerData)subjectType.newInstance();
                    anIntData.setValue(element.getIntegerValue());
                    subject.setValue(anIntData);
                }
                catch (Exception e) {
                    // No default constructor
                    _log.debug("Could not instantiate class " + subjectType.getName(), e);
                }
            }
            else if (TextData.class.equals(subjectType)) {
                // TF:27/8/07:We need to clone the return value, otherwise we'll be returning the actual textdata mapped to the listelement
                // and any changes on this list element will erroneously affect the underlying list
                subject.setValue(CloneHelper.clone(element.getTextValue(), false));
            }
            else if (TextNullable.class.equals(subjectType)) {
        subject.setValue(new TextNullable(element.getTextValue()));
      }
            else if (TextData.class.isAssignableFrom(subjectType)) {
                try {
                    TextData aTextData = (TextData)subjectType.newInstance();
                    aTextData.setValue(element.getTextValue());
                    subject.setValue(aTextData);
                }
                catch (Exception e) {
                    // No default constructor
                    _log.debug("Could not instantiate class " + subjectType.getName(), e);
                }
            }
            else if (String.class.equals(subjectType)) {
                subject.setValue(element.toString());
            }
            else {
              // CraigM:11/12/2008 - We can always set the object value as a last resort
              subject.setValue(element.getObjectValue());
            }
        }

        // Handle nulls - Can happen when mapped to a IntegerNullable radio list. CraigM 11/10/2007
        else if (newValue == null) {
            if (IntegerNullable.class.equals(subjectType)) {
                subject.setValue(new IntegerNullable((Integer)null));
            }
            else if (TextNullable.class.equals(subjectType)) {
                subject.setValue(new TextNullable((String)null));
            }
        }
View Full Code Here

        }
        else if (IntegerData.class.equals(subjectType))
            subject.setValue(new IntegerData(i));

        else if (IntegerNullable.class.equals(subjectType))
            subject.setValue(new IntegerNullable(i));

        else if (NumericData.class.isAssignableFrom(subjectType)) {
            try {
                IntegerData anIntData = (IntegerData)subjectType.newInstance();
                anIntData.setValue(i);
View Full Code Here

    public void setIntegerValue(int value) {
        if (scrollList != null) {
            int limit = this.list.getSize();
            for (int i = 0; i < limit; i++) {
                ListElement el = (ListElement)this.list.getElementAt(i);
                if (el.getIntegerValue() == value) {
                    this.list.setSelection(el);
                    return;
                }
            }
        }
View Full Code Here

    public void setObjectValue(Object value) {
        if (scrollList != null) {
            if (scrollList != null) {
                int limit = this.list.getSize();
                for (int i = 0; i < limit; i++) {
                    ListElement el = (ListElement)this.list.getElementAt(i);
                    if (el.getObjectValue() != null && el.getObjectValue().equals(value)) {
                        this.list.setSelection(el);
                        return;
                    }
                }
            }
View Full Code Here

    public void setTextValue(TextData value) {
        if (scrollList != null) {
            if (scrollList != null) {
                int limit = this.list.getSize();
                for (int i = 0; i < limit; i++) {
                    ListElement el = (ListElement)this.list.getElementAt(i);
                    if (el.getTextValue() == value) {
                        this.list.setSelection(el);
                        return;
                    }
                }
            }
View Full Code Here

   
    public void setElementList(Array_Of_ListElement<ListElement> les) {
        // TF:8/8/07:Made a shallow clone in case there is a really big object attached to the list element
        Array_Of_ListElement<ListElement> clonedList = CloneHelper.clone(les, false);
        Object currentValue = this.list.getValue();
        ListElement valueToReselect = null;
        if (currentValue instanceof ListElement && clonedList != null && this.list.getSelectionHolder() instanceof TypeAwareValueModel) {
          TypeAwareValueModel tavm = (TypeAwareValueModel)this.list.getSelectionHolder();
          // We need to find an item in the new list which is the same as an item in the old list,
          // depending on the type being considered. For example, if the list is mapped to an int,
          // we need to find an element in the new list with the same IntegerValue.
          Class<?> clazz = tavm.getValueType();
          ListElement currentSelection = (ListElement)currentValue;
          for (ListElement item : clonedList) {
            if (clazz.equals(Integer.TYPE) ||
                clazz.equals(Short.TYPE) ||
                NumericData.class.isAssignableFrom(clazz) ||
                Number.class.isAssignableFrom(clazz)) {
              if (item.getIntegerValue() == currentSelection.getIntegerValue()) {
                valueToReselect = item;
                break;
              }
            }
            else if (String.class.isAssignableFrom(clazz) || TextData.class.isAssignableFrom(clazz) && currentSelection.getTextValue() != null) {
              if (currentSelection.getTextValue().equals(item.getTextValue())) {
                valueToReselect = item;
                break;
              }
            }
            else {
              if (currentSelection.getObjectValue() != null && currentSelection.getObjectValue() == item.getObjectValue()) {
                valueToReselect = item;
                break;
              }
            }
          }
View Full Code Here

    }

    public int getIntegerValue() {
        if (scrollList != null) {
            int index = this.list.getSelectionIndex();
            ListElement el = (ListElement)this.list.getElementAt(index);
            return el == null ? 0 : el.getIntegerValue();
        }
        else
            return 0;
    }
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.framework.IntegerNullable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.