Examples of BeanProxy


Examples of com.volantis.mcs.interaction.BeanProxy

     * Respond to changes in the selected variant.
     */
    private void selectedVariantChanged(BuilderSelectionEvent event) {
        handlingEvents = false;
        try {
            BeanProxy oldVariant = (BeanProxy) ((event == null) ?
                    null : event.getOldSelection());
            BeanProxy newVariant = context.getSelectedVariant();

            if (oldVariant != null) {
                oldVariant.removeListener(readOnlyListener);
            }

            if (newVariant == null) {
                setEnabledClearIfDisabled(false);
            } else {
                Proxy selection = ((BaseProxy)
                        newVariant.getPropertyProxy(PolicyModel.SELECTION))
                        .getConcreteProxy();

                SelectionBuilder builder = null;
                if (selection == null) {
                    composite.clear();
                } else {
                    builder = (SelectionBuilder) selection.getModelObject();
                    if (builder instanceof GenericImageSelectionBuilder) {
                        composite.updateFromProxy((BeanProxy) selection);
                    }
                }

                // Enable/disable all controls
                setEnabled(!newVariant.isReadOnly());

                // Set the selection and alter the enabled state of the target
                setDisplaySelection(builder);

                newVariant.addListener(readOnlyListener, false);
            }
        } finally {
            handlingEvents = true;
        }
    }
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

     *
     * @return The selection proxy, or null if none exists
     */
    private Proxy getSelectionProxy() {
        Proxy selectionProxy = null;
        BeanProxy selectedVariant = context.getSelectedVariant();
        if (selectedVariant != null) {
            BaseProxy selectionBase = (BaseProxy) selectedVariant.getPropertyProxy(PolicyModel.SELECTION);
            if (selectionBase != null) {
                selectionProxy = selectionBase.getConcreteProxy();
                // If we have no concrete metadata, create an empty one of the
                // appropriate type
                if (selectionProxy == null) {
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

            } else if (next instanceof CategoryReference) {
                categoryTargets.add(next);
            }
        }

        BeanProxy targetedSelection = (BeanProxy) getSelectionProxy();
        ListProxy categories = (ListProxy) targetedSelection.getPropertyProxy(PolicyModel.CATEGORY_REFERENCES);
        Operation setCategories = categories.prepareSetModelObjectOperation(categoryTargets);
        ListProxy devices = (ListProxy) targetedSelection.getPropertyProxy(PolicyModel.DEVICE_REFERENCES);
        Operation setDevices = devices.prepareSetModelObjectOperation(deviceTargets);

        // TODO later Should be merged into a compound operation for future undo implementation
        context.executeOperation(setCategories);
        context.executeOperation(setDevices);
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

        proxy.getTypeDescriptor().accept(this);
        return component;
    }

    public void visit(BeanClassDescriptor descriptor) {
        BeanProxy beanItemProxy = (BeanProxy) proxy;
        component = new BeanComponent(gui, beanItemProxy);
    }
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

                    public Component getListCellRendererComponent(
                            JList list, Object value, int index,
                            boolean isSelected,
                            boolean cellHasFocus) {

                        BeanProxy personProxy = (BeanProxy) value;
                        String firstName = getPropertyAsString(
                                personProxy, Person.FIRST_NAME);
                        String lastName = getPropertyAsString(
                                personProxy, Person.LAST_NAME);
                        String age = getPropertyAsString(
                                personProxy, Person.AGE);

                        String details = firstName + " " + lastName + " - " + age;

                        return super.getListCellRendererComponent(
                                list, details, index, isSelected, cellHasFocus);
                    }
                });

        JPanel buttonPanel = new JPanel();
        buttonPanel.setBackground(Color.YELLOW);
        gridBagConstraints.gridx = 1;
        gridBagConstraints.fill = GridBagConstraints.VERTICAL;
        panel.add(buttonPanel);

        buttonPanel.setLayout(new GridLayout(2, 1));

        JButton button;

        AbstractAction addContactAction = new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                BeanProxy proxy = (BeanProxy) contactsListProxy.addItemProxy();
                EditDialog dialog = new EditDialog(new BeanComponent(gui, proxy));
                dialog.show();
            }
        };
        addContactAction.putValue(Action.NAME, "Add");
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

        descriptor.accept(this);
        return component;
    }

    public void visit(BeanClassDescriptor descriptor) {
        final BeanProxy beanProxy = (BeanProxy) proxy;
        Action action = new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                EditDialog dialog = new EditDialog(
                        new BeanComponent(gui, beanProxy));
                dialog.show();
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

        // =====================================================================

        Person person = new Person();
        person.setAge(-10);

        BeanProxy root = (BeanProxy) createProxy(person);

        // =====================================================================
        //   Set Test Object Specific Expectations
        // =====================================================================

        diagnosticListenerMock.expects
                .diagnosticsChanged(new DiagnosticEvent(root, true));

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        root.addDiagnosticListener(diagnosticListenerMock);
        root.validate();

        final Proxy firstNameProxy = root.getPropertyProxy(Person.FIRST_NAME);
        final Proxy lastNameProxy = root.getPropertyProxy(Person.LAST_NAME);
        final Proxy ageProxy = root.getPropertyProxy(Person.AGE);
        final Proxy addressProxy = root.getPropertyProxy(Person.ADDRESS);

        final ProxyDiagnostic firstNameDiagnostic = new ProxyDiagnosticImpl(
                DiagnosticLevel.ERROR,
                firstNameProxy,
                modelFactory.createMessage("not.set", "firstName"));
View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

     * @throws Exception if an error occurs
     */
    protected void setUp() throws Exception {
        super.setUp();
        Contacts contacts = new Contacts();
        BeanProxy contactsBeanProxy = (BeanProxy) createProxy(contacts);
        contactsProxy = (ListProxy) contactsBeanProxy.getPropertyProxy(Contacts.CONTACTS);

        Person wilma = createWilmaFlintstone(createFlintStoneAddress());
        wilmaProxy = (BeanProxy) createProxy(wilma);
        contactsProxy.prepareAddProxyItemOperation(wilmaProxy).execute();

View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

    /**
     * Tests that events are propagated when the state changes.
     */
    public void testReadOnlyEvents() {
        wilmaProxy.setReadWriteState(ReadWriteState.READ_ONLY);
        BeanProxy wilmaAddress =
                (BeanProxy) wilmaProxy.getPropertyProxy(Person.ADDRESS);
        // Explicitly set the value for first name, so that it should not
        // propagate the event.
        wilmaProxy.getPropertyProxy(Person.FIRST_NAME).
                setReadWriteState(ReadWriteState.READ_WRITE);

        // Build up a list of sources that we expect to change
        final List expectedSources = new ArrayList();
        expectedSources.add(wilmaProxy);
        expectedSources.add(wilmaProxy.getPropertyProxy(Person.AGE));
        expectedSources.add(wilmaProxy.getPropertyProxy(Person.LAST_NAME));
        expectedSources.add(wilmaAddress);
        ListProxy lines =
                (ListProxy) wilmaAddress.getPropertyProxy(Address.LINES);
        expectedSources.add(lines);
        for (int i = 0; i < lines.size(); i++) {
            expectedSources.add(lines.getItemProxy(i));
        }

View Full Code Here

Examples of com.volantis.mcs.interaction.BeanProxy

    public void testCreateModelFromProxies() {

        Person person = new Person();
        Address address;

        BeanProxy personProxy = (BeanProxy) createProxy(person);
        OpaqueProxy firstNameProxy = (OpaqueProxy) personProxy.getPropertyProxy(
                Person.FIRST_NAME);
        firstNameProxy.setModelObject("Fred");
        assertEquals("First name", "Fred", person.getFirstName());

        OpaqueProxy ageProxy = (OpaqueProxy) personProxy.getPropertyProxy(
                Person.AGE);
        ageProxy.setModelObject(new Integer(10030));
        assertEquals("Age", 10030, person.getAge());

        // Address should be null before it is modified.
        address = person.getAddress();
        assertNull("Address not null", address);

        BeanProxy addressProxy = (BeanProxy) personProxy.getPropertyProxy(
                Person.ADDRESS);
        ListProxy linesProxy = (ListProxy) addressProxy.getPropertyProxy(
                Address.LINES);

        // Address should still be null after its proxy and a nested proxy have
        // been added.
        address = person.getAddress();
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.