Examples of BooleanObject


Examples of com.volantis.mcs.utilities.BooleanObject

     */
    public void testSupplementaryValidatorInvoked() throws Exception {
        Element root = document.getRootElement();
        final Element shipto = getChild(root, "shipto");

        final BooleanObject firstBO = new BooleanObject();
        firstBO.setValue(false);

        // create a validator.
        DOMSupplementaryValidator firstSupplementartyValidator
                = new DOMSupplementaryValidator() {

            // javadoc inherited
            public void validate(Element element,
                                 ErrorReporter errorReporter) {
                firstBO.setValue(true);
                // check that it is the correct element
                assertEquals("Elment should be the 'shipto' element",
                             shipto,
                             element);
            }
        };

        final BooleanObject secondBO = new BooleanObject();
        secondBO.setValue(false);

        // create another validator.
        DOMSupplementaryValidator secondSupplementartyValidator
                = new DOMSupplementaryValidator() {

            // javadoc inherited
            public void validate(Element element,
                                 ErrorReporter errorReporter) {
                secondBO.setValue(true);
                // check that it is the correct element
                assertEquals("Elment should be the 'shipto' element",
                             shipto,
                             element);
            }
        };

        // create the validator. Do not expect an standard errors
        validator = createValidator(new TestErrorReporter(
                                            new ExpectedError[] {}));

        // register the fist suplementary validator
        validator.addSupplementaryValidator(shipto.getNamespaceURI(),
                                            shipto.getName(),
                                            firstSupplementartyValidator);

        // register the second suplementary validator
        validator.addSupplementaryValidator(shipto.getNamespaceURI(),
                                            shipto.getName(),
                                            secondSupplementartyValidator);

        // validate the root element.
        validator.validate(root);

        // check that the first supplementary validator was invoked
        assertTrue("The first supplementary validator was not invoked",
                   firstBO.getValue());

        // check that the second supplementary validator was invoked
        assertTrue("The second supplementary validator was not invoked",
                   secondBO.getValue());
    }
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

        final Element shipto = getChild(root, "shipto");

        // add an invalid attribute to the shipto so that we get a
        // standard validation error reported
        shipto.setAttribute("undeclared", "true");
        final BooleanObject bo = new BooleanObject();
        bo.setValue(false);

        // create a validator.
        DOMSupplementaryValidator supplementartyValidator
                = new DOMSupplementaryValidator() {

            // javadoc inherited
            public void validate(Element element,
                                 ErrorReporter errorReporter) {
                bo.setValue(true);
                // check that it is the correct element
                assertEquals("Element should be the 'shipto' element",
                             shipto,
                             element);
            }
        };

        final BooleanObject erBO = new BooleanObject();
        bo.setValue(false);

        ErrorReporter er = new ErrorReporter() {

            // javadoc inherited
            public void reportError(ErrorDetails details) {
                // ensure the supplementary validator has not been invoked
                assertTrue("Supplementary validator should be executed " +
                            "before standard errors have been reported",
                            bo.getValue());
                erBO.setValue(true);
            }

            // javadoc inherited
            public void validationCompleted(XPath xpath) {
            }

            // javadoc inherited
            public void validationStarted(Element root, XPath xpath) {
            }
        };

        // create the validator. Do not expect an standard errors
        validator = createValidator(er);

        // register the uplementary validator
        validator.addSupplementaryValidator(shipto.getNamespaceURI(),
                                            shipto.getName(),
                                            supplementartyValidator);

        // validate the root element.
        validator.validate(root);

        // check that the error reported was invoked
        assertTrue("The error reported was not invoked  ",
                   erBO.getValue());

        // check that the supplementary validator was invoked
        assertTrue("The supplementary validator was not invoked",
                   bo.getValue());
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

            throws Exception {

        Element root = document.getRootElement();
        Element shipto = getChild(root, "shipto");

        final BooleanObject bo = new BooleanObject();
        bo.setValue(false);

        // create a validator.
        DOMSupplementaryValidator supplementartyValidator
                = new DOMSupplementaryValidator() {

            // javadoc inherited
            public void validate(Element element,
                                 ErrorReporter errorReporter) {
                bo.setValue(true);
            }
        };

        // create the validator. Do not expect any standard errors
        validator = createValidator(new TestErrorReporter(
                                            new ExpectedError[] {}));

        validator.addSupplementaryValidator("bogus namepsace",
                                            shipto.getName(),
                                            supplementartyValidator);

        // validate the root element.
        validator.validate(root);

        // check that the supplementary validator was invoked
        assertFalse("The supplementary validator was invoked",
                    bo.getValue());
    }
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

            throws Exception {

        Element root = document.getRootElement();
        Element shipto = getChild(root, "shipto");

        final BooleanObject bo = new BooleanObject();
        bo.setValue(false);

        // create a validator.
        DOMSupplementaryValidator supplementartyValidator
                = new DOMSupplementaryValidator() {

            // javadoc inherited
            public void validate(Element element,
                                 ErrorReporter errorReporter) {
                bo.setValue(true);
            }
        };

        // create the validator. Do not expect any standard errors
        validator = createValidator(new TestErrorReporter(
                                            new ExpectedError[] {}));

        // add the validator
        validator.addSupplementaryValidator(shipto.getNamespaceURI(),
                                            shipto.getName(),
                                            supplementartyValidator);

        // validate the root element.
        validator.validate(root);

        // check that the supplementary validator was invoked
        assertTrue("The supplementary validator was not invoked",
                   bo.getValue());

        bo.setValue(false);

        // remove the validator
        validator.removeSupplementaryValidator(shipto.getNamespaceURI(),
                                               shipto.getName(),
                                               supplementartyValidator);
        // validate the root element
        validator.validate(root);

        // check that the supplementary validator was removed
        assertFalse("The supplementary validator was not removed",
                    bo.getValue());

    }
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

    /**
     * Tests that changing the selection fires the appropriate change events.
     */
    public void testFireSelectionChangedEvent() throws Exception {
        final BooleanObject eventFired = new BooleanObject();
        // Add a non-null listener.
        final ISelectionChangedListener listener =
                new ISelectionChangedListener() {
                    public void selectionChanged(SelectionChangedEvent event) {
                        eventFired.setValue(true);
                    }
                };

        manager.addSelectionChangedListener(listener);

        ODOMElement aElement = (ODOMElement) factory.element("a");
        ODOMElement bElement = (ODOMElement) factory.element("b");

        // Set a selection with two elements.
        final List selection = new ArrayList();
        selection.add(aElement);
        selection.add(bElement);
        manager.setSelection(new ODOMElementSelection(selection));

        assertTrue("SelectionChangeEvent should have been fired",
                eventFired.getValue());
    }
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

    public void testSelectSingleValueWithMultiValuedPolicy() throws Exception {
        InternalDevice device = createInternalDevice();

        String [] array1 = { "hello", "value2", "bye"};

        final BooleanObject retrievedFromCache = new BooleanObject();
        retrievedFromCache.setValue(false);

        final BooleanObject cached = new BooleanObject();
        cached.setValue(false);

        // Set up listPolicies so we can test access.
        PrivateAccessor.setField(device, "listPolicies", new HashMap() {
            public Object get(Object key) {
                Object value = super.get(key);
                if(value!=null) {
                    retrievedFromCache.setValue(true);
                }
                return value;
            }
            public Object put(Object key, Object value) {
                cached.setValue(true);
                return super.put(key, value);
            }
        });

        List selection = Arrays.asList(array1);
        String policy = device.selectSingleKnownPolicyValue("multi1", selection);
        assertEquals("value2", policy);

        // Test that the policy retrieved multi-valued policy has been
        // cached in listPolicies.
        assertTrue("Expected retrieved policy to have been cached.",
                cached.getValue());

        assertFalse("The value should not have been retrieved from " +
                "listPolicies", retrievedFromCache.getValue());

        // Try to get the policy again and this time the cache should be
View Full Code Here

Examples of com.volantis.mcs.utilities.BooleanObject

    /**
     * Tests the PropertyChangeListener mechanism.
     * @throws Exception
     */
    public void testListener() throws Exception {
        final BooleanObject result1 = new BooleanObject();
        final BooleanObject result2 = new BooleanObject();

        Properties props = new Properties();
        props.setProperty("testProp1", "testValue1");
        props.setProperty("testProp2", "testValue2");

        ObservableProperties obsProps = new ObservableProperties(props);

        PropertyChangeListener listener1 = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                result1.setValue(true);
            }
        };

        PropertyChangeListener listener2 = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                result2.setValue(true);
            }
        };

        obsProps.addPropertyChangeListener("testProp1", listener1);
        obsProps.addPropertyChangeListener("testProp2", listener2);

        obsProps.setProperty("testProp1", "newValue1");
        obsProps.setProperty("testProp", "newValue2");

        assertTrue(result1.getValue());
        assertTrue(obsProps.getProperty("testProp1").equals("newValue1"));
       
        assertFalse(result2.getValue());
        assertTrue(obsProps.getProperty("testProp2").equals("testValue2"));
    }
View Full Code Here

Examples of realcix20.guis.utils.BooleanObject

                            }else{
                              deleteSelectSet.add(r);                             
                              tablerow.add(r);
                                if ( ((RegClass)getContainer().getCurrentObject()).validateDelete(regrow, getContainer(),tablerow) ) {
                                  tablerow.add(TxtManager.getTxt("INFORMATION.DELETEREG"));
                                  tablerow.add(new BooleanObject(true,true));
                                }                             
                            }
                            tablerows.add(tablerow);
            }
                      Vector tableCols=new Vector();
View Full Code Here

Examples of realcix20.guis.utils.BooleanObject

                    break;
            }
            if (isUsedInCorrespondence) {
//                DialogManager.showMessageDialog(container, TxtManager.getTxt("INFORMATION.REGUSEDINCORRESPONDENCE"));
              tableRow.add(TxtManager.getTxt("INFORMATION.REGUSEDINCORRESPONDENCE"));
              tableRow.add(new BooleanObject(false,false));
                return false;
            }
            boolean isUsedInTax = false;
            regItemRows = regRow.getRowSet().getRows().iterator();
            while (regItemRows.hasNext()) {
                Row regItemRow = (Row)regItemRows.next();
                isUsedInTax = TaxClass.isRegUsedInTax(regItemRow);
                if (isUsedInTax)
                    break;
            }
            if (isUsedInTax) {
                //DialogManager.showMessageDialog(container, TxtManager.getTxt("INFORMATION.REGUSEDINTAX"));
              tableRow.add(TxtManager.getTxt("INFORMATION.REGUSEDINTAX"));
              tableRow.add(new BooleanObject(false,false));
                return false;
            }
            return result;
        }       
View Full Code Here

Examples of realcix20.guis.utils.BooleanObject

    }
    };   
   
    class BooleanCellRender extends JCheckBox implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      BooleanObject bo=(BooleanObject) value;
      this.setEnabled(bo.getOldValue());
      this.setSelected(bo.getNewValue());
      this.setOpaque(false);
      return this;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.