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

项目:Hydrograph    文件:PropertyDialogBuilder.java   
/**
 * Adds the tab folder to property window.
 * 
 * @return the tab folder
 */
public CTabFolder addTabFolderToPropertyWindow(){
    CTabFolder tabFolder = new CTabFolder(container, SWT.NONE);

    GridData tabFolderGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);

    tabFolder.setLayoutData(tabFolderGridData);
    tabFolder.addListener(SWT.FOCUSED,getMouseClickListener() );

    container.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            tabFolderGridData.heightHint = container.getBounds().height - 500;
        }
    });

    tabFolder.addListener(SWT.FOCUSED,getMouseClickListener() );

    return tabFolder;
}
项目:Hydrograph    文件:ELTSchemaGridWidget.java   
/**
 * Arrange the columns size in equal ratio
 */
private void arrangeTableViewerColumns() {
 tableViewerComposite.addControlListener(new ControlAdapter() {

     @Override
     public void controlResized(ControlEvent e) {
         int totalWidth = tableViewer.getTable().getColumnCount() * COLUMN_WIDTH;
         int widthDifference = tableViewerComposite.getSize().x - totalWidth;

         if (widthDifference > 0) {
             widthDifference = widthDifference / tableViewer.getTable().getColumnCount();
             for (TableColumn tableColumn : tableViewer.getTable().getColumns()) {
                 tableColumn.setWidth(COLUMN_WIDTH+widthDifference);
             }
         }
     }

 });
}
项目: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);
    }
}
项目:bts    文件:ListDialogField.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 * 
 * @param parent
 *            the parent composite
 * @param style
 *            the SWT style
 */
public TableLayoutComposite(Composite parent, int style) {
    super(parent, style);
    addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle area = getClientArea();
            Table table = (Table) getChildren()[0];
            Point preferredSize = computeTableSize(table);
            int width = area.width - 2 * table.getBorderWidth();
            if (preferredSize.y > area.height) {
                // Subtract the scrollbar width from the total column
                // width
                // if a vertical scrollbar will be required
                Point vBarSize = table.getVerticalBar().getSize();
                width -= vBarSize.x;
            }
            layoutTable(table, width, area,
                    table.getSize().x < area.width);
        }
    });
}
项目:gwt-eclipse-plugin    文件:SelectableControlList.java   
/**
 * Do layout. Several magic #s in here...
 * 
 * @param scrolledComposite
 */
private void setupScrolledComposite() {
  setAlwaysShowScrollBars(true);

  scrolledCanvas = new Composite(this, SWT.NONE);
  GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(scrolledCanvas);

  setMinWidth(100);
  setMinHeight(100);
  setExpandHorizontal(true);
  setExpandVertical(true);
  setMinHeight(1);

  Point size = scrolledCanvas.computeSize(getParent().getSize().x,
      SWT.DEFAULT, true);
  scrolledCanvas.setSize(size);

  addControlListener(new ControlAdapter() {
    @Override
    public void controlResized(ControlEvent e) {
      doUpdateContentSize();
      updateScrollIncrements();
    }
  });
  setContent(scrolledCanvas);
}
项目:PDFReporter-Studio    文件:FormattingToolsView.java   
@Override
public void createPartControl(Composite parent) {
    scrollComp = new ScrolledComposite(parent, SWT.V_SCROLL);
    scrollComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    scrollComp.setLayout(new GridLayout(1,false));
    scrollComp.setExpandVertical(true);
    scrollComp.setExpandHorizontal(true);
    scrollComp.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            refreshScrolledHeight();
        }
    });
    mainContainer = new Composite(scrollComp, SWT.BORDER);
    mainContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrollComp.setContent(mainContainer);
   mainContainer.setLayout(new ButtonFillLayout());

    IWorkbenchPart editor = getContributingPart();
    if (editor instanceof CachedSelectionProvider){
        CachedSelectionProvider cachedSelEditor = (CachedSelectionProvider)editor;
        cachedSelEditor.getSelectionCache().addSelectionChangeListener(selectionListener);
    } 
}
项目:gama    文件:FontSizer.java   
/**
 * @param tb
 */
public void install(final GamaToolbar2 tb) {

    // We add a control listener to the toolbar in order to install the
    // gesture once the control to resize have been created.
    tb.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(final ControlEvent e) {
            final Control c = view.getSizableFontControl();
            if (c != null) {
                c.addGestureListener(gl);
                // once installed the listener removes itself from the
                // toolbar
                tb.removeControlListener(this);
            }
        }

    });
    tb.button("console.increase2", "Increase font size", "Increase font size", e -> changeFontSize(2), SWT.RIGHT);
    tb.button("console.decrease2", "Decrease font size", "Decrease font size", e -> changeFontSize(-2), SWT.RIGHT);

    tb.sep(16, SWT.RIGHT);

}
项目:HMM    文件:View.java   
private void autoAdjustColumnWidth(final TableColumn col, final Table table) {
    final Composite comp = table.getParent();
    comp.addControlListener(new ControlAdapter() {
        public void controlResized(ControlEvent e) {
            Rectangle area = comp.getClientArea();
            Point preferredSize = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            int width = area.width - 2 * comp.getBorderWidth();
            if (preferredSize.y > area.height + table.getHeaderHeight()) {
                if(comp.getVerticalBar() != null) {
                    Point vBarSize = comp.getVerticalBar().getSize();
                    width -= vBarSize.x;
                }
            }
            col.setWidth(width - 75 > 0 ? width - 75 : 0);
            comp.setSize(area.width, area.height);
        }
    });
}
项目:HMM    文件:View.java   
private void autoAdjustColumnWidth(final TableColumn colName, final TableColumn colVal, final Table table) {
    final Composite comp = table.getParent();
    comp.addControlListener(new ControlAdapter() {
        public void controlResized(ControlEvent e) {
            Rectangle area = comp.getClientArea();
            Point preferredSize = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            int width = area.width - 2 * comp.getBorderWidth();
            if (preferredSize.y > area.height + table.getHeaderHeight()) {
                if(comp.getVerticalBar() != null) {
                    Point vBarSize = comp.getVerticalBar().getSize();
                    width -= vBarSize.x;
                }
            }
            colName.setWidth(width / 3 > 0 ? width / 3 : 0);
            colVal.setWidth(width - colName.getWidth() - 15 > 0 ? width - colName.getWidth() - 15 : 0);
            comp.setSize(area.width, area.height);
        }
    });
}
项目:filesync4eclipse    文件:TableLayoutComposite.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 */
public TableLayoutComposite(Composite parent, int style) {
    super(parent, style);
    addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle area= getClientArea();
            Table table= (Table)getChildren()[0];
            Point preferredSize= computeTableSize(table);
            int width= area.width - 2 * table.getBorderWidth();
            if (preferredSize.y > area.height) {
                // Subtract the scrollbar width from the total column width
                // if a vertical scrollbar will be required
                Point vBarSize = table.getVerticalBar().getSize();
                width -= vBarSize.x;
            }
            layoutTable(table, width, area, table.getSize().x < area.width);
        }
    });
}
项目:mytourbook    文件:Map3StatisticsView.java   
private void createUI(final Composite parent) {

        _tk = new FormToolkit(parent.getDisplay());

        _scrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
        {
            _scrolledContent = _tk.createComposite(_scrolledContainer);
            GridDataFactory.fillDefaults().applyTo(_scrolledContent);
            GridLayoutFactory.swtDefaults().numColumns(1).applyTo(_scrolledContent);
            {
                createUI_10_StatisticsContainer(_scrolledContent);
            }

            // setup scrolled container
            _scrolledContainer.setExpandVertical(true);
            _scrolledContainer.setExpandHorizontal(true);
            _scrolledContainer.addControlListener(new ControlAdapter() {
                @Override
                public void controlResized(final ControlEvent e) {
                    onResizeScrolledContainer(_scrolledContent);
                }
            });

            _scrolledContainer.setContent(_scrolledContent);
        }
    }
项目:mytourbook    文件:DialogSelectMap3Color.java   
/**
 * Column: Color image
 */
private void defineColumn_30_ColorImage() {

    final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);

    final TableColumn tc = tvc.getColumn();
    tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_COLOR_IMAGE));

    _tcProfileImage = tc;
    _columnIndexProfileImage = _colorViewer.getTable().getColumnCount() - 1;

    tc.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            onResizeImageColumn();
        }
    });

    tvc.setLabelProvider(new CellLabelProvider() {

        // !!! set dummy label provider, otherwise an error occures !!!
        @Override
        public void update(final ViewerCell cell) {}
    });
}
项目:mytourbook    文件:DialogMap3ColorEditor.java   
private void createUI_30_ProfileImage(final Composite parent) {

        /*
         * profile image
         */
        _canvasProfileImage = new ImageCanvas(parent, SWT.DOUBLE_BUFFERED);
        GridDataFactory.fillDefaults()//
                .grab(true, true)
//              .minSize(SWT.DEFAULT, 20)
                .hint(_pc.convertWidthInCharsToPixels(20), SWT.DEFAULT)
                .applyTo(_canvasProfileImage);

        _canvasProfileImage.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                drawProfileImage();
            }
        });
    }
项目:mytourbook    文件:DialogMap3ColorEditor.java   
private Composite createUI_52_VertexScrolledContainer(final Composite parent) {

        // scrolled container
        _vertexScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(_vertexScrolledContainer);
        _vertexScrolledContainer.setExpandVertical(true);
        _vertexScrolledContainer.setExpandHorizontal(true);

        // vertex container
        final Composite vertexContainer = new Composite(_vertexScrolledContainer, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(vertexContainer);
        GridLayoutFactory.fillDefaults()//
                .numColumns(6)
                .applyTo(vertexContainer);
//      vertexContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));

        _vertexScrolledContainer.setContent(vertexContainer);
        _vertexScrolledContainer.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                _vertexScrolledContainer.setMinSize(vertexContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            }
        });

        return vertexContainer;
    }
项目:mytourbook    文件:DialogEasyImportConfig.java   
private Composite createUI_568_IL_SpeedTourType_ScrolledContainer(final Composite parent) {

        // scrolled container
        _speedTourType_ScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(_speedTourType_ScrolledContainer);
        _speedTourType_ScrolledContainer.setExpandVertical(true);
        _speedTourType_ScrolledContainer.setExpandHorizontal(true);

        // container
        final Composite speedTTContainer = new Composite(_speedTourType_ScrolledContainer, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(speedTTContainer);
        GridLayoutFactory
                .fillDefaults()//
                .numColumns(5)
                .applyTo(speedTTContainer);

        _speedTourType_ScrolledContainer.setContent(speedTTContainer);
        _speedTourType_ScrolledContainer.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                _speedTourType_ScrolledContainer.setMinSize(speedTTContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            }
        });

        return speedTTContainer;
    }
项目:mytourbook    文件:DialogSelectSRTMColors.java   
private Composite createUI_72_VertexScrolledContainer(final Composite parent) {

        // scrolled container
        _vertexScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
        GridDataFactory.fillDefaults().grab(false, true).applyTo(_vertexScrolledContainer);
        _vertexScrolledContainer.setExpandVertical(true);
        _vertexScrolledContainer.setExpandHorizontal(true);

        // vertex container
        final Composite vertexContainer = new Composite(_vertexScrolledContainer, SWT.NONE);
        GridLayoutFactory.fillDefaults().numColumns(3).applyTo(vertexContainer);

        _vertexScrolledContainer.setContent(vertexContainer);
        _vertexScrolledContainer.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                _vertexScrolledContainer.setMinSize(vertexContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            }
        });

        return vertexContainer;
    }
项目:mytourbook    文件:TourChartAnalyzerView.java   
private void addListeners() {

        final IWorkbenchPage page = getSite().getPage();

        _partContainer.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent event) {
                onResizeUI();
            }
        });

        _postSelectionListener = new ISelectionListener() {
            @Override
            public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
                onSelectionChanged(selection);
            }
        };
        page.addPostSelectionListener(_postSelectionListener);
    }
项目:mytourbook    文件:PrefPageMap3Color.java   
/**
 * Column: Color image
 */
private void defineColumn_30_ColorImage() {

    final TreeColumnDefinition colDef = new TreeColumnDefinition(_columnManager, "colorImage", SWT.LEAD); //$NON-NLS-1$
    _colDefProfileImage = colDef;

    colDef.setColumnLabel(Messages.Pref_Map3Color_Column_Colors);
    colDef.setColumnHeaderText(Messages.Pref_Map3Color_Column_Colors);
    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(20));
    colDef.setIsDefaultColumn();
    colDef.setIsColumnMoveable(false);
    colDef.setCanModifyVisibility(false);
    colDef.setLabelProvider(new CellLabelProvider() {

        // !!! set dummy label provider, otherwise an error occures !!!
        @Override
        public void update(final ViewerCell cell) {}
    });

    colDef.setControlListener(new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            onResizeImageColumn();
        }
    });
}
项目:mytourbook    文件:TableLayoutComposite.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 */
public TableLayoutComposite(final Composite parent, final int style) {
    super(parent, style);
    addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            final Rectangle area = getClientArea();
            final Table table = (Table) getChildren()[0];
            final Point preferredSize = computeTableSize(table);
            int width = area.width - 2 * table.getBorderWidth();
            if (preferredSize.y > area.height) {
                // Subtract the scrollbar width from the total column width
                // if a vertical scrollbar will be required
                final Point vBarSize = table.getVerticalBar().getSize();
                width -= vBarSize.x;
            }
            layoutTable(table, width, area, table.getSize().x < area.width);
        }
    });
}
项目:p2-installer    文件:InstallWizardPage.java   
/**
 * Constructor
 * 
 * @param parent Parent
 * @param style Style
 */
public WarningPanel(Composite parent, int style) {
    super(parent, style | SWT.V_SCROLL);
    panelArea = new Composite(this, SWT.NONE);
    GridLayout panelLayout = new GridLayout(2, false);
    panelLayout.marginHeight = panelLayout.marginWidth = 0;
    panelArea.setLayout(panelLayout);
    setContent(panelArea);
    setExpandHorizontal(true);
    parent.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            updateLayout();
        }
    });
}
项目:Eclipse-Postfix-Code-Completion    文件:TableLayoutComposite.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 *
 * @param parent the parent composite
 * @param style the SWT style
 */
public TableLayoutComposite(Composite parent, int style) {
    super(parent, style);
       addControlListener(new ControlAdapter() {
           @Override
        public void controlResized(ControlEvent e) {
               Rectangle area= getClientArea();
               Table table= (Table)getChildren()[0];
               Point preferredSize= computeTableSize(table);
               int width= area.width - 2 * table.getBorderWidth();
               if (preferredSize.y > area.height) {
                   // Subtract the scrollbar width from the total column width
                   // if a vertical scrollbar will be required
                   Point vBarSize = table.getVerticalBar().getSize();
                   width -= vBarSize.x;
               }
               layoutTable(table, width, area, table.getSize().x < area.width);
           }
       });
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TableLayoutComposite.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 *
 * @param parent the parent composite
 * @param style the SWT style
 */
public TableLayoutComposite(Composite parent, int style) {
    super(parent, style);
       addControlListener(new ControlAdapter() {
           @Override
        public void controlResized(ControlEvent e) {
               Rectangle area= getClientArea();
               Table table= (Table)getChildren()[0];
               Point preferredSize= computeTableSize(table);
               int width= area.width - 2 * table.getBorderWidth();
               if (preferredSize.y > area.height) {
                   // Subtract the scrollbar width from the total column width
                   // if a vertical scrollbar will be required
                   Point vBarSize = table.getVerticalBar().getSize();
                   width -= vBarSize.x;
               }
               layoutTable(table, width, area, table.getSize().x < area.width);
           }
       });
}
项目:Pydev    文件:TableLayoutComposite.java   
/**
 * Creates a new <code>TableLayoutComposite</code>.
 *
 * @param parent the parent composite
 * @param style the SWT style
 */
public TableLayoutComposite(Composite parent, int style) {
    super(parent, style);
    addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle area = getClientArea();
            Table table = (Table) getChildren()[0];
            Point preferredSize = computeTableSize(table);
            int width = area.width - 2 * table.getBorderWidth();
            if (preferredSize.y > area.height) {
                // Subtract the scrollbar width from the total column width
                // if a vertical scrollbar will be required
                Point vBarSize = table.getVerticalBar().getSize();
                width -= vBarSize.x;
            }
            layoutTable(table, width, area, table.getSize().x < area.width);
        }
    });
}
项目:arx    文件:SWTUtil.java   
/**
 * Tries to fix a bug when resizing sash forms in OSX
 * @param sash
 */
public static void fixOSXSashBug(final SashForm sash) {

    // Only if on OSX
    if (isMac()) {

        // Listen for resize event in first composite
        for (Control c : sash.getChildren()) {
            if (c instanceof Composite) {

                // In case of resize, redraw the sash form
                c.addControlListener(new ControlAdapter(){
                    @Override
                    public void controlResized(ControlEvent arg0) {
                        sash.redraw();
                    }
                });
                return;
            }
        }
    }
}
项目:smaccm    文件:InputConstraintDialog.java   
@Override
    protected Control createDialogArea(final Composite parent) {
    final Composite area = (Composite)super.createDialogArea(parent);
    container = new Composite(area, SWT.NONE);
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    container.setLayout(RowLayoutFactory.swtDefaults().type(SWT.VERTICAL).wrap(true).create());

    constraintContainer = new Composite(container, SWT.NONE);
    constraintContainer.setLayout(RowLayoutFactory.swtDefaults().wrap(true).type(SWT.HORIZONTAL).create());

    validationMessageLabel = new Label(container, SWT.WRAP);

    container.addControlListener(new ControlAdapter() {             
        @Override
        public void controlResized(ControlEvent e) {
            constraintContainer.setLayoutData(new RowData(container.getSize().x, SWT.DEFAULT));
            validationMessageLabel.setLayoutData(new RowData(container.getSize().x, SWT.DEFAULT));
        }
    });

    refreshContraint();         

    return area;
}
项目:neoscada    文件:VisualInterfaceViewer.java   
protected FigureCanvas createCanvas ()
{
    final FigureCanvas canvas = new FigureCanvas ( this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE );

    addControlListener ( new ControlAdapter () {
        @Override
        public void controlResized ( final ControlEvent e )
        {
            handleResize ( getBounds () );
        }
    } );

    return canvas;
}
项目:Hydrograph    文件:ParameterGridDialog.java   
/**
 * Resizes base container on outer shell resize
 * 
 * @param container
 */
private void addControlListener(final Composite container) {
    container.getParent().addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            //textGrid.setHeight(container.getParent().getBounds().height - 150);
            textGrid.setHeight(container.getParent().getBounds().height - 165);
        }
    });
}
项目: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);
}
项目:Hydrograph    文件:LookupMapDialog.java   
private void createInputFieldSection(Composite composite) {

    Composite inputComposite = new Composite(composite, SWT.NONE);
    GridLayout gl_inputComposite = new GridLayout(1, false);
    gl_inputComposite.horizontalSpacing = 0;
    gl_inputComposite.verticalSpacing = 0;
    gl_inputComposite.marginWidth = 0;
    gl_inputComposite.marginHeight = 0;
    inputComposite.setLayout(gl_inputComposite);
    GridData gd_inputComposite = new GridData(SWT.FILL, SWT.FILL, false, true,
            1, 1);
    gd_inputComposite.widthHint = 269;
    inputComposite.setLayoutData(gd_inputComposite);
    inputComposite.setBounds(0, 0, 64, 64);

    ScrolledComposite inputScrolledComposite = new ScrolledComposite(
            inputComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    inputScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
            true, true, 1, 1));
    inputScrolledComposite.setExpandHorizontal(true);
    inputScrolledComposite.setExpandVertical(true);

    final SashForm inputComposite2 = new SashForm(inputScrolledComposite, SWT.VERTICAL);
    inputComposite2.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            in0Table.getColumn(0).setWidth(inputComposite2.getSize().x-5);
            in1Table.getColumn(0).setWidth(inputComposite2.getSize().x-5);
        }
    });
    inputComposite2.setLayout(new GridLayout(1, false));

    addIn0InputFields(inputComposite2);

    addIn1InputFields(inputComposite2);

    inputScrolledComposite.setContent(inputComposite2);
    inputScrolledComposite.setMinSize(inputComposite2.computeSize(SWT.DEFAULT,
            SWT.DEFAULT));
}
项目:team-explorer-everywhere    文件:ErrorLabel.java   
public ErrorLabel(final Composite parent, final int style) {
    super(parent, style);

    label = new Label(this, SWT.NONE);
    GridDataBuilder.newInstance().hHint(16).wHint(16).applyTo(label);

    errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    warningImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);

    validatorBinding = new AbstractValidatorBinding() {
        @Override
        protected void update(final IValidity validity) {
            if (validity.getSeverity() == Severity.OK) {
                clearErrorState();
            } else {
                final IValidationMessage validationMessage = validity.getFirstMessage();
                if (validationMessage == null) {
                    setErrorState(validity.getSeverity(), null);
                } else {
                    setErrorState(validationMessage.getSeverity(), validationMessage.getMessage());
                }
            }
        }
    };

    addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            ErrorLabel.this.controlResized(e);
        }
    });
}
项目:ARXPlugin    文件:ComponentResponsiveLayout.java   
/**
 * Primary will be shown as long as width and height are within the given bounds,
 * otherwise the composite will switch to the secondary control
 * 
 * @param parent
 * @param minWidth
 * @param minHeight
 */
public ComponentResponsiveLayout(final Composite parent, 
                                 final int minWidth, 
                                 final int minHeight,
                                 final Control primary,
                                 final Control secondary) {
    final StackLayout layout = new StackLayout();
    parent.setLayout (layout);
    layout.topControl = primary;
    parent.layout();
    parent.addControlListener(new ControlAdapter(){

        @Override
        public void controlResized(ControlEvent arg0) {

            if (parent.getSize().x < minWidth || parent.getSize().y < minHeight) {
                if (layout.topControl != secondary) {
                    layout.topControl = secondary;
                    parent.layout();
                }
            } else {
                if (layout.topControl != primary) {
                    layout.topControl = primary;
                    parent.layout();
                }
            }
        }
    });
}
项目:bts    文件:PassportEditorPart.java   
private void createRelationTabItem(CTabFolder folder) {
    CTabItem tbtmMain = new CTabItem(folder, SWT.NONE);
    tbtmMain.setText("Relations");
    tbtmMain.setData("relation", "relation");

    final ScrolledComposite scrollComposite = new ScrolledComposite(folder,
            SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    final Composite relationsComp = new Composite(scrollComposite, SWT.NONE);
    tbtmMain.setControl(scrollComposite);
    scrollComposite.setContent(relationsComp);
    scrollComposite.setExpandVertical(true);
    scrollComposite.setExpandHorizontal(true);
    scrollComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle r = scrollComposite.getClientArea();
            scrollComposite.setMinSize(relationsComp.computeSize(r.width,
                    SWT.DEFAULT));
        }
    });

    relationsComp.setLayout(new GridLayout(
            BTSUIConstants.PASSPORT_COLUMN_NUMBER, true));
    ((GridLayout) relationsComp.getLayout()).marginWidth = 0;
    ((GridLayout) relationsComp.getLayout()).marginHeight = 0;


}
项目:bts    文件:PassportEditorPart.java   
private void createIdentifiersTabItem(CTabFolder folder) {
    CTabItem tbtmMain = new CTabItem(folder, SWT.NONE);
    tbtmMain.setText("IDs");
    tbtmMain.setToolTipText("External Identifiers");
    tbtmMain.setData("id", "id");

    final ScrolledComposite scrollComposite = new ScrolledComposite(folder,
            SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    final Composite idsComp = new Composite(scrollComposite, SWT.NONE);
    tbtmMain.setControl(scrollComposite);
    scrollComposite.setContent(idsComp);
    scrollComposite.setExpandVertical(true);
    scrollComposite.setExpandHorizontal(true);
    scrollComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            Rectangle r = scrollComposite.getClientArea();
            scrollComposite.setMinSize(idsComp.computeSize(r.width,
                    SWT.DEFAULT));
        }
    });

    idsComp.setLayout(new GridLayout(
            BTSUIConstants.PASSPORT_COLUMN_NUMBER, true));
    ((GridLayout) idsComp.getLayout()).marginWidth = 0;
    ((GridLayout) idsComp.getLayout()).marginHeight = 0;


}
项目:SPELL    文件:ExecutorsTable.java   
/***************************************************************************
 * Constructor.
 * 
 * @param procId
 *            The procedure identifier
 * @param parent
 *            The parent composite
 **************************************************************************/
public ExecutorsTable(ExecutorComposite parent)
{
    super(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

    m_model = new ExecutorsModel();

    // Table look and feel
    getGrid().setHeaderVisible(true);
    getGrid().setLinesVisible(true);
    applyFonts();
    createColumns();

    // Model and contents
    setContentProvider(new ExecutorsContentProvider());
    setLabelProvider(new ExecutorsLabelProvider());
    setInput(m_model);

    // Setup internal listeners
    addDoubleClickListener( new IDoubleClickListener()
    {
        @Override
        public void doubleClick(DoubleClickEvent arg0)
        {
            onDoubleClick();
        }
    });
    getGrid().addControlListener( new ControlAdapter()
    {
        public void controlResized( ControlEvent ev )
        {
            onControlResized();
        }
    });

    refreshAll();
}
项目:PDFReporter-Studio    文件:Gallery.java   
/**
 * Add internal resize listeners to this gallery.
 */
private void _addResizeListeners() {
    addControlListener(new ControlAdapter() {
        public void controlResized(ControlEvent event) {
            updateStructuralValues(null, true);
            updateScrollBarsProperties();
            redraw();
        }
    });
}
项目:PDFReporter-Studio    文件:WebColorsWidget.java   
/**
 * Create the controls 
 * 
 * @param parent parent of the controls
 * @param style style of the main composite
 * @param oldColor the old color, used to compare it into a preview area with the selected color
 */
public WebColorsWidget(Composite parent, int style, AlfaRGB oldColor) {
    super(parent, style);
    this.setLayout(new GridLayout(2,false));
    selectedColor = AlfaRGB.getFullyOpaque(webColors.get(0));
    colorComposite = new Composite(this, SWT.NONE);
    colorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    colorComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            paintPad();
        }
    });

    Composite rightPanel = new Composite(this, SWT.NONE);
    rightPanel.setLayout(new GridLayout(1,false));
    previewArea = new ColorPreviewWidget(rightPanel, SWT.NONE);
    if (oldColor != null){
        previewArea.setOldColor(oldColor.getRgb(), oldColor.getAlfa());
    }
    previewArea.setNewColor(selectedColor.getRgb(), selectedColor.getAlfa());

    Composite textualInformation = new Composite(rightPanel, SWT.NONE);
    textualInformation.setLayout(new GridLayout(4,false));
    textualInformation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    red = createLabel("R:", textualInformation);
    hue = createLabel("H:", textualInformation);
    green = createLabel("G:", textualInformation);
    saturation = createLabel("S:", textualInformation);
    blue = createLabel("B:", textualInformation);
    brightness = createLabel("B:", textualInformation);
    updateLabels();
}
项目:PDFReporter-Studio    文件:LastUsedColorsWidget.java   
/**
 * Create the controls 
 * 
 * @param parent parent of the controls
 * @param style style of the main composite
 * @param oldColor the old color, used to compare it into a preview area with the selected color
 */
public LastUsedColorsWidget(Composite parent, int style, AlfaRGB oldColor) {
    super(parent, style);
    this.setLayout(new GridLayout(2,false));
    selectedColor = AlfaRGB.getFullyOpaque(new RGB(0,0,0));
    colorComposite = new Composite(this, SWT.NONE);
    colorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    colorComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            //refreshColors();
            paintPad();
        }
    });

    Composite rightPanel = new Composite(this, SWT.NONE);
    rightPanel.setLayout(new GridLayout(1,false));
    previewArea = new ColorPreviewWidget(rightPanel, SWT.NONE);
    if (oldColor != null){
        previewArea.setOldColor(oldColor.getRgb(), oldColor.getAlfa());
    }
    previewArea.setNewColor(selectedColor.getRgb(), selectedColor.getAlfa());

    Composite textualInformation = new Composite(rightPanel, SWT.NONE);
    textualInformation.setLayout(new GridLayout(4,false));
    textualInformation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    red = createLabel("R:", textualInformation);
    hue = createLabel("H:", textualInformation);
    green = createLabel("G:", textualInformation);
    saturation = createLabel("S:", textualInformation);
    blue = createLabel("B:", textualInformation);
    brightness = createLabel("B:", textualInformation);
    alpha = createLabel(Messages.ColorDialog_transparencyLabel+":", textualInformation);
    updateLabels();
}
项目:PDFReporter-Studio    文件:TabbedPropertySheetPage.java   
/**
 * Create the page control
 * 
 * @param parent parent of the page
 */
public void createControl(Composite parent) {
    widgetFactory = new TabbedPropertySheetWidgetFactory(this);
    tabbedPropertyComposite = new TabbedPropertyComposite(parent, this, hasTitleBar);

    tabbedPropertyComposite.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            /*
             * Check the page height when the composite area is resized because the
             * column layout could be changed
             */
            tabbedPropertyComposite.updatePageMinimumSize();
        }
    });

    PlatformUI.getWorkbench().getHelpSystem().setHelp(tabbedPropertyComposite, "com.jaspersoft.studio.doc.view_properties");

    widgetFactory.paintBordersFor(tabbedPropertyComposite);
    tabbedPropertyComposite.setLayout(new FormLayout());
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    tabbedPropertyComposite.setLayoutData(formData);

    tabbedPropertyViewer = new TabbedPropertyViewer(tabbedPropertyComposite.getList());
    tabbedPropertyViewer.setContentProvider(tabListContentProvider);
    tabbedPropertyViewer.addSelectionChangedListener(new SelectionChangedListener());


    if (hasTitleBar && registry == null) {
        initContributor(currentContributorId);
    }
}
项目:mytourbook    文件:DialogSelectSRTMColors.java   
private void createUI_30_VertexImage(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).indent(0, 0).applyTo(container);
        GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, 0).applyTo(container);
        {
            /*
             * profile image
             */
            _canvasProfileImage = new ImageCanvas(container, SWT.NO_BACKGROUND);
            GridDataFactory.fillDefaults().grab(true, true).hint(100, SWT.DEFAULT).applyTo(_canvasProfileImage);
            _canvasProfileImage.addControlListener(new ControlAdapter() {
                @Override
                public void controlResized(final ControlEvent e) {
                    paintProfileImage();
                }
            });

            /*
             * vertex fields
             */
            _vertexOuterContainer = new Composite(container, SWT.NONE);
            GridDataFactory.fillDefaults().grab(false, true).applyTo(_vertexOuterContainer);
            GridLayoutFactory.fillDefaults().applyTo(_vertexOuterContainer);

            createUI_70_VertexFieds();
        }
    }
项目:mytourbook    文件:PrefPageSRTMColors.java   
/**
 * Column: Color image
 */
private void defineColumn_30_ColorImage() {

    final TableColumnDefinition colDef = new TableColumnDefinition(_columnManager, "color", SWT.LEAD); //$NON-NLS-1$
    _colDefImage = colDef;

    colDef.setColumnLabel(Messages.profileViewer_column_label_color);
    colDef.setColumnHeaderText(Messages.profileViewer_column_label_color_header);
    colDef.setColumnHeaderToolTipText(Messages.profileViewer_column_label_color_tooltip);
    colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(30));
    colDef.setIsDefaultColumn();
    colDef.setCanModifyVisibility(false);
    colDef.setLabelProvider(new CellLabelProvider() {
        /*
         * !!! set dummy label provider, otherwise an error occures !!!
         */
        @Override
        public void update(final ViewerCell cell) {}
    });

    colDef.setControlListener(new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            onResizeImageColumn();
        }
    });
}