Search in sources :

Example 1 with MoveNodeLabelCommand

use of org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand in project tdi-studio-se by Talend.

the class NodeContainerLayoutEditPolicy method createChangeConstraintCommand.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
     * java.lang.Object)
     */
@Override
protected Command createChangeConstraintCommand(final EditPart child, final Object constraint) {
    if (child instanceof NodeLabelEditPart) {
        boolean nodeSelected;
        // if (((NodeLabelEditPart) child).getNodePart().getSelected() != 0) {
        // nodeSelected = true;
        // } else {
        nodeSelected = false;
        // }
        MoveNodeLabelCommand locationCommand = new MoveNodeLabelCommand((NodeLabel) child.getModel(), ((Rectangle) constraint).getLocation(), nodeSelected);
        return locationCommand;
    } else if (child instanceof NodePart) {
        if (((Node) child.getModel()).isReadOnly() && !((Node) child.getModel()).isForceReadOnly()) {
            return null;
        }
        MoveNodeCommand locationCommand = new MoveNodeCommand((Node) child.getModel(), ((Rectangle) constraint).getLocation());
        return locationCommand;
    } else {
        return null;
    }
}
Also used : MoveNodeLabelCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand) MoveNodeCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeCommand) Node(org.talend.designer.core.ui.editor.nodes.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 2 with MoveNodeLabelCommand

use of org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand in project tdi-studio-se by Talend.

the class SubjobContainerLayoutEditPolicy method createAddCommand.

// ------------------------------------------------------------------------
// Abstract methods from ConstrainedLayoutEditPolicy
/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand(org.eclipse.gef.EditPart,
     * java.lang.Object)
     */
protected Command createAddCommand(final EditPart child, final Object constraint) {
    if (child instanceof NoteEditPart) {
        if (((Note) child.getModel()).isReadOnly()) {
            return null;
        }
        MoveNoteCommand locationCommand = new MoveNoteCommand((Note) child.getModel(), ((Rectangle) constraint).getLocation());
        return locationCommand;
    }
    if (child instanceof NodeLabelEditPart) {
        boolean nodeSelected;
        // if (((NodeLabelEditPart) child).getNodePart().getSelected() != 0) {
        // nodeSelected = true;
        // } else {
        nodeSelected = false;
        // }
        MoveNodeLabelCommand locationCommand = new MoveNodeLabelCommand((NodeLabel) child.getModel(), ((Rectangle) constraint).getLocation(), nodeSelected);
        return locationCommand;
    } else if (child instanceof NodePart) {
        if (((Node) child.getModel()).isReadOnly()) {
            return null;
        }
        MoveNodeCommand locationCommand = new MoveNodeCommand((Node) child.getModel(), ((Rectangle) constraint).getLocation());
        return locationCommand;
    } else {
        return null;
    }
}
Also used : MoveNodeLabelCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand) MoveNodeCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeCommand) Note(org.talend.designer.core.ui.editor.notes.Note) Node(org.talend.designer.core.ui.editor.nodes.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) MoveNoteCommand(org.talend.designer.core.ui.editor.cmd.MoveNoteCommand) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 3 with MoveNodeLabelCommand

use of org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand in project tdi-studio-se by Talend.

the class SubjobContainerLayoutEditPolicy method createChangeConstraintCommand.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
     * java.lang.Object)
     */
protected Command createChangeConstraintCommand(final EditPart child, final Object constraint) {
    if (child instanceof NoteEditPart) {
        if (((Note) child.getModel()).isReadOnly()) {
            return null;
        }
        MoveNoteCommand locationCommand = new MoveNoteCommand((Note) child.getModel(), ((Rectangle) constraint).getLocation());
        return locationCommand;
    }
    if (child instanceof NodeLabelEditPart) {
        boolean nodeSelected;
        // if (((NodeLabelEditPart) child).getNodePart().getSelected() != 0) {
        // nodeSelected = true;
        // } else {
        nodeSelected = false;
        // }
        MoveNodeLabelCommand locationCommand = new MoveNodeLabelCommand((NodeLabel) child.getModel(), ((Rectangle) constraint).getLocation(), nodeSelected);
        return locationCommand;
    } else if (child instanceof NodePart) {
        if (((Node) child.getModel()).isReadOnly()) {
            return null;
        }
        MoveNodeCommand locationCommand = new MoveNodeCommand((Node) child.getModel(), ((Rectangle) constraint).getLocation());
        return locationCommand;
    } else {
        return null;
    }
}
Also used : MoveNodeLabelCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand) MoveNodeCommand(org.talend.designer.core.ui.editor.cmd.MoveNodeCommand) Note(org.talend.designer.core.ui.editor.notes.Note) Node(org.talend.designer.core.ui.editor.nodes.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) MoveNoteCommand(org.talend.designer.core.ui.editor.cmd.MoveNoteCommand) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Aggregations

Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 MoveNodeCommand (org.talend.designer.core.ui.editor.cmd.MoveNodeCommand)3 MoveNodeLabelCommand (org.talend.designer.core.ui.editor.cmd.MoveNodeLabelCommand)3 Node (org.talend.designer.core.ui.editor.nodes.Node)3 NodeLabelEditPart (org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart)3 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)3 MoveNoteCommand (org.talend.designer.core.ui.editor.cmd.MoveNoteCommand)2 Note (org.talend.designer.core.ui.editor.notes.Note)2 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)2