Java 类org.eclipse.swt.events.ControlListener 实例源码

项目:team-explorer-everywhere    文件:QueryEditorControl.java   
private void createColumns(final Table table) {
    table.setLayout(new TableLayout());

    final ControlListener layoutWhenResizedListener = new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            ((TableColumn) e.widget).getParent().layout();
        }
    };

    for (int i = 0; i < COLUMN_DATA.length; i++) {
        final ColumnData columnData = COLUMN_DATA[i];

        final TableColumn column = new TableColumn(table, columnData.style);
        column.setWidth(columnData.defaultWidth);
        column.setResizable(columnData.resizable);
        if (columnData.label != null) {
            column.setText(columnData.label);
        }
        column.addControlListener(layoutWhenResizedListener);
    }
}
项目:Hydrograph    文件:SchemaPreviewPage.java   
private void addControlListener(Table table, TableColumn tableColumn) {
    ControlListener controlistener= new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            for (TableColumn column : table.getColumns()) {
                column.setWidth(table.getSize().x / table.getColumnCount() - (4 - table.getColumnCount()));
            }
        }
    };
    table.addControlListener(controlistener);
}
项目:SPELL    文件:CodeViewer.java   
/***************************************************************************
 * Force a control resize event
 **************************************************************************/
public void forceControlEvent( Control ctrl )
{
    for(Listener lst : ctrl.getListeners(SWT.Resize))
    {
        if (lst instanceof ControlListener)
        {
            ControlListener clst = (ControlListener) lst;
            clst.controlResized(null);
        }
    }
}
项目:ccu-historian    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:aya-lang    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:mytourbook    文件:ColumnDefinition.java   
public ControlListener getColumnControlListener() {
    return _columnControlListener;
}
项目:mytourbook    文件:ColumnDefinition.java   
public void setControlListener(final ControlListener controlListener) {
    _columnControlListener = controlListener;
}
项目:AcademicTorrents-Downloader    文件:TableColumnDelegate.java   
public void addControlListener(ControlListener listener) {
    column.addControlListener(listener);
}
项目:AcademicTorrents-Downloader    文件:TableColumnDelegate.java   
public void removeControlListener(ControlListener listener) {
    column.removeControlListener(listener);
}
项目:AcademicTorrents-Downloader    文件:TreeColumnDelegate.java   
public void addControlListener(ControlListener listener) {
    treeColumn.addControlListener(listener);
}
项目:AcademicTorrents-Downloader    文件:TreeColumnDelegate.java   
public void removeControlListener(ControlListener listener) {
    treeColumn.removeControlListener(listener);
}
项目:ECG-Viewer    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:astor    文件:ChartComposite.java   
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 *
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(EventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    }
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    }
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    }
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    }
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    }
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    }
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    }
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    }
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    }
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    }
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    }
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    }
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    }
}
项目:group-five    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:redmine.rap    文件:ProductEditor.java   
private void createContents() {
        // Create top and bottom composites
        topComposite = toolkit.createComposite(formComposite, SWT.NONE);
        btmComposite = toolkit.createComposite(formComposite, SWT.NONE);

        // Layouts
        GridLayout layout        = new GridLayout(3, Boolean.TRUE);
        layout.marginHeight      = 5;
        layout.marginWidth       = 5;
        layout.verticalSpacing   = 5;
        layout.horizontalSpacing = 5;
        GridData layoutData      = new GridData(SWT.FILL,
                                                SWT.FILL,
                                                Boolean.TRUE,
                                                Boolean.TRUE);      
        // Set composites layouts
        topComposite.setLayout(layout);
        topComposite.setLayoutData(layoutData);
        btmComposite.setLayout(layout);
        btmComposite.setLayoutData(layoutData);

//      topComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));   // TODO     
//      btmComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));    // TODO

        // 
        formComposite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {
                // Retrieve parent bounds
                Rectangle formBounds = ((Composite) event.getSource()).getBounds();
                int topCpteHeight    = (int) (formBounds.height * 0.65);
                int topCpteWidth     = (int) (formBounds.width);
                int btmCpteHeight    = (int) (formBounds.height * 0.35);
                int btmCpteWidth     = (int) (formBounds.width);

                topComposite.setSize(topCpteWidth, topCpteHeight);
                btmComposite.setBounds(btmComposite.getLocation().x,
                                       topCpteHeight,
                                       btmCpteWidth,
                                       btmCpteHeight);
                // 
                topCompositeBounds    = topComposite.getBounds();
                bottomCompositeBounds = btmComposite.getBounds();
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });

        // Create contents of both main composites
        createTopContents(topComposite);
        createBottomContents(btmComposite);
    }
项目:redmine.rap    文件:ProductEditor.java   
private void fillScheduleSection(Composite composite) {
        // Local composites 
        final Composite lblsComposite  = toolkit.createComposite(composite);
        final Composite ctrlsComposite = toolkit.createComposite(composite);

//      lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));   // TODO
//      ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));  // TODO

        // Layout
        RowData data     = new RowData();
        RowLayout layout = new RowLayout(SWT.VERTICAL);
        layout.justify   = Boolean.TRUE;

        lblsComposite.setLayout(layout);
        lblsComposite.setData(data);
        ctrlsComposite.setLayout(layout);
        ctrlsComposite.setData(data);

        // Labels
        lblStartDate   = new CLabel(lblsComposite, SWT.LEFT);
        lblReleaseDate = new CLabel(lblsComposite, SWT.LEFT);
        lblState       = new CLabel(lblsComposite, SWT.LEFT);
        lblDone        = new CLabel(lblsComposite, SWT.LEFT);
        lblToDo        = new CLabel(lblsComposite, SWT.LEFT);

        // Controls
        dtStartDate = new DateTime(ctrlsComposite, SWT.DATE
                                                 | SWT.DROP_DOWN
                                                 | SWT.BORDER);
        dtReleaseDate = new DateTime(ctrlsComposite, SWT.DATE
                                                   | SWT.DROP_DOWN
                                                   | SWT.BORDER);
        cboStates = new CCombo(ctrlsComposite, SWT.BORDER);
        txtDone   = new Text(ctrlsComposite, SWT.BORDER);
        txtToDo   = new Text(ctrlsComposite, SWT.BORDER);

        // Labels configuration
        lblStartDate.setText(START_DATE_LABEL);     
        lblReleaseDate.setText(RELEASE_DATE_LABEL);
        lblState.setText(STATE_LABEL);
        lblDone.setText(DONE_LABEL);
        lblToDo.setText(TO_DO_LABEL);

        // Controls configuration
        cboStates.setEditable(Boolean.FALSE);

        // Add decorations
        ViewUtils.addDecoration(txtDone);
        ViewUtils.addDecoration(txtToDo);

        // Set widgets sizes
        composite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {
                // Retrieves "scheduleSC" bounds
                Rectangle bounds = ((Composite) event.getSource()).getBounds();

                // Manage left and right bounds
                lblsComposite.setBounds(0, 0,
                                        (int) (bounds.width * 0.4),
                                        bounds.height);
                ctrlsComposite.setBounds((int) (bounds.width * 0.4), 0,
                                         (int) (bounds.width * 0.6),
                                         bounds.height);            
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });
    }
项目:redmine.rap    文件:ProductEditor.java   
private void fillMemoSection(Composite composite) {
        // Local composites 
        final Composite lblsComposite  = toolkit.createComposite(composite);
        final Composite ctrlsComposite = toolkit.createComposite(composite);

//      lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));   // TODO
//      ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));  // TODO

        // Layout
        RowData data     = new RowData();
        RowLayout layout = new RowLayout(SWT.VERTICAL);

        lblsComposite.setLayout(layout);
        lblsComposite.setData(data);
        ctrlsComposite.setLayout(layout);
        ctrlsComposite.setData(data);

        // Labels
        lblDescription = new CLabel(lblsComposite, SWT.LEFT);
        lblComments    = new CLabel(lblsComposite, SWT.LEFT);

        // Controls
        txtDescription = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI);
        txtComments    = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI);

        // Labels configuration
        lblDescription.setText(DESCRIPTION_LABEL);      
        lblComments.setText(COMMENTS_LABEL);

        // Set widgets sizes
        composite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {

                // Retrieves "memoSCBounds" bounds
                Rectangle memoSCBounds   = ((Composite) event.getSource()).getBounds();
                int lblsCompositeWidth   = (int) (memoSCBounds.width * 0.4);
                int lblsCompositeHeight  = (int) (memoSCBounds.height);
                int ctrlsCompositeWidth  = (int) (memoSCBounds.width * 0.6);
                int ctrlsCompositeHeight = (int) (memoSCBounds.height);

                // Manage left and right bounds
                lblsComposite.setBounds(0, 0, lblsCompositeWidth, lblsCompositeHeight);
                ctrlsComposite.setBounds(lblsCompositeWidth, 0,
                                         ctrlsCompositeWidth,
                                         ctrlsCompositeHeight);

                int txtControlWidth  = (int) (ctrlsCompositeWidth * 0.8);
                int txtControlHeight = (int) (ctrlsCompositeHeight * 0.4);

                txtDescription.setSize(txtControlWidth, txtControlHeight);
                txtComments.setSize(txtControlWidth, txtControlHeight);

                lblComments.setLocation(lblComments.getLocation().x,
                                        txtControlHeight + CTRLS_SEPARATION);
                txtComments.setLocation(txtComments.getLocation().x,
                                        txtControlHeight + CTRLS_SEPARATION);
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });
    }
项目:redmine.rap    文件:ReleaseEditor.java   
private void createContents() {
        // Create top and bottom composites
        topComposite = toolkit.createComposite(formComposite, SWT.NONE);
        btmComposite = toolkit.createComposite(formComposite, SWT.NONE);

        // Layouts      
        GridLayout layout = new GridLayout(3, Boolean.TRUE);
        GridData data     = new GridData(SWT.FILL,
                                         SWT.FILL,
                                         Boolean.TRUE,
                                         Boolean.TRUE);
        layout.marginHeight      = 5;
        layout.marginWidth       = 5;
        layout.verticalSpacing   = 5;
        layout.horizontalSpacing = 5;

        // Set composites layouts
        topComposite.setLayout(layout);
        topComposite.setLayoutData(data);
        btmComposite.setLayout(layout);
        btmComposite.setLayoutData(data);

//      topComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));   // TODO     
//      btmComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));    // TODO

        // 
        formComposite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {
                // Retrieve parent bounds
                Rectangle formBounds = ((Composite) event.getSource()).getBounds();
                int topCpteHeight    = (int) (formBounds.height * 0.65);
                int topCpteWidth     = (int) (formBounds.width);
                int btmCpteHeight    = (int) (formBounds.height * 0.35);
                int btmCpteWidth     = (int) (formBounds.width);

                topComposite.setSize(topCpteWidth, topCpteHeight);
                btmComposite.setBounds(btmComposite.getLocation().x,
                                       topCpteHeight,
                                       btmCpteWidth,
                                       btmCpteHeight);
                // 
                topCompositeBounds    = topComposite.getBounds();
                bottomCompositeBounds = btmComposite.getBounds();

//              generalExpandItem.setHeight((int) (topCpteHeight * 0.8));
//              iterationsExpandItem.setHeight((int) (btmCpteHeight * 0.7));
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });

        // Create contents of both main composites
        createTopContents(topComposite);
        createBottomContents(btmComposite);
    }
项目:redmine.rap    文件:ReleaseEditor.java   
private void fillScheduleSection(Composite composite) {
        // Local composites 
        final Composite lblsComposite  = toolkit.createComposite(composite);
        final Composite ctrlsComposite = toolkit.createComposite(composite);

//      lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));   // TODO
//      ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));  // TODO

        // Layout
        RowData data     = new RowData();
        RowLayout layout = new RowLayout(SWT.VERTICAL);
        layout.justify   = Boolean.TRUE;

        lblsComposite.setLayout(layout);
        lblsComposite.setData(data);
        ctrlsComposite.setLayout(layout);
        ctrlsComposite.setData(data);

        // Labels
        lblStartDate   = new CLabel(lblsComposite, SWT.LEFT);
        lblReleaseDate = new CLabel(lblsComposite, SWT.LEFT);
        lblState       = new CLabel(lblsComposite, SWT.LEFT);
        lblDone        = new CLabel(lblsComposite, SWT.LEFT);
        lblToDo        = new CLabel(lblsComposite, SWT.LEFT);

        // Controls
        dtStartDate = new DateTime(ctrlsComposite, SWT.DATE
                                                 | SWT.DROP_DOWN
                                                 | SWT.BORDER);
        dtReleaseDate = new DateTime(ctrlsComposite, SWT.DATE
                                                   | SWT.DROP_DOWN
                                                   | SWT.BORDER);
        cboStates = new CCombo(ctrlsComposite, SWT.BORDER);
        txtDone   = new Text(ctrlsComposite, SWT.BORDER);
        txtToDo   = new Text(ctrlsComposite, SWT.BORDER);

        // Labels configuration
        lblStartDate.setText(START_DATE_LABEL);     
        lblReleaseDate.setText(RELEASE_DATE_LABEL);
        lblState.setText(STATE_LABEL);
        lblDone.setText(DONE_LABEL);
        lblToDo.setText(TO_DO_LABEL);

        // Controls configuration
        cboStates.setEditable(Boolean.FALSE);

        // Add decorations
        ViewUtils.addDecoration(txtDone);
        ViewUtils.addDecoration(txtToDo);

        // Set widgets sizes
        composite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {
                // Retrieves "scheduleSC" bounds
                Rectangle bounds = ((Composite) event.getSource()).getBounds();

                // Manage left and right bounds
                lblsComposite.setBounds(0, 0,
                                        (int) (bounds.width * 0.4),
                                        bounds.height);
                ctrlsComposite.setBounds((int) (bounds.width * 0.4), 0,
                                         (int) (bounds.width * 0.6),
                                         bounds.height);            
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });
    }
项目:redmine.rap    文件:ReleaseEditor.java   
private void fillMemoSection(Composite composite) {
        // Local composites 
        final Composite lblsComposite  = toolkit.createComposite(composite);
        final Composite ctrlsComposite = toolkit.createComposite(composite);

//      lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));   // TODO
//      ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));  // TODO

        // Layout
        RowData data     = new RowData();
        RowLayout layout = new RowLayout(SWT.VERTICAL);

        lblsComposite.setLayout(layout);
        lblsComposite.setData(data);
        ctrlsComposite.setLayout(layout);
        ctrlsComposite.setData(data);

        // Labels
        lblDescription = new CLabel(lblsComposite, SWT.LEFT);
        lblComments    = new CLabel(lblsComposite, SWT.LEFT);

        // Controls
        txtDescription = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI | SWT.WRAP);
        txtComments    = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI | SWT.WRAP);

        // Labels configuration
        lblDescription.setText(DESCRIPTION_LABEL);      
        lblComments.setText(COMMENTS_LABEL);

        // Set widgets sizes
        composite.addControlListener(new ControlListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void controlResized(ControlEvent event) {

                // Retrieves "memoSCBounds" bounds
                Rectangle memoSCBounds   = ((Composite) event.getSource()).getBounds();
                int lblsCompositeWidth   = (int) (memoSCBounds.width * 0.4);
                int lblsCompositeHeight  = (int) (memoSCBounds.height);
                int ctrlsCompositeWidth  = (int) (memoSCBounds.width * 0.6);
                int ctrlsCompositeHeight = (int) (memoSCBounds.height);

                // Manage left and right bounds
                lblsComposite.setBounds(0, 0, lblsCompositeWidth, lblsCompositeHeight);
                ctrlsComposite.setBounds(lblsCompositeWidth, 0,
                                         ctrlsCompositeWidth,
                                         ctrlsCompositeHeight);

                int txtControlWidth  = (int) (ctrlsCompositeWidth * 0.8);
                int txtControlHeight = (int) (ctrlsCompositeHeight * 0.4);

                txtDescription.setSize(txtControlWidth, txtControlHeight);
                txtComments.setSize(txtControlWidth, txtControlHeight);

                lblComments.setLocation(lblComments.getLocation().x,
                                        txtControlHeight + CTRLS_SEPARATION);
                txtComments.setLocation(txtComments.getLocation().x,
                                        txtControlHeight + CTRLS_SEPARATION);
            }

            @Override
            public void controlMoved(ControlEvent e) {}
        });
    }
项目:Pydev    文件:AbstractPyEditorTextHover.java   
/**
 * Add a listener to resize events on the information presented control.
 * @param listener the resize listener
 */
public void addInformationPresenterControlListener(ControlListener listener) {
    if (informationPresenter != null) {
        informationPresenter.addResizeCallback(listener);
    }
}
项目:buffer_bci    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:proyecto-teoria-control-utn-frro    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:Memetic-Algorithm-for-TSP    文件:ChartComposite.java   
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
项目:cogtool    文件:StandardDrawingEditor.java   
/**
 * Allow outside people to add control listeners to the scroll area.
 * @param listener
 */
public void addScrollControlListener(ControlListener listener)
{
    scrollComposite.addControlListener(listener);
}
项目:elexis-3-base    文件:AbstractBrowseText.java   
public void addControlListener(ControlListener listener){
    this.text.addControlListener(listener);
}
项目:elexis-3-base    文件:AbstractBrowseText.java   
public void removeControlListener(ControlListener listener){
    this.text.removeControlListener(listener);
}
项目:hestia-engine-dev    文件:TreeViewerBuilder.java   
/**
 * @param listener
 */
public TreeViewerBuilder controlListener(ControlListener listener) {
    viewer.getControl().addControlListener(listener);
    return this;
}
项目:translationstudio8    文件:GridItem.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the row is resized, by sending it one of the messages defined in the
 * <code>ControlListener</code> interface.
 * <p>
 * Clients who wish to override the standard row resize logic should use the
 * untyped listener mechanisms. The untyped <code>Event</code> object passed
 * to an untyped listener will have its <code>detail</code> field populated
 * with the new row height. Clients may alter this value to, for example,
 * enforce minimum or maximum row sizes. Clients may also set the
 * <code>doit</code> field to false to prevent the entire resize operation.
 *
 * @param listener
 *            the listener which should be notified
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not
 *                called from the thread that created the receiver</li>
 *                </ul>
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        SWT.error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
}
项目:translationstudio8    文件:GridItem.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the row is resized.
 *
 * @param listener
 *            the listener which should no longer be notified
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        SWT.error(SWT.ERROR_NULL_ARGUMENT);
    removeListener(SWT.Resize, listener);
}
项目:translationstudio8    文件:GridColumn.java   
/**
 * Adds a listener to the list of listeners notified when the column is
 * moved or resized.
 *
 * @param listener
 *            listener
 * @throws IllegalArgumentException
 *             <ul>
 *             <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *             </ul>
 * @throws org.eclipse.swt.SWTException
 *             <ul>
 *             <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
 *             </li>
 *             <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *             thread that created the receiver</li>
 *             </ul>
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null) {
        SWT.error(SWT.ERROR_NULL_ARGUMENT);
    }
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
    addListener(SWT.Move, typedListener);
}
项目:translationstudio8    文件:GridColumn.java   
/**
 * Removes the given control listener.
 *
 * @param listener
 *            listener.
 * @throws IllegalArgumentException
 *             <ul>
 *             <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *             </ul>
 * @throws org.eclipse.swt.SWTException
 *             <ul>
 *             <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
 *             </li>
 *             <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *             thread that created the receiver</li>
 *             </ul>
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null) {
        SWT.error(SWT.ERROR_NULL_ARGUMENT);
    }
    removeListener(SWT.Resize, listener);
    removeListener(SWT.Move, listener);
}
项目:gef-gwt    文件:TreeColumn.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the control is moved or resized, by sending it one of the messages
 * defined in the <code>ControlListener</code> interface.
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #removeControlListener
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
    addListener(SWT.Move, typedListener);
}
项目:gef-gwt    文件:TreeColumn.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the control is moved or resized.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #addControlListener
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    if (eventTable == null)
        return;
    eventTable.unhook(SWT.Move, listener);
    eventTable.unhook(SWT.Resize, listener);
}
项目:gef-gwt    文件:TableColumn.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the control is moved or resized, by sending it one of the messages
 * defined in the <code>ControlListener</code> interface.
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #removeControlListener
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
    addListener(SWT.Move, typedListener);
}
项目:gef-gwt    文件:TableColumn.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the control is moved or resized.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #addControlListener
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    if (eventTable == null)
        return;
    eventTable.unhook(SWT.Move, listener);
    eventTable.unhook(SWT.Resize, listener);
}
项目:gef-gwt    文件:Tracker.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the control is moved or resized, by sending it one of the messages
 * defined in the <code>ControlListener</code> interface.
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #removeControlListener
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
    addListener(SWT.Move, typedListener);
}
项目:gef-gwt    文件:Tracker.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the control is moved or resized.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #addControlListener
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    if (eventTable == null)
        return;
    eventTable.unhook(SWT.Resize, listener);
    eventTable.unhook(SWT.Move, listener);
}
项目:gef-gwt    文件:Control.java   
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the control is moved or resized, by sending it one of the messages
 * defined in the <code>ControlListener</code> interface.
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #removeControlListener
 */
public void addControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Resize, typedListener);
    addListener(SWT.Move, typedListener);
}
项目:gef-gwt    文件:Control.java   
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the control is moved or resized.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see ControlListener
 * @see #addControlListener
 */
public void removeControlListener(ControlListener listener) {
    checkWidget();
    if (listener == null)
        error(SWT.ERROR_NULL_ARGUMENT);
    if (eventTable == null)
        return;
    eventTable.unhook(SWT.Move, listener);
    eventTable.unhook(SWT.Resize, listener);
}