Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.UsageException


        this.observeChanges = observeChanges;

        if (propertyName == null)
            throw new NullPointerException("The property name must not be null.");
        if (propertyName.length() == 0)
            throw new UsageException("The property name must not be empty.");

        this.beanChannel.addValueChangeListener(new BeanChangeHandler());

        Object initialBean = getBean();
        // Eagerly check the existence of the property to adapt.
View Full Code Here


                        index = 0;
                    }
                }
                else {
                    // some other event which we were not expecting
                    UsageException errorVar = new UsageException("Cannot handle action with name='"+name+"'");
                    ErrorMgr.addError(errorVar);
                    throw errorVar;
                }
                list.setSelectedIndex(index);
            }
View Full Code Here

      }
        if (map != null) {
            try {
                map.toData(parseString((o == null) ? "" : o.toString()));
            } catch (ParseException e) {
                UsageException errorVar = new UsageException("DataField " + getName() + ".toData() parse error" , e);
                ErrorMgr.addError(errorVar);
                throw errorVar;
            }
            invokedByToData = true;
        }
View Full Code Here

        }
    }

    public Object getValue(Object pRow, int pColumn) {
        if (pRow == null) {
            throw new UsageException("The passed row should not be null");
        }
        else if (!this.mappedType.isAssignableFrom(pRow.getClass())) {
            throw new UsageException("The row type " + pRow.getClass() + " is not assignable to " + mappedType);
        }
        else if (propertyGetters[pColumn] == null || propertyGetters[pColumn].length == 0) {
            return null;
        }
        else {
View Full Code Here

            super(booleanSubject);
            if ((trueText == null) || (falseText == null) || (nullText == null)) {
                throw new NullPointerException("The trueText, falseText and nullText must not be null.");
            }
            if (trueText.equals(falseText)) {
                throw new UsageException("The trueText and falseText must be different.");
            }
            this.trueText  = trueText;
            this.falseText = falseText;
            this.nullText  = nullText;
        }
View Full Code Here

            } else if (falseText.equalsIgnoreCase(newString)) {
                subject.setValue(Boolean.FALSE);
            } else if (nullText.equalsIgnoreCase(newString)) {
                subject.setValue(null);
            } else
                throw new UsageException(
                        "The new value must be one of: "
                        + trueText + '/'
                        + falseText + '/'
                        + nullText);
        }
View Full Code Here

        if (adaptingModel == null) {
            adaptingModel = new SimplePropertyAdapter(propertyName, getterName, setterName);
            propertyAdapters.put(propertyName, adaptingModel);
        } else if    (!equals(getterName, adaptingModel.getterName)
                    || !equals(setterName, adaptingModel.setterName)) {
                throw new UsageException(
                        "You must not invoke this method twice "
                        + "with different getter and/or setter names.");
        }
        return adaptingModel;
    }
View Full Code Here

            Object deselectedValue,
            JCheckBox toggleField) {
        if (subject == null)
            throw new NullPointerException("The subject must not be null.");
        if (BindingUtils.equals(selectedValue, deselectedValue))
            throw new UsageException("The selected value must not equal the deselected value.");

        this.subject = subject;
        this.selectedValue = selectedValue;
        this.deselectedValue = deselectedValue;
        this.ToggleField = toggleField;
View Full Code Here

        if (property1Name == null)
            throw new NullPointerException("PropertyName1 must not be null.");
        if (property2Name == null)
            throw new NullPointerException("PropertyName2 must not be null.");
        if ((bean1 == bean2) && (property1Name.equals(property2Name)))
            throw new UsageException(
                    "Cannot connect a bean property to itself on the same bean.");

        this.bean1 = bean1;
        this.bean2 = bean2;
        this.property1Name = property1Name;
        this.property2Name = property2Name;

        property1Descriptor = getPropertyDescriptor(bean1, property1Name);
        property2Descriptor = getPropertyDescriptor(bean2, property2Name);

        boolean canWriteProperty1 = property1Descriptor.getWriteMethod() != null;
        boolean canWriteProperty2 = property2Descriptor.getWriteMethod() != null;
        // Reject to connect to read-only properties
        if (!canWriteProperty1 && !canWriteProperty2)
            throw new UsageException(
                    "Cannot connect two read-only properties.");

        property1ChangeHandler = new PropertyChangeHandler(
                bean1, property1Descriptor, bean2, property2Descriptor);
        property2ChangeHandler = new PropertyChangeHandler(
View Full Code Here

     * @param newValue  the Boolean value to be set
     * @throws UsageException   if the newValue is not a Boolean
     */
    public void setValue(Object newValue) {
        if ((newValue != null) && !(newValue instanceof Boolean))
            throw new UsageException(
                "Trigger values must be of type Boolean.");

        Object oldValue = value;
        value = (Boolean) newValue;
        fireValueChange(oldValue, newValue);
View Full Code Here

TOP

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

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.