Package org.apache.cayenne.modeler.action

Examples of org.apache.cayenne.modeler.action.ActionManager


    /**
     * Updates MultipleObjectActions' state, depending on number of selected objects
     * (attributes, rel etc.)
     */
    public static void updateActions(int numSelected, Class<? extends Action>... actions) {
        ActionManager actionManager = Application.getInstance().getActionManager();

        for (Class<? extends Action> actionType : actions) {
            Action action = actionManager.getAction(actionType);

            if (action instanceof MultipleObjectsAction) {

                MultipleObjectsAction multiObjectAction = (MultipleObjectsAction) action;
                multiObjectAction.setEnabled(numSelected > 0);
View Full Code Here


    }

    private void initView() {

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();
        toolBar.add(actionManager.getAction(CreateObjEntityAction.class).buildButton());
        toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton());
        toolBar.addSeparator();

        toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
        toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton());
        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
        toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton());

        // create widgets
        name = new TextAdapter(new JTextField()) {

            protected void updateModel(String text) {
View Full Code Here

    protected void init() {
        this.setLayout(new BorderLayout());

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();
        toolBar.add(actionManager.getAction(CreateObjEntityAction.class).buildButton());
        toolBar
                .add(actionManager
                        .getAction(CreateRelationshipAction.class)
                        .buildButton());
        toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton());
        toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton());

        toolBar.addSeparator();

        resolve = new JButton();

        Icon ico = ModelerUtil.buildIcon("icon-info.gif");

        resolve.setIcon(ico);
        resolve.setToolTipText("Database Mapping");
        toolBar.add(resolve);

        toolBar.addSeparator();

        toolBar
                .add(actionManager
                        .getAction(RemoveRelationshipAction.class)
                        .buildButton());

        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(CutRelationshipAction.class).buildButton());
        toolBar.add(actionManager.getAction(CopyRelationshipAction.class).buildButton());
        toolBar.add(actionManager.getAction(PasteAction.class).buildButton());

        add(toolBar, BorderLayout.NORTH);

        table = new CayenneTable();
        table.setDefaultRenderer(DbEntity.class, CellRenderers
                .entityTableRendererWithIcons(mediator));

        tablePreferences = new TableColumnPreferences(
                DbRelationshipTableModel.class,
                "relationshipTable");

        /**
         * Create and install a popup
         */
        resolveMenu = new JMenuItem("Database Mapping", ico);

        JPopupMenu popup = new JPopupMenu();
        popup.add(resolveMenu);
        popup.add(actionManager.getAction(RemoveRelationshipAction.class).buildMenu());

        popup.addSeparator();
        popup.add(actionManager.getAction(CutRelationshipAction.class).buildMenu());
        popup.add(actionManager.getAction(CopyRelationshipAction.class).buildMenu());
        popup.add(actionManager.getAction(PasteAction.class).buildMenu());

        TablePopupHandler.install(table, popup);

        add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);

        actionManager.setupCutCopyPaste(
                table,
                CutRelationshipAction.class,
                CopyRelationshipAction.class);
    }
View Full Code Here

        addChangeListener(this);
    }

    /** Reset the remove buttons */
    private void resetRemoveButtons() {
        ActionManager actionManager = Application.getInstance().getActionManager();

        actionManager.getAction(RemoveAttributeAction.class).setEnabled(false);
        actionManager.getAction(RemoveRelationshipAction.class).setEnabled(false);
    }
View Full Code Here

        });
    }

    /** Reset the remove buttons */
    private void resetRemoveButtons() {
        ActionManager actionManager = Application.getInstance().getActionManager();

        actionManager.getAction(RemoveAttributeAction.class).setEnabled(false);
        actionManager.getAction(RemoveRelationshipAction.class).setEnabled(false);
        actionManager.getAction(RemoveCallbackMethodAction.class).setEnabled(false);
    }
View Full Code Here

    private void init() {
        this.setLayout(new BorderLayout());

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();
        toolBar
                .add(actionManager
                        .getAction(CreateRelationshipAction.class)
                        .buildButton());
        toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton());
        toolBar.add(actionManager.getAction(ObjEntityCounterpartAction.class).buildButton());

        toolBar.addSeparator();

        Icon ico = ModelerUtil.buildIcon("icon-info.gif");

        resolve = new JButton();
        resolve.setIcon(ico);
        resolve.setToolTipText("Edit Relationship");
        toolBar.add(resolve);

        toolBar.addSeparator();

        toolBar
                .add(actionManager
                        .getAction(RemoveRelationshipAction.class)
                        .buildButton());

        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(CutRelationshipAction.class).buildButton());
        toolBar.add(actionManager.getAction(CopyRelationshipAction.class).buildButton());
        toolBar.add(actionManager.getAction(PasteAction.class).buildButton());

        add(toolBar, BorderLayout.NORTH);

        table = new CayenneTable();
        table.setDefaultRenderer(String.class, new StringRenderer());
        table.setDefaultRenderer(ObjEntity.class, new EntityRenderer());

        tablePreferences = new TableColumnPreferences(
                ObjRelationshipTableModel.class,
                "objEntity/relationshipTable");

        /**
         * Create and install a popup
         */
        resolveMenu = new JMenuItem("Database Mapping", ico);

        JPopupMenu popup = new JPopupMenu();
        popup.add(resolveMenu);
        popup.add(actionManager.getAction(RemoveRelationshipAction.class).buildMenu());

        popup.addSeparator();
        popup.add(actionManager.getAction(CutRelationshipAction.class).buildMenu());
        popup.add(actionManager.getAction(CopyRelationshipAction.class).buildMenu());
        popup.add(actionManager.getAction(PasteAction.class).buildMenu());

        TablePopupHandler.install(table, popup);

        add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
    }
View Full Code Here

    private void init() {
        this.setLayout(new BorderLayout());

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();

        toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
        toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton());
        toolBar.add(actionManager.getAction(ObjEntityCounterpartAction.class).buildButton());
        toolBar.addSeparator();

        Icon ico = ModelerUtil.buildIcon("icon-info.gif");

        resolve = new JButton();
        resolve.setIcon(ico);
        resolve.setToolTipText("Edit Attribute");
        toolBar.add(resolve);

        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(RemoveAttributeAction.class).buildButton());

        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(CutAttributeAction.class).buildButton());
        toolBar.add(actionManager.getAction(CopyAttributeAction.class).buildButton());
        toolBar.add(actionManager.getAction(PasteAction.class).buildButton());

        add(toolBar, BorderLayout.NORTH);

        table = new CayenneTable();
        table.setDefaultRenderer(String.class, new CellRenderer());

        tablePreferences = new TableColumnPreferences(
                ObjAttributeTableModel.class,
                "objEntity/attributeTable");

        // Create and install a popup
        JPopupMenu popup = new JPopupMenu();
        popup.add(actionManager.getAction(RemoveAttributeAction.class).buildMenu());

        popup.addSeparator();
        popup.add(actionManager.getAction(CutAttributeAction.class).buildMenu());
        popup.add(actionManager.getAction(CopyAttributeAction.class).buildMenu());
        popup.add(actionManager.getAction(PasteAction.class).buildMenu());

        TablePopupHandler.install(table, popup);

        add(PanelFactory.createTablePanel(table, null), BorderLayout.CENTER);
    }
View Full Code Here

            }
        };

        resolve.addActionListener(resolver);

        ActionManager actionManager = Application.getInstance().getActionManager();
        actionManager.setupCutCopyPaste(
                table,
                CutAttributeAction.class,
                CopyAttributeAction.class);
    }
View Full Code Here

    private void initView() {
        this.setLayout(new BorderLayout());

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();

        toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton());
        toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
        toolBar
                .add(actionManager
                        .getAction(CreateRelationshipAction.class)
                        .buildButton());
        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
        toolBar.add(actionManager.getAction(ObjEntityCounterpartAction.class).buildButton());
        add(toolBar, BorderLayout.NORTH);

        // create widgets
        name = new TextAdapter(new JTextField()) {
View Full Code Here

    private void initView() {
        this.setLayout(new BorderLayout());

        JToolBar toolBar = new JToolBar();
        ActionManager actionManager = Application.getInstance().getActionManager();

        toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton());
        toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
        toolBar
                .add(actionManager
                        .getAction(CreateRelationshipAction.class)
                        .buildButton());
        toolBar.addSeparator();
        toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
        add(toolBar, BorderLayout.NORTH);

        // create widgets
        name = new TextAdapter(new JTextField()) {
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.action.ActionManager

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.