Search in sources :

Example 11 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class OutputDataMapTableView method createFiltersTable.

protected void createFiltersTable() {
    this.extendedTableViewerForFilters = new AbstractExtendedTableViewer<FilterTableEntry>(((OutputTable) abstractDataMapTable).getTableFiltersEntriesModel(), centerComposite) {

        @Override
        protected void createColumns(TableViewerCreator<FilterTableEntry> tableViewerCreator, Table table) {
            createFiltersColumns(tableViewerCreator);
        }

        /*
             * (non-Javadoc)
             * 
             * @see
             * org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
             * (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
             */
        @Override
        protected void setTableViewerCreatorOptions(TableViewerCreator<FilterTableEntry> newTableViewerCreator) {
            super.setTableViewerCreatorOptions(newTableViewerCreator);
            newTableViewerCreator.setColumnsResizableByDefault(false);
            newTableViewerCreator.setBorderVisible(false);
            newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
            newTableViewerCreator.setKeyboardManagementForCellEdition(true);
            // tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
            // instanceof
            // AbstractInOutTable);
            newTableViewerCreator.setFirstColumnMasked(true);
        }
    };
    tableViewerCreatorForFilters = this.extendedTableViewerForFilters.getTableViewerCreator();
    this.extendedTableViewerForFilters.setCommandStack(mapperManager.getCommandStack());
    tableForConstraints = tableViewerCreatorForFilters.getTable();
    tableForConstraintsGridData = new GridData(GridData.FILL_HORIZONTAL);
    tableForConstraints.setLayoutData(tableForConstraintsGridData);
    boolean tableConstraintsVisible = false;
    if (abstractDataMapTable instanceof OutputTable) {
        tableConstraintsVisible = ((OutputTable) abstractDataMapTable).getFilterEntries().size() > 0;
    }
    tableForConstraintsGridData.exclude = !tableConstraintsVisible;
    tableForConstraints.setVisible(tableConstraintsVisible);
    if (!mapperManager.componentIsReadOnly()) {
        new DragNDrop(mapperManager, tableForConstraints, false, true);
    }
    tableViewerCreatorForFilters.addCellValueModifiedListener(new ITableCellValueModifiedListener() {

        public void cellValueModified(TableCellValueModifiedEvent e) {
            unselectAllEntriesIfErrorDetected(e);
        }
    });
    final TableViewer tableViewer = tableViewerCreatorForFilters.getTableViewer();
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            selectThisDataMapTableView();
            UIManager uiManager = mapperManager.getUiManager();
            uiManager.selectLinks(OutputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
        }
    });
    tableForConstraints.addListener(SWT.KeyDown, new Listener() {

        public void handleEvent(Event event) {
            processEnterKeyDown(tableViewerCreatorForFilters, event);
        }
    });
    tableViewerCreatorForFilters.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForFilters) {

        @Override
        public Color getBackground(Object element, int columnIndex) {
            return getBackgroundCellColor(tableViewerCreator, element, columnIndex);
        }

        @Override
        public Color getForeground(Object element, int columnIndex) {
            return getForegroundCellColor(tableViewerCreator, element, columnIndex);
        }
    });
    initShowMessageErrorListener(tableForConstraints);
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) Table(org.eclipse.swt.widgets.Table) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) OutputTable(org.talend.designer.mapper.model.table.OutputTable) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Color(org.eclipse.swt.graphics.Color) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) UIManager(org.talend.designer.mapper.managers.UIManager) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) OutputTable(org.talend.designer.mapper.model.table.OutputTable) DragNDrop(org.talend.designer.mapper.ui.dnd.DragNDrop) GridData(org.eclipse.swt.layout.GridData) ISelection(org.eclipse.jface.viewers.ISelection) DefaultTableLabelProvider(org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider) FocusEvent(org.eclipse.swt.events.FocusEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) TableViewer(org.eclipse.jface.viewers.TableViewer) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)

Example 12 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class StyledTextHandler method highlightLineOfCursorPosition.

public int highlightLineOfCursorPosition(Point cursorPosition) {
    int countCR = 0;
    if (cursorPosition.y > 0 && cursorPosition.y <= this.styledText.getCharCount()) {
        countCR = this.styledText.getLineAtOffset(cursorPosition.y);
    }
    // System.out.println("\n"+countCR);
    int lineCount = this.styledText.getLineCount();
    // System.out.println(lineCount);
    Color whiteColor = this.styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE);
    this.styledText.setLineBackground(0, lineCount, whiteColor);
    this.styledText.redraw();
    this.styledText.setLineBackground(countCR, 1, ColorProviderMapper.getColor(ColorInfo.COLOR_HIGHLIGHTED_TEXT_ROW));
    return countCR;
}
Also used : Color(org.eclipse.swt.graphics.Color) Point(org.eclipse.swt.graphics.Point)

Example 13 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class ProcessComposite method processMessage.

private boolean processMessage(StringBuffer consoleText, IProcessMessage message, int startLength, List<StyleRange> styles) {
    String content = message.getContent();
    int lengthBeforeAdd = consoleText.length();
    //$NON-NLS-1$
    String[] contents = content.split("\n");
    for (String content2 : contents) {
        if (isPattern(content2) || isPatternFor(content2)) {
            //$NON-NLS-1$
            consoleText.append("");
            //$NON-NLS-1$
            content = "";
        } else {
            consoleText.append(content2);
            //$NON-NLS-1$
            consoleText.append("\n");
        }
    }
    boolean newStyle = false;
    if (message.getType() != MsgType.STD_OUT) {
        StyleRange style = new StyleRange();
        style.start = startLength + lengthBeforeAdd;
        style.length = content.length();
        if (message.getType() == MsgType.CORE_OUT || message.getType() == MsgType.CORE_ERR) {
            style.fontStyle = SWT.ITALIC;
        }
        Color color = getColor((MsgType) message.getType());
        style.foreground = color;
        if ((style.start + style.length) > (startLength + consoleText.length())) {
            style.length = startLength + consoleText.length() - style.start;
        }
        styles.add(style);
        newStyle = true;
    }
    return newStyle;
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Color(org.eclipse.swt.graphics.Color) Point(org.eclipse.swt.graphics.Point)

Example 14 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class WebServiceTableLiner method initStyleLink.

private void initStyleLink() {
    IStyleLink sStyleLink = this.getSelectedStyleLink();
    if (sStyleLink == null) {
        sStyleLink = createStandardLink(new Color(getBgDrawableComposite().getDisplay(), 255, 102, 102));
        this.setSelectedStyleLink(sStyleLink);
    }
    IStyleLink uStyleLink = this.getUnselectedStyleLink();
    if (uStyleLink == null) {
        sStyleLink = createStandardLink(getBgDrawableComposite().getDisplay().getSystemColor(SWT.COLOR_GRAY));
        this.setUnselectedStyleLink(sStyleLink);
    }
}
Also used : Color(org.eclipse.swt.graphics.Color) IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink)

Example 15 with Color

use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.

the class WebServiceTableLiner method addLinks.

public void addLinks(TableItem itemSource, Object data1, Table tableTarget, Object data2, String mark) {
    LinkDescriptor<TableItem, Object, Table, Object> link = new LinkDescriptor<TableItem, Object, Table, Object>(new TableExtremityDescriptor(itemSource, data1), new ExtremityLink<Table, Object>(tableTarget, data2));
    link.setStyleLink(createStandardLink(new Color(getBgDrawableComposite().getDisplay(), 255, 102, 102)));
    getLinksManager().addLink(link);
    if (mark.equals("INPUTMAPPING")) {
        sourceInList.add(((IMetadataColumn) itemSource.getData()).getLabel());
    } else if (mark.equals("OUTPUTMAPPING")) {
        if (((OutPutMappingData) itemSource.getData()).getParameterName() != null) {
            String sourseName = ((OutPutMappingData) itemSource.getData()).getParameterName();
            // int m = sourseName.lastIndexOf(".");
            // sourseName = sourseName.substring(m + 1);
            sourceOutList.add(sourseName);
        } else {
            sourceOutList.add(((OutPutMappingData) itemSource.getData()).getParameter().getName());
        }
    }
}
Also used : TableExtremityDescriptor(org.talend.commons.ui.swt.drawing.link.TableExtremityDescriptor) Table(org.eclipse.swt.widgets.Table) OutPutMappingData(org.talend.designer.webservice.data.OutPutMappingData) TableItem(org.eclipse.swt.widgets.TableItem) Color(org.eclipse.swt.graphics.Color) LinkDescriptor(org.talend.commons.ui.swt.drawing.link.LinkDescriptor)

Aggregations

Color (org.eclipse.swt.graphics.Color)1008 Point (org.eclipse.swt.graphics.Point)145 RGB (org.eclipse.swt.graphics.RGB)127 GridData (org.eclipse.swt.layout.GridData)120 Composite (org.eclipse.swt.widgets.Composite)118 Rectangle (org.eclipse.swt.graphics.Rectangle)116 Image (org.eclipse.swt.graphics.Image)115 GridLayout (org.eclipse.swt.layout.GridLayout)99 Display (org.eclipse.swt.widgets.Display)97 Test (org.junit.Test)95 Font (org.eclipse.swt.graphics.Font)86 Label (org.eclipse.swt.widgets.Label)79 GC (org.eclipse.swt.graphics.GC)74 SelectionEvent (org.eclipse.swt.events.SelectionEvent)65 Shell (org.eclipse.swt.widgets.Shell)54 ArrayList (java.util.ArrayList)51 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)51 StyleRange (org.eclipse.swt.custom.StyleRange)49 TableItem (org.eclipse.swt.widgets.TableItem)48 Button (org.eclipse.swt.widgets.Button)45