Search in sources :

Example 1 with IDisposeListener

use of org.jowidgets.api.controller.IDisposeListener in project jo-client-platform by jo-source.

the class PasswordChangeDialog method show.

void show(final IExecutionContext executionContext) {
    final IPasswordChangeDialogBluePrint dialogBp = BPF.passwordChangeDialog(executor);
    if (passwordChangeDialogSetup != null) {
        dialogBp.setSetup(passwordChangeDialogSetup);
    }
    dialogBp.setExecutionContext(executionContext).setAutoDispose(true);
    dialogBp.setPasswordValidator(passwordValidator);
    if (bounds != null) {
        dialogBp.setPosition(bounds.getPosition()).setSize(bounds.getSize());
    }
    final IPasswordChangeDialog dialog = Toolkit.getActiveWindow().createChildWindow(dialogBp);
    dialog.addDisposeListener(new IDisposeListener() {

        @Override
        public void onDispose() {
            bounds = dialog.getBounds();
        }
    });
    dialog.setVisible(true);
}
Also used : IDisposeListener(org.jowidgets.api.controller.IDisposeListener) IPasswordChangeDialogBluePrint(org.jowidgets.api.widgets.blueprint.IPasswordChangeDialogBluePrint) IPasswordChangeDialog(org.jowidgets.api.widgets.IPasswordChangeDialog)

Example 2 with IDisposeListener

use of org.jowidgets.api.controller.IDisposeListener in project jo-client-platform by jo-source.

the class BeanLinkPanelImpl method createTable.

private void createTable(final IContainer container, final IBeanTableBluePrint<LINKABLE_BEAN_TYPE> linkableTableBp) {
    final IBeanTableBluePrint<LINKABLE_BEAN_TYPE> beanTableBpCopy = CapUiToolkit.bluePrintFactory().beanTable();
    beanTableBpCopy.setSetup(linkableTableBp);
    beanTableBpCopy.setSearchFilterToolbarVisible(true);
    container.setLayout(MigLayoutFactory.growingInnerCellLayout());
    this.linkableTable = container.add(beanTableBpCopy, MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
    final IBeanSelectionListener<LINKABLE_BEAN_TYPE> selectionListener = new IBeanSelectionListener<LINKABLE_BEAN_TYPE>() {

        @Override
        public void selectionChanged(final IBeanSelectionEvent<LINKABLE_BEAN_TYPE> selectionEvent) {
            final IBeanProxy<LINKABLE_BEAN_TYPE> firstSelected = selectionEvent.getFirstSelected();
            if (firstSelected != null) {
                if (linkableForm != null) {
                    if (createdLinkableBean != null && linkableTable != null) {
                        createdLinkableBean.removePropertyChangeListener(beanFilterListener);
                    }
                    linkableForm.setValue(firstSelected);
                    linkableForm.setEditable(false);
                }
            } else {
                if (linkableForm != null) {
                    linkableForm.setValue(createdLinkableBean);
                    if (createdLinkableBean != null && linkableTable != null) {
                        createdLinkableBean.addPropertyChangeListener(beanFilterListener);
                    }
                    linkableForm.setEditable(true);
                }
            }
            setValidationCacheDirty();
        }
    };
    linkableTable.getModel().addBeanSelectionListener(selectionListener);
    linkableTable.addDisposeListener(new IDisposeListener() {

        @Override
        public void onDispose() {
            linkableTable.getModel().removeBeanSelectionListener(selectionListener);
        }
    });
}
Also used : IDisposeListener(org.jowidgets.api.controller.IDisposeListener) IBeanSelectionEvent(org.jowidgets.cap.ui.api.bean.IBeanSelectionEvent) IBeanSelectionListener(org.jowidgets.cap.ui.api.bean.IBeanSelectionListener)

Example 3 with IDisposeListener

use of org.jowidgets.api.controller.IDisposeListener in project jo-client-platform by jo-source.

the class BeanRelationTreeImpl method addBeanToTreeContainer.

private void addBeanToTreeContainer(final IBeanProxy<Object> bean, final int index, final ITreeContainer treeContainer, final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IMenuModel nodeMenu) {
    // the renderer for the child nodes
    final IBeanProxyLabelRenderer<Object> renderer = relationNodeModel.getChildRenderer();
    // create a child node for the bean
    final ITreeNode childNode = treeContainer.addNode(index);
    renderNode(childNode, bean, renderer, relationNodeModel);
    if (nodeMenu.getChildren().size() > 0 && !bean.isDummy() && !bean.isTransient()) {
        childNode.setPopupMenu(nodeMenu);
        if (autoKeyBinding) {
            final MenuModelKeyBinding keyBinding = new MenuModelKeyBinding(nodeMenu, childNode, childNode);
            childNode.addDisposeListener(new IDisposeListener() {

                @Override
                public void onDispose() {
                    keyBinding.dispose();
                }
            });
        }
    }
    // map the child node to the relation model
    final Tuple<IBeanRelationNodeModel<Object, Object>, IBeanProxy<Object>> tuple;
    tuple = new Tuple<IBeanRelationNodeModel<Object, Object>, IBeanProxy<Object>>(relationNodeModel, bean);
    nodesMap.put(childNode, tuple);
    // register listener that re-renders node on property changes
    bean.addPropertyChangeListener(new PropertyChangedRenderingListener(childNode, bean, renderer));
    // registers a listener that re-renders dummy nodes on message state change
    if (bean.isDummy()) {
        bean.addMessageStateListener(new DummyBeanMessageStateRenderingListener(childNode, renderer));
    } else if (relationNodeModel.getChildRelations().size() > 0) {
        // add dummy relation node
        childNode.addNode();
        childNode.addTreeNodeListener(new TreeNodeExpansionListener(childNode, relationNodeModel, bean));
        if (expansionCacheEnabled) {
            childNode.addTreeNodeListener(new TreeNodeExpansionTrackingListener(childNode));
        }
    }
    // register listener that removes node from nodes map on dispose
    childNode.addDisposeListener(new TreeNodeDisposeListener(childNode));
    // auto expand the child node if necessary
    if (!bean.isDummy() && childNode.getLevel() < autoExpandLevel && !childNode.isLeaf()) {
        childNode.setExpanded(true);
    }
    if (expandedNodesCache.contains(new ExpandedNodeKey(childNode))) {
        childNode.setExpanded(true);
    }
}
Also used : IDisposeListener(org.jowidgets.api.controller.IDisposeListener) MenuModelKeyBinding(org.jowidgets.tools.model.item.MenuModelKeyBinding) IBeanProxy(org.jowidgets.cap.ui.api.bean.IBeanProxy) IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) ITreeNode(org.jowidgets.api.widgets.ITreeNode)

Aggregations

IDisposeListener (org.jowidgets.api.controller.IDisposeListener)3 IPasswordChangeDialog (org.jowidgets.api.widgets.IPasswordChangeDialog)1 ITreeNode (org.jowidgets.api.widgets.ITreeNode)1 IPasswordChangeDialogBluePrint (org.jowidgets.api.widgets.blueprint.IPasswordChangeDialogBluePrint)1 IBeanProxy (org.jowidgets.cap.ui.api.bean.IBeanProxy)1 IBeanSelectionEvent (org.jowidgets.cap.ui.api.bean.IBeanSelectionEvent)1 IBeanSelectionListener (org.jowidgets.cap.ui.api.bean.IBeanSelectionListener)1 IBeanRelationNodeModel (org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel)1 MenuModelKeyBinding (org.jowidgets.tools.model.item.MenuModelKeyBinding)1