Search in sources :

Example 1 with MouseListener

use of org.eclipse.draw2d.MouseListener in project tdi-studio-se by Talend.

the class ToolBarButtonImageFigure method initlistener.

/**
     * DOC Administrator Comment method "initlistener".
     */
protected void initlistener() {
    listener = new MouseMotionListener() {

        @Override
        public void mouseMoved(MouseEvent me) {
        }

        @Override
        public void mouseHover(MouseEvent me) {
            addLineBorder();
            setHoverColor();
        }

        @Override
        public void mouseExited(MouseEvent me) {
            if (Clickable.STYLE_TOGGLE == getStyle()) {
                if (!isSelected()) {
                    removeLineBorder();
                    setBackgroundColor(getContainerBgColor(ToolBarButtonImageFigure.this));
                }
            } else {
                removeLineBorder();
                setBackgroundColor(getContainerBgColor(ToolBarButtonImageFigure.this));
            }
        }

        @Override
        public void mouseEntered(MouseEvent me) {
        }

        @Override
        public void mouseDragged(MouseEvent me) {
        }
    };
    this.addMouseMotionListener(listener);
    this.addMouseListener(new MouseListener() {

        @Override
        public void mousePressed(MouseEvent me) {
            toolBarButtonPressed(me);
        }

        @Override
        public void mouseReleased(MouseEvent me) {
        // TODO Auto-generated method stub
        }

        @Override
        public void mouseDoubleClicked(MouseEvent me) {
        // TODO Auto-generated method stub
        }
    });
}
Also used : MouseEvent(org.eclipse.draw2d.MouseEvent) MouseListener(org.eclipse.draw2d.MouseListener) MouseMotionListener(org.eclipse.draw2d.MouseMotionListener)

Example 2 with MouseListener

use of org.eclipse.draw2d.MouseListener in project tdi-studio-se by Talend.

the class XmlMapFilterContainer method addButtonListener.

@Override
protected void addButtonListener() {
    IService expressionBuilderDialogService = GlobalServiceRegister.getDefault().getService(IExpressionBuilderDialogService.class);
    final IExpressionBuilderDialogController dialog = ((IExpressionBuilderDialogService) expressionBuilderDialogService).getExpressionBuilderInstance(parent, null, null);
    button.addMouseListener(new MouseListener() {

        @Override
        public void mousePressed(MouseEvent me) {
            if (dialog instanceof TrayDialog) {
                TrayDialog parentDialog = (TrayDialog) dialog;
                // if press the button ,should apply ExpressionCellEditor value
                MapperManager mapperManger = (MapperManager) tableManager.getMapperManger();
                mapperManger.fireCurrentDirectEditApply();
                dialog.setDefaultExpression(tableManager.getExpressionFilter());
                if (Window.OK == parentDialog.open()) {
                    String expressionForTable = dialog.getExpressionForTable();
                    tableManager.setExpressionFilter(expressionForTable);
                    tableManager.getEditPart().getViewer().getEditDomain().getCommandStack().execute(getFilterChangeCommand(tableManager.getModel(), expressionForTable));
                }
            }
        }

        @Override
        public void mouseReleased(MouseEvent me) {
        // TODO Auto-generated method stub
        }

        @Override
        public void mouseDoubleClicked(MouseEvent me) {
        // TODO Auto-generated method stub
        }
    });
}
Also used : IExpressionBuilderDialogService(org.talend.core.runtime.services.IExpressionBuilderDialogService) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent) MapperManager(org.talend.designer.xmlmap.ui.tabs.MapperManager) IExpressionBuilderDialogController(org.talend.commons.ui.runtime.expressionbuilder.IExpressionBuilderDialogController) TrayDialog(org.eclipse.jface.dialogs.TrayDialog) IService(org.talend.core.IService)

Example 3 with MouseListener

use of org.eclipse.draw2d.MouseListener in project tdi-studio-se by Talend.

the class GlobalMapKeysTable method createColumns.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.gefabstractmap.figures.table.AbstractTable#createColumns()
     */
@Override
protected void createColumns() {
    layoutManager.setAjustToTableWidth(false);
    if (inputxmlTree != null && inputxmlTree.isLookup()) {
        expressionColumn = new TableColumn(ColumnKeyConstant.KEY_EXPRESSION);
        expressionColumn.setText(Messages.getString("InputTreeGlobalMapKeysTable.expressionTitle"));
        addColumn(expressionColumn);
        columnSash = new ColumnSash(this);
        columnSash.setLeftColumn(expressionColumn);
        addSeparator(columnSash);
        globalMapKeyColumn = new TableColumn(ColumnKeyConstant.KEY_NAME);
        globalMapKeyColumn.setText(Messages.getString("InputTreeGlobalMapKeysTable.globalMapKeyTitle"));
        columnSash.setRightColumn(globalMapKeyColumn);
        addColumn(globalMapKeyColumn);
        columnSash = new ColumnSash(this);
        columnSash.setLeftColumn(globalMapKeyColumn);
        addSeparator(columnSash);
        addColumn = new TableColumn(ColumnKeyConstant.KEY_VARIABLE);
        addColumn.setIcon(ImageProviderMapper.getImage(ImageInfo.ADD));
        addColumn.setLabelAlignment(PositionConstants.BOTTOM);
        columnSash.setRightColumn(addColumn);
        addColumn.setBorder(new MarginBorder(2));
        addColumn(addColumn);
        // add Listener
        addColumn.addMouseListener(new MouseListener() {

            @Override
            public void mousePressed(MouseEvent me) {
                GlobalMapNode defaultGlobalMapNode = XmlmapFactory.eINSTANCE.createGlobalMapNode();
                defaultGlobalMapNode.setExpression("");
                defaultGlobalMapNode.setName("\"myKey\"");
                inputxmlTree.getGlobalMapKeysValues().add(defaultGlobalMapNode);
            }

            @Override
            public void mouseReleased(MouseEvent me) {
            }

            @Override
            public void mouseDoubleClicked(MouseEvent me) {
            }
        });
    }
}
Also used : MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent) MarginBorder(org.eclipse.draw2d.MarginBorder) GlobalMapNode(org.talend.designer.xmlmap.model.emf.xmlmap.GlobalMapNode) ColumnSash(org.talend.designer.gefabstractmap.figures.table.ColumnSash) TableColumn(org.talend.designer.gefabstractmap.figures.table.TableColumn)

Example 4 with MouseListener

use of org.eclipse.draw2d.MouseListener in project tdi-studio-se by Talend.

the class OutputTreeSettingTable method createColumns.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.table.AbstractTable#createColumns()
     */
@Override
protected void createColumns() {
    TableColumn column = new TableColumn(ColumnKeyConstant.TREE_SETTING_PROPERTY);
    column.setText("Property");
    addColumn(column);
    ColumnSash sash = new ColumnSash(this);
    sash.setLeftColumn(column);
    addSeparator(sash);
    column = new TableColumn(ColumnKeyConstant.TREE_SETTING_VALUE);
    column.setText("Value");
    sash.setRightColumn(column);
    addColumn(column);
    settingsContainer = getTableItemContainer();
    rejectRow = new Figure();
    rejectRow.setLayoutManager(new RowLayout());
    Label label = new Label();
    label.setText("Catch Output Reject");
    label.setLabelAlignment(PositionConstants.LEFT);
    CompoundBorder compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    rejectRow.add(label);
    reject = new ComboCellLabel();
    reject.setDirectEditType(DirectEditType.OUTPUT_REJECT);
    reject.setText(String.valueOf(outputxmlTree.isReject()));
    reject.setLabelAlignment(PositionConstants.LEFT);
    reject.setBorder(new RowBorder(2, 5, 2, -1));
    rejectRow.add(reject);
    settingsContainer.add(rejectRow);
    innerJoinRejectRow = new Figure();
    innerJoinRejectRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Catch Lookup Inner Join Reject");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    innerJoinRejectRow.add(label);
    innerJoinReject = new ComboCellLabel();
    innerJoinReject.setDirectEditType(DirectEditType.LOOK_UP_INNER_JOIN_REJECT);
    innerJoinReject.setText(String.valueOf(outputxmlTree.isRejectInnerJoin()));
    innerJoinReject.setLabelAlignment(PositionConstants.LEFT);
    innerJoinReject.setBorder(new RowBorder(2, 5, 2, -1));
    innerJoinRejectRow.add(innerJoinReject);
    settingsContainer.add(innerJoinRejectRow);
    allInOneRow = new Figure();
    allInOneRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("All in one");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    allInOneRow.add(label);
    allInOne = new ComboCellLabel();
    allInOne.setDirectEditType(DirectEditType.ALL_IN_ONE);
    allInOne.setText(String.valueOf(outputxmlTree.isAllInOne()));
    allInOne.setLabelAlignment(PositionConstants.LEFT);
    allInOne.setBorder(new RowBorder(2, 5, 2, -1));
    allInOneRow.add(allInOne);
    // container.add(allInOneRow);
    enableEmptyElementRow = new Figure();
    enableEmptyElementRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Create empty element");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    enableEmptyElementRow.add(label);
    enableEmptyElement = new ComboCellLabel();
    enableEmptyElement.setDirectEditType(DirectEditType.ENABLE_EMPTY_ELEMENT);
    enableEmptyElement.setText(String.valueOf(outputxmlTree.isEnableEmptyElement()));
    enableEmptyElement.setLabelAlignment(PositionConstants.LEFT);
    enableEmptyElement.setBorder(new RowBorder(2, 5, 2, -1));
    enableEmptyElementRow.add(enableEmptyElement);
    // container.add(enableEmptyElementRow);
    showOrHideDocumentSetting();
    settingsContainer.setOpaque(true);
    settingsContainer.setBackgroundColor(ColorConstants.white);
    // show selection
    settingsContainer.addMouseListener(new MouseListener() {

        Figure selectedFigure = null;

        @Override
        public void mousePressed(MouseEvent me) {
            boolean joinModel = rejectRow.containsPoint(me.x, me.y);
            if (joinModel) {
                if (selectedFigure != rejectRow) {
                    rejectRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    rejectRow.setOpaque(true);
                    innerJoinRejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean persistentModel = innerJoinRejectRow.containsPoint(me.x, me.y);
            if (persistentModel) {
                if (selectedFigure != innerJoinRejectRow) {
                    innerJoinRejectRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    innerJoinRejectRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean allInOne = allInOneRow.containsPoint(me.x, me.y);
            if (allInOne) {
                if (selectedFigure != allInOneRow) {
                    allInOneRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    allInOneRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    innerJoinRejectRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean emptyElement = enableEmptyElementRow.containsPoint(me.x, me.y);
            if (emptyElement) {
                if (selectedFigure != enableEmptyElementRow) {
                    enableEmptyElementRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    enableEmptyElementRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    innerJoinRejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                }
            }
        }

        @Override
        public void mouseReleased(MouseEvent me) {
        }

        @Override
        public void mouseDoubleClicked(MouseEvent me) {
        }
    });
}
Also used : RowBorder(org.talend.designer.gefabstractmap.figures.borders.RowBorder) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent) RowLayout(org.talend.designer.gefabstractmap.figures.layout.RowLayout) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) Label(org.eclipse.draw2d.Label) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) CompoundBorder(org.eclipse.draw2d.CompoundBorder) ColumnSash(org.talend.designer.gefabstractmap.figures.table.ColumnSash) ColumnBorder(org.talend.designer.gefabstractmap.figures.borders.ColumnBorder) TableColumn(org.talend.designer.gefabstractmap.figures.table.TableColumn) Figure(org.eclipse.draw2d.Figure)

Example 5 with MouseListener

use of org.eclipse.draw2d.MouseListener in project knime-core by knime.

the class WorkflowInPortEditPart method createFigure.

/**
 * Creates {@link WorkflowInPortFigure}, sets the tooltip and adds a
 * {@link MouseListener} to the figure in order to detect if the figure was
 * clicked and a context menu entry should be provided to open the port
 * view.
 *
 * @see WorkflowContextMenuProvider#buildContextMenu(
 * org.eclipse.jface.action.IMenuManager)
 * @see WorkflowInPortFigure
 *
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    NodeOutPortUI port = getManager().getInPort(getIndex()).getUnderlyingPort();
    String tooltip = getTooltipText(PORT_NAME + ": " + getIndex(), port);
    WorkflowInPortFigure f = new WorkflowInPortFigure(getType(), getManager().getNrInPorts(), getIndex(), tooltip);
    f.addMouseListener(new MouseListener() {

        @Override
        public void mouseDoubleClicked(final MouseEvent me) {
        }

        /**
         * Set the selection state of the figure to true. This is
         * evaluated in the context menu. If it is selected a context menu
         * entry is provided to open the port view.
         *
         * @see WorkflowContextMenuProvider#buildContextMenu(
         *  org.eclipse.jface.action.IMenuManager)
         *
         * {@inheritDoc}
         */
        @Override
        public void mousePressed(final MouseEvent me) {
            setSelected(true);
        }

        /**
         * Set the selection state of the figure to true. This is
         * evaluated in the context menu. If it is selected a context menu
         * entry is provided to open the port view.
         *
         * @see WorkflowContextMenuProvider#buildContextMenu(
         *  org.eclipse.jface.action.IMenuManager)
         *
         * {@inheritDoc}
         */
        @Override
        public void mouseReleased(final MouseEvent me) {
            setSelected(false);
        }
    });
    return f;
}
Also used : WorkflowInPortFigure(org.knime.workbench.editor2.figures.WorkflowInPortFigure) NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent)

Aggregations

MouseListener (org.eclipse.draw2d.MouseListener)13 MouseEvent (org.eclipse.draw2d.MouseEvent)12 MouseMotionListener (org.eclipse.draw2d.MouseMotionListener)5 Figure (org.eclipse.draw2d.Figure)4 Label (org.eclipse.draw2d.Label)3 ColumnSash (org.talend.designer.gefabstractmap.figures.table.ColumnSash)3 TableColumn (org.talend.designer.gefabstractmap.figures.table.TableColumn)3 CompoundBorder (org.eclipse.draw2d.CompoundBorder)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Point (org.eclipse.draw2d.geometry.Point)2 ComboCellLabel (org.talend.designer.gefabstractmap.figures.ComboCellLabel)2 ColumnBorder (org.talend.designer.gefabstractmap.figures.borders.ColumnBorder)2 RowBorder (org.talend.designer.gefabstractmap.figures.borders.RowBorder)2 ALogger (de.fhg.igd.slf4jplus.ALogger)1 ALoggerFactory (de.fhg.igd.slf4jplus.ALoggerFactory)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 ResolvedTask (eu.esdihumboldt.hale.common.tasks.ResolvedTask)1 TaskService (eu.esdihumboldt.hale.common.tasks.TaskService)1 HaleUI (eu.esdihumboldt.hale.ui.HaleUI)1 CommonSharedImages (eu.esdihumboldt.hale.ui.common.CommonSharedImages)1