本文整理汇总了Java中org.eclipse.swt.events.ControlEvent类的典型用法代码示例。如果您正苦于以下问题:Java ControlEvent类的具体用法?Java ControlEvent怎么用?Java ControlEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControlEvent类属于org.eclipse.swt.events包,在下文中一共展示了ControlEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTabFolderToPropertyWindow
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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;
}
示例2: arrangeTableViewerColumns
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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);
}
}
}
});
}
示例3: createColumns
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
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);
}
}
示例4: TableLayoutComposite
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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);
}
});
}
示例5: controlResized
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
@Override
public void controlResized(ControlEvent e) {
if (getBounds().height <= 20) {
mTree.setHeaderVisible(false);
noHeader = true;
} else if (noHeader) {
mTree.setHeaderVisible(true);
noHeader = false;
}
if (getBounds().height <= 38) {
mTreeViewer.setInput(null);
noInput = true;
} else if (noInput) {
mTreeViewer.setInput(mModel);
noInput = false;
}
}
示例6: controlResized
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
public void controlResized(ControlEvent e) {
Rectangle area;
if(e.widget instanceof Composite){
area = ((Composite)e.widget).getClientArea();
}else if(e.widget instanceof Table){
area = ((Table)e.widget).getClientArea();
}else{
return;
}
org.eclipse.swt.graphics.Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = area.width - 2 * table.getBorderWidth();
if (preferredSize.y > area.height + table.getHeaderHeight()) {
org.eclipse.swt.graphics.Point vBarSize = table.getVerticalBar().getSize();
width -= vBarSize.x;
}
org.eclipse.swt.graphics.Point oldSize = table.getSize();
if (oldSize.x > area.width) {
adjustColumnSize(width - 20);
table.setSize(area.width, area.height);
} else {
table.setSize(area.width, area.height);
adjustColumnSize(width - 20);
}
super.controlResized(e);
}
示例7: setupScrolledComposite
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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);
}
示例8: createPartControl
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
@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);
}
}
示例9: install
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* @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);
}
示例10: autoAdjustColumnWidth
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
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);
}
});
}
示例11: TableLayoutComposite
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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);
}
});
}
示例12: createUI
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
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);
}
}
示例13: defineColumn_30_ColorImage
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
/**
* 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) {}
});
}
示例14: createUI_30_ProfileImage
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
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();
}
});
}
示例15: createUI_568_IL_SpeedTourType_ScrolledContainer
import org.eclipse.swt.events.ControlEvent; //导入依赖的package包/类
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;
}