Search in sources :

Example 1 with ComponentGeometry

use of org.apache.cayenne.modeler.pref.ComponentGeometry in project cayenne by apache.

the class ObjEntityAttributeRelationshipTab method init.

private void init() {
    this.setLayout(new BorderLayout());
    attributePanel = new ObjEntityAttributePanel(mediator, this);
    relationshipPanel = new ObjEntityRelationshipPanel(mediator, this);
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, attributePanel, relationshipPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    try {
        ComponentGeometry geometry = new ComponentGeometry(this.getClass(), "objEntityAttrRelTab/splitPane/divider");
        geometry.bindIntProperty(splitPane, JSplitPane.DIVIDER_LOCATION_PROPERTY, -1);
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("Cannot bind divider property", ex);
    }
    add(splitPane);
}
Also used : BorderLayout(java.awt.BorderLayout) ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) JSplitPane(javax.swing.JSplitPane)

Example 2 with ComponentGeometry

use of org.apache.cayenne.modeler.pref.ComponentGeometry in project cayenne by apache.

the class CayenneModelerController method initBindings.

protected void initBindings() {
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            PROJECT_STATE_UTIL.saveLastState(projectController);
            getApplication().getActionManager().getAction(ExitAction.class).exit();
        }
    });
    // This is in Mac OSX only.
    if (System.getProperty("os.name").startsWith("Mac OS")) {
        Runnable runner = new Runnable() {

            @Override
            public void run() {
                PROJECT_STATE_UTIL.saveLastState(projectController);
            }
        };
        Runtime.getRuntime().addShutdownHook(new Thread(runner, "Window Prefs Hook"));
    }
    new DropTarget(frame, new DropTargetAdapter() {

        @Override
        public void drop(DropTargetDropEvent dtde) {
            dtde.acceptDrop(dtde.getDropAction());
            Transferable transferable = dtde.getTransferable();
            dtde.dropComplete(processDropAction(transferable));
        }
    });
    ComponentGeometry geometry = new ComponentGeometry(frame.getClass(), null);
    geometry.bind(frame, 1200, 720, 0);
}
Also used : DropTargetAdapter(java.awt.dnd.DropTargetAdapter) ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) WindowEvent(java.awt.event.WindowEvent) Transferable(java.awt.datatransfer.Transferable) WindowAdapter(java.awt.event.WindowAdapter) DropTarget(java.awt.dnd.DropTarget) DropTargetDropEvent(java.awt.dnd.DropTargetDropEvent)

Example 3 with ComponentGeometry

use of org.apache.cayenne.modeler.pref.ComponentGeometry in project cayenne by apache.

the class DbEntityAttributeRelationshipTab method init.

private void init() {
    this.setLayout(new BorderLayout());
    attributePanel = new DbEntityAttributePanel(mediator, this);
    relationshipPanel = new DbEntityRelationshipPanel(mediator, this);
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, attributePanel, relationshipPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    try {
        ComponentGeometry geometry = new ComponentGeometry(this.getClass(), "dbEntityAttrRelTab/splitPane/divider");
        geometry.bindIntProperty(splitPane, JSplitPane.DIVIDER_LOCATION_PROPERTY, -1);
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("Cannot bind divider property", ex);
    }
    add(splitPane);
}
Also used : BorderLayout(java.awt.BorderLayout) ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) JSplitPane(javax.swing.JSplitPane)

Example 4 with ComponentGeometry

use of org.apache.cayenne.modeler.pref.ComponentGeometry in project cayenne by apache.

the class EditorView method initController.

private void initController() {
    this.filterController = new FilterController(eventController, treePanel);
    eventController.addDomainDisplayListener(this);
    eventController.addDataNodeDisplayListener(this);
    eventController.addDataMapDisplayListener(this);
    eventController.addObjEntityDisplayListener(this);
    eventController.addDbEntityDisplayListener(this);
    eventController.addProcedureDisplayListener(this);
    eventController.addQueryDisplayListener(this);
    eventController.addMultipleObjectsDisplayListener(this);
    eventController.addEmbeddableDisplayListener(this);
    // Moving this to try-catch block per CAY-940. Exception will be stack-traced
    try {
        ComponentGeometry geometry = new ComponentGeometry(this.getClass(), "splitPane/divider");
        geometry.bindIntProperty(splitPane, JSplitPane.DIVIDER_LOCATION_PROPERTY, 150);
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("Cannot bind divider property", ex);
    }
}
Also used : ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) FilterController(org.apache.cayenne.modeler.dialog.datadomain.FilterController)

Example 5 with ComponentGeometry

use of org.apache.cayenne.modeler.pref.ComponentGeometry in project cayenne by apache.

the class LogConsole method appear.

/**
 * Shows the console, in separate window or in main frame
 */
private void appear() {
    if (!getConsoleProperty(DOCKED_PROPERTY)) {
        view.setDocked(false);
        if (logWindow == null) {
            logWindow = new LogConsoleWindow(this);
            ComponentGeometry geometry = new ComponentGeometry(getClass(), null);
            geometry.bind(logWindow, 600, 300, 0);
        }
        logWindow.setContentPane(view);
        logWindow.validate();
        logWindow.setVisible(true);
    } else {
        view.setDocked(true);
        Application.getFrame().setDockComponent(view);
    }
}
Also used : ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry)

Aggregations

ComponentGeometry (org.apache.cayenne.modeler.pref.ComponentGeometry)6 JSplitPane (javax.swing.JSplitPane)3 BorderLayout (java.awt.BorderLayout)2 FlowLayout (java.awt.FlowLayout)1 Transferable (java.awt.datatransfer.Transferable)1 DropTarget (java.awt.dnd.DropTarget)1 DropTargetAdapter (java.awt.dnd.DropTargetAdapter)1 DropTargetDropEvent (java.awt.dnd.DropTargetDropEvent)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 FilterController (org.apache.cayenne.modeler.dialog.datadomain.FilterController)1