Search in sources :

Example 36 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class BatchRunComposite method createTableGroup.

private void createTableGroup(Composite composite) {
    final String[] columnNames = new String[] { "", com.cubrid.common.ui.query.Messages.msgBatchRunSqlFile, com.cubrid.common.ui.query.Messages.msgBatchRunMemo, com.cubrid.common.ui.query.Messages.msgBatchRunRegdate };
    tv = (CheckboxTableViewer) CommonUITool.createCheckBoxTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
    tv.setInput(listData);
    TableLayout tableLayout = new TableLayout();
    tv.getTable().setLayout(tableLayout);
    tableLayout.addColumnData(new ColumnPixelData(30));
    tableLayout.addColumnData(new ColumnPixelData(209));
    tableLayout.addColumnData(new ColumnPixelData(272));
    tableLayout.addColumnData(new ColumnPixelData(118));
    editor = new TableEditor(tv.getTable());
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
    tv.getTable().addListener(SWT.MouseUp, new Listener() {

        public void handleEvent(Event event) {
            if (event.button != 1) {
                return;
            }
            validateCheck();
            Point pt = new Point(event.x, event.y);
            int newIndex = tv.getTable().getSelectionIndex();
            if (tv.getTable().getItemCount() <= newIndex || newIndex < 0) {
                return;
            }
            final TableItem item = tv.getTable().getItem(newIndex);
            if (item == null) {
                return;
            }
            Rectangle rect = item.getBounds(2);
            if (rect.contains(pt)) {
                focusCell(item, newIndex, 2);
            }
        }
    });
}
Also used : Listener(org.eclipse.swt.widgets.Listener) TraverseListener(org.eclipse.swt.events.TraverseListener) TableItem(org.eclipse.swt.widgets.TableItem) ColumnPixelData(org.eclipse.jface.viewers.ColumnPixelData) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) TraverseEvent(org.eclipse.swt.events.TraverseEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) TableLayout(org.eclipse.jface.viewers.TableLayout) TableEditor(org.eclipse.swt.custom.TableEditor)

Example 37 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class FilterResultContrItem method createControl.

/**
	 * Create the content
	 *
	 * @param parent Composite
	 * @return Control
	 */
protected Control createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    comp.setLayoutData(gridData);
    final GridLayout gdLayout = new GridLayout(5, false);
    gdLayout.marginHeight = 0;
    gdLayout.marginWidth = 0;
    gdLayout.horizontalSpacing = 0;
    gdLayout.verticalSpacing = 0;
    gdLayout.marginRight = 10;
    comp.setLayout(gdLayout);
    Label lbl = new Label(comp, SWT.NONE);
    lbl.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    lbl.setText(" " + Messages.lblFilterSearch + " ");
    text = new Text(comp, SWT.NONE | SWT.BORDER | SWT.LEFT);
    text.setLayoutData(CommonUITool.createGridData(1, 1, 100, -1));
    text.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                doFilter();
            }
        }
    });
    dropDownButton = new Button(comp, SWT.FLAT | SWT.DOWN);
    dropDownButton.setText(Messages.lblFilterSearchOption);
    dropDownButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            handleSelectionEvent();
        }
    });
    Label lblLimit = new Label(comp, SWT.NONE);
    lblLimit.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    lblLimit.setText(" " + Messages.lblSearchLimit + " ");
    pageLimitCombo = new Combo(comp, SWT.READ_ONLY);
    pageLimitCombo.setItems(new String[] { "1000", "5000", "10000" });
    pageLimitCombo.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    pageLimitCombo.setText("" + pageLimit);
    pageLimitCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int limit = StringUtil.intValue(pageLimitCombo.getText());
            ServerInfo serverInfo = qe.getDatabase().getServer().getServerInfo();
            QueryOptions.setSearchUnitCount(serverInfo, limit);
        }
    });
    loadMenuItems();
    return comp;
}
Also used : Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) KeyAdapter(org.eclipse.swt.events.KeyAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) KeyEvent(org.eclipse.swt.events.KeyEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 38 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class AddQueryRecordDialog method createDialogArea.

/**
	 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    Label label1 = new Label(composite, SWT.LEFT);
    label1.setText(Messages.lblQueryName);
    label1.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    String queryPlanName = Messages.lblQueryTuningName + " ";
    if (newFlag) {
        queryPlanName += QueryRecord.DATE_FORMAT.format(new Date());
    } else {
        queryPlanName += queryRecord.getTimeStamp();
    }
    newText = new Text(composite, SWT.BORDER);
    newText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    newText.setText(queryPlanName);
    newText.selectAll();
    newText.setFocus();
    newText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            validate();
        }
    });
    newText.addListener(SWT.KeyDown, new Listener() {

        public void handleEvent(Event e) {
            if (e.type == SWT.KeyDown && e.character == SWT.CR) {
                buttonPressed(IDialogConstants.OK_ID);
            }
        }
    });
    if (newFlag) {
        setTitle(Messages.subTitleAddQueryRecord);
    } else {
        String msg = Messages.bind(Messages.subTitleRenameQueryRecord, queryRecord.getName());
        setTitle(msg);
    }
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) Text(org.eclipse.swt.widgets.Text) Date(java.util.Date)

Example 39 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class JdbcOptionComposite method focusCell.

public void focusCell(final TableItem item, final int row, final int col) {
    final StyledText text = new StyledText(jdbcInfoTv.getTable(), SWT.SINGLE);
    Listener textListener = new TableItemEditor(text, item, row, col);
    text.addListener(SWT.FocusOut, textListener);
    text.addListener(SWT.Traverse, textListener);
    text.addListener(SWT.FocusIn, textListener);
    text.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = false;
                int newColumn = col == 0 ? 1 : 0;
                focusCell(item, row, newColumn);
            } else if (e.detail == SWT.TRAVERSE_RETURN) {
                e.doit = false;
                addButton.setFocus();
            }
        }
    });
    text.setEditable(true);
    editor.setEditor(text, item, col);
    text.setText(item.getText(col));
    text.selectAll();
    try {
        text.setFocus();
    } catch (Exception e) {
    }
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Listener(org.eclipse.swt.widgets.Listener) TraverseListener(org.eclipse.swt.events.TraverseListener) MouseListener(org.eclipse.swt.events.MouseListener) TraverseEvent(org.eclipse.swt.events.TraverseEvent) TraverseListener(org.eclipse.swt.events.TraverseListener)

Example 40 with Listener

use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.

the class UnifyHostConfigEditor method createBrokerConfTabItem.

/**
	 * create broker conf table
	 */
public void createBrokerConfTabItem() {
    Composite comp = new Composite(confTabFolder, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    brokerConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
    brokerConfTableCTabItem.setText(BROKERCONFCONFIGFILENAME);
    brokerConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    brokerConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    brokerConfTabTableViewer.getTable().setHeaderVisible(true);
    brokerConfTabTableViewer.getTable().setLinesVisible(true);
    brokerConfTabTableViewer.setUseHashlookup(true);
    //create column
    TableViewerColumn column = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(0);
    column.getColumn().setText("");
    brokerConfTabTableViewer.setContentProvider(new UnifyHostCubridBrokerTableContentProvider());
    brokerConfTabTableViewer.setLabelProvider(new UnifyHostCubridBrokerTableLabelProvider());
    brokerConfTabTableViewer.setSorter(new BrokerConfTableViewerSorter());
    //use to mark click point, the right click menu use this point
    brokerConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {

        public void handleEvent(Event event) {
            cubridBrokerTableClickPoint = new Point(event.x, event.y);
            cubridBrokerTableClickPointTiming = System.currentTimeMillis();
        }
    });
    registerCubridBrokerTableContextMenu();
    brokerConfTableCTabItem.setControl(comp);
    if (confTabFolder.getSelection() == null) {
        confTabFolder.setSelection(brokerConfTableCTabItem);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

Listener (org.eclipse.swt.widgets.Listener)876 Event (org.eclipse.swt.widgets.Event)841 SelectionEvent (org.eclipse.swt.events.SelectionEvent)538 Button (org.eclipse.swt.widgets.Button)480 Label (org.eclipse.swt.widgets.Label)452 Text (org.eclipse.swt.widgets.Text)392 ModifyListener (org.eclipse.swt.events.ModifyListener)385 Shell (org.eclipse.swt.widgets.Shell)385 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)382 ModifyEvent (org.eclipse.swt.events.ModifyEvent)376 FormData (org.eclipse.swt.layout.FormData)356 ShellEvent (org.eclipse.swt.events.ShellEvent)354 FormAttachment (org.eclipse.swt.layout.FormAttachment)353 FormLayout (org.eclipse.swt.layout.FormLayout)353 Display (org.eclipse.swt.widgets.Display)342 ShellAdapter (org.eclipse.swt.events.ShellAdapter)325 Composite (org.eclipse.swt.widgets.Composite)295 GridData (org.eclipse.swt.layout.GridData)229 GridLayout (org.eclipse.swt.layout.GridLayout)195 TextVar (org.pentaho.di.ui.core.widget.TextVar)184