Search in sources :

Example 16 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project cubrid-manager by CUBRID.

the class BrokerStatusView method createPartControl.

/**
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 * 
	 * @param parent the parent composite
	 */
public void createPartControl(Composite parent) {
    final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    composite = new Composite(scrolledComp, SWT.NONE);
    composite.setLayout(new GridLayout());
    BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusBasicColumn, BrokerStatusBasicColumn.values());
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusAsColumn, BrokerStatusAsColumn.values());
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerStatusJqColumn, BrokerStatusJqColumn.values());
    if (isSupportNewBrokerParamPropery) {
        createBasicTable(composite);
    }
    createAsTable(composite);
    createJobTable(composite);
    makeActions();
    composite.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent event) {
            updateTableLayout();
        }
    });
    scrolledComp.setContent(composite);
    scrolledComp.setExpandHorizontal(true);
    scrolledComp.setExpandVertical(true);
    scrolledComp.setMinHeight(300);
    scrolledComp.setMinWidth(800);
    new StatusUpdate().start();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlAdapter(org.eclipse.swt.events.ControlAdapter) BrokerTblColumnSetHelp(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerTblColumnSetHelp) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 17 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project cubrid-manager by CUBRID.

the class InformationWindow method createContents.

protected Control createContents(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new FillLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    infoText = new StyledText(composite, SWT.None);
    infoText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    infoText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    infoText.setEditable(false);
    infoText.setEnabled(false);
    infoText.addMouseTrackListener(new MouseTrackListener() {

        public void mouseHover(MouseEvent e) {
            increaseAlpha();
        }

        public void mouseExit(MouseEvent e) {
            reduceAlpha();
        }

        public void mouseEnter(MouseEvent e) {
            increaseAlpha();
        }
    });
    parentShell.addControlListener(new ControlListener() {

        public void controlResized(ControlEvent e) {
            updateLocation();
        }

        public void controlMoved(ControlEvent e) {
            updateLocation();
        }
    });
    if (Platform.getOS().equals(Platform.OS_WIN32)) {
        parentShell.addPaintListener(new PaintListener() {

            public void paintControl(PaintEvent e) {
                updateLocation();
            }
        });
    }
    this.getShell().setAlpha(minAlpha);
    updateLocation();
    return parent;
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) CombinedQueryEditorComposite(com.cubrid.common.ui.query.control.CombinedQueryEditorComposite) Composite(org.eclipse.swt.widgets.Composite) PaintListener(org.eclipse.swt.events.PaintListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) GridData(org.eclipse.swt.layout.GridData) ControlListener(org.eclipse.swt.events.ControlListener) FillLayout(org.eclipse.swt.layout.FillLayout) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 18 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project cubrid-manager by CUBRID.

the class ChartCompositePart method createSeriesTable.

/**
	 * Create basic info table
	 *
	 * @param parent the parent composite
	 *
	 */
private void createSeriesTable(Composite parent) {
    final Composite comp = new Composite(parent, SWT.NONE);
    GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
    comp.setLayoutData(gdBasic);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    comp.setLayout(layout);
    final Label label = new Label(comp, SWT.CENTER);
    label.setText(Messages.tblSeriesTtl);
    seriesTableViewer = new TableViewer(comp, SWT.NO_SCROLL | SWT.BORDER);
    Table seriesTable = seriesTableViewer.getTable();
    seriesTable.setHeaderVisible(true);
    seriesTable.setLinesVisible(true);
    GridData tblSeries = new GridData(SWT.FILL, SWT.TOP, true, false);
    tblSeries.heightHint = CommonUITool.getHeightHintOfTable(seriesTable);
    seriesTable.setLayoutData(tblSeries);
    TableLayout seriesLayout = new TableLayout();
    setSeriesTableLayout(seriesLayout);
    seriesTable.setLayout(seriesLayout);
    TableColumn tblColumn = new TableColumn(seriesTable, SWT.CENTER);
    tblColumn.setText("");
    tblColumn.setResizable(false);
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        tblColumn = new TableColumn(seriesTable, SWT.CENTER);
        tblColumn.setText(entry.getKey());
        tblColumn.setToolTipText(entry.getKey());
        tblColumn.setResizable(false);
    }
    List<String[]> chartTblLst = new ArrayList<String[]>();
    String[] arrays = valueMap.values().toArray(new String[valueMap.size()]);
    String[] arrays2 = new String[arrays.length + 1];
    arrays2[0] = "";
    System.arraycopy(arrays, 0, arrays2, 1, arrays.length);
    chartTblLst.add(arrays2);
    ChartTableContentProvider chartTableContentProvider = new ChartTableContentProvider();
    seriesTableViewer.setContentProvider(chartTableContentProvider);
    seriesTableViewer.setLabelProvider(new ChartTableLabelProvider());
    seriesTableViewer.setInput(chartTblLst);
    int index = 0;
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(comp.getDisplay(), entry.getValue().getSeriesRgb());
        seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
        index++;
    }
    seriesTable.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent event) {
            updateTableLayout();
        }
    });
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) TableLayout(org.eclipse.jface.viewers.TableLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) ControlEvent(org.eclipse.swt.events.ControlEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 19 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project bndtools by bndtools.

the class RunPropertiesPart method createSection.

private void createSection(Section section, FormToolkit toolkit) {
    section.setText("Runtime Properties");
    final Composite composite = toolkit.createComposite(section);
    section.setClient(composite);
    // Create controls: Run Properties
    Label lblRunProperties = toolkit.createLabel(composite, "OSGi Framework properties:");
    tblRunProperties = toolkit.createTable(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    viewRunProperties = new TableViewer(tblRunProperties);
    runPropertiesModifier = new MapEntryCellModifier<>(viewRunProperties);
    tblRunProperties.setHeaderVisible(true);
    final TableColumn tblRunPropsCol1 = new TableColumn(tblRunProperties, SWT.NONE);
    tblRunPropsCol1.setText("Name");
    tblRunPropsCol1.setWidth(100);
    final TableColumn tblRunPropsCol2 = new TableColumn(tblRunProperties, SWT.NONE);
    tblRunPropsCol1.setText("Value");
    tblRunPropsCol1.setWidth(100);
    viewRunProperties.setUseHashlookup(true);
    viewRunProperties.setColumnProperties(MapEntryCellModifier.getColumnProperties());
    runPropertiesModifier.addCellEditorsToViewer();
    viewRunProperties.setCellModifier(runPropertiesModifier);
    viewRunProperties.setContentProvider(new MapContentProvider());
    viewRunProperties.setLabelProvider(new PropertiesTableLabelProvider());
    Control createRemovePropsToolBar = createRemovePropsPart.createControl(composite, SWT.FLAT | SWT.VERTICAL);
    // Create controls: program args
    Label lblProgramArgs = toolkit.createLabel(composite, "Launcher Arguments:");
    txtProgramArgs = toolkit.createText(composite, "", SWT.MULTI | SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtProgramArgs, Constants.RUNPROGRAMARGS);
    // Create controls: vm args
    Label lblVmArgs = toolkit.createLabel(composite, "JVM Arguments:");
    txtVmArgs = toolkit.createText(composite, "", SWT.MULTI | SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtVmArgs, Constants.RUNVM);
    // Layout
    GridLayout gl;
    GridData gd;
    gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    composite.setLayout(gl);
    lblRunProperties.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.heightHint = 50;
    gd.widthHint = 50;
    tblRunProperties.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.TOP, false, true);
    createRemovePropsToolBar.setLayoutData(gd);
    lblProgramArgs.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd.heightHint = 40;
    gd.widthHint = 50;
    txtProgramArgs.setLayoutData(gd);
    lblVmArgs.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd.heightHint = 40;
    gd.widthHint = 50;
    txtVmArgs.setLayoutData(gd);
    // Listeners
    viewRunProperties.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            createRemovePropsPart.setRemoveEnabled(!viewRunProperties.getSelection().isEmpty());
        }
    });
    createRemovePropsPart.addListener(new AddRemoveListener() {

        @Override
        public void addSelected() {
            runProperties.put("name", "");
            viewRunProperties.add("name");
            markDirty();
            viewRunProperties.editElement("name", 0);
        }

        @Override
        public void removeSelected() {
            @SuppressWarnings("rawtypes") Iterator iter = ((IStructuredSelection) viewRunProperties.getSelection()).iterator();
            while (iter.hasNext()) {
                Object item = iter.next();
                runProperties.remove(item);
                viewRunProperties.remove(item);
            }
            markDirty();
        }
    });
    runPropertiesModifier.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            markDirty();
        }
    });
    txtProgramArgs.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent ev) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    programArgs = txtProgramArgs.getText();
                    if (programArgs.length() == 0)
                        programArgs = null;
                }
            });
        }
    });
    txtVmArgs.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent ev) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    vmArgs = txtVmArgs.getText();
                    if (vmArgs.length() == 0)
                        vmArgs = null;
                }
            });
        }
    });
    composite.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            Rectangle area = composite.getClientArea();
            Point preferredSize = tblRunProperties.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            int width = area.width - 2 * tblRunProperties.getBorderWidth();
            if (preferredSize.y > area.height + tblRunProperties.getHeaderHeight()) {
                // Subtract the scrollbar width from the total column width
                // if a vertical scrollbar will be required
                Point vBarSize = tblRunProperties.getVerticalBar().getSize();
                width -= vBarSize.x;
            }
            Point oldSize = tblRunProperties.getSize();
            if (oldSize.x > area.width) {
                // table is getting smaller so make the columns
                // smaller first and then resize the table to
                // match the client area width
                tblRunPropsCol1.setWidth(width / 3);
                tblRunPropsCol2.setWidth(width - tblRunPropsCol1.getWidth());
                tblRunProperties.setSize(area.width, area.height);
            } else {
                // table is getting bigger so make the table
                // bigger first and then make the columns wider
                // to match the client area width
                tblRunProperties.setSize(area.width, area.height);
                tblRunPropsCol1.setWidth(width / 3);
                tblRunPropsCol2.setWidth(width - tblRunPropsCol1.getWidth());
            }
        }
    });
}
Also used : PropertyChangeListener(java.beans.PropertyChangeListener) ModifyListener(org.eclipse.swt.events.ModifyListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) Label(org.eclipse.swt.widgets.Label) Rectangle(org.eclipse.swt.graphics.Rectangle) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) MapContentProvider(bndtools.editor.common.MapContentProvider) Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Iterator(java.util.Iterator) PropertyChangeEvent(java.beans.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Point(org.eclipse.swt.graphics.Point) TableColumn(org.eclipse.swt.widgets.TableColumn) AddRemoveListener(org.bndtools.utils.swt.AddRemoveButtonBarPart.AddRemoveListener) GridData(org.eclipse.swt.layout.GridData) PropertiesTableLabelProvider(bndtools.editor.common.PropertiesTableLabelProvider) ControlEvent(org.eclipse.swt.events.ControlEvent) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 20 with ControlEvent

use of org.eclipse.swt.events.ControlEvent in project eclipse.platform.text by eclipse.

the class OverviewRuler method createControl.

@Override
public Control createControl(Composite parent, ITextViewer textViewer) {
    fTextViewer = textViewer;
    fHitDetectionCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
    fHeader = new Canvas(parent, SWT.NONE);
    if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
        fHeader.addMouseTrackListener(new MouseTrackAdapter() {

            /*
				 * @see org.eclipse.swt.events.MouseTrackAdapter#mouseHover(org.eclipse.swt.events.MouseEvent)
				 * @since 3.3
				 */
            @Override
            public void mouseEnter(MouseEvent e) {
                updateHeaderToolTipText();
            }
        });
    }
    fCanvas = new Canvas(parent, SWT.NO_BACKGROUND);
    fCanvas.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent event) {
            if (fTextViewer != null)
                doubleBufferPaint(event.gc);
        }
    });
    fCanvas.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent event) {
            handleDispose();
            fTextViewer = null;
        }
    });
    fCanvas.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent event) {
            handleMouseDown(event);
        }
    });
    fCanvas.addMouseMoveListener(new MouseMoveListener() {

        @Override
        public void mouseMove(MouseEvent event) {
            handleMouseMove(event);
        }
    });
    fCanvas.addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseScrolled(MouseEvent e) {
            handleMouseScrolled(e);
        }
    });
    if (fTextViewer != null) {
        fTextViewer.addTextListener(fInternalListener);
        // on word wrap toggle a "resized" ControlEvent is fired: suggest a redraw of the ruler
        fTextViewer.getTextWidget().addControlListener(new ControlAdapter() {

            @Override
            public void controlResized(ControlEvent e) {
                if (fTextViewer == null) {
                    return;
                }
                StyledText textWidget = fTextViewer.getTextWidget();
                if (textWidget != null && textWidget.getWordWrap()) {
                    redraw();
                }
            }
        });
    }
    return fCanvas;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) StyledText(org.eclipse.swt.custom.StyledText) ControlAdapter(org.eclipse.swt.events.ControlAdapter) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) MouseTrackAdapter(org.eclipse.swt.events.MouseTrackAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) ControlEvent(org.eclipse.swt.events.ControlEvent)

Aggregations

ControlEvent (org.eclipse.swt.events.ControlEvent)62 ControlListener (org.eclipse.swt.events.ControlListener)34 ControlAdapter (org.eclipse.swt.events.ControlAdapter)28 SelectionEvent (org.eclipse.swt.events.SelectionEvent)20 GridData (org.eclipse.swt.layout.GridData)20 Composite (org.eclipse.swt.widgets.Composite)20 GridLayout (org.eclipse.swt.layout.GridLayout)15 Point (org.eclipse.swt.graphics.Point)14 DisposeEvent (org.eclipse.swt.events.DisposeEvent)11 FocusEvent (org.eclipse.swt.events.FocusEvent)11 Control (org.eclipse.swt.widgets.Control)11 Event (org.eclipse.swt.widgets.Event)11 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)10 DisposeListener (org.eclipse.swt.events.DisposeListener)10 ModifyEvent (org.eclipse.swt.events.ModifyEvent)10 MouseEvent (org.eclipse.swt.events.MouseEvent)10 Listener (org.eclipse.swt.widgets.Listener)10 Shell (org.eclipse.swt.widgets.Shell)10 TableColumn (org.eclipse.swt.widgets.TableColumn)10 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)9