本文整理汇总了Java中org.eclipse.swt.SWT.DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.DOWN属性的具体用法?Java SWT.DOWN怎么用?Java SWT.DOWN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.DOWN属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: widgetSelected
@Override
public void widgetSelected ( final SelectionEvent e )
{
final Table table = this.tableViewer.getTable ();
final TableColumn newColumn = (TableColumn)e.widget;
final TableColumn currentColumn = table.getSortColumn ();
final int currentDir = table.getSortDirection ();
int newDir = SWT.UP;
if ( newColumn == currentColumn )
{
newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
}
else
{
table.setSortColumn ( newColumn );
}
table.setSortDirection ( newDir );
this.tableViewer.setSorter ( new Sorter ( (Columns)newColumn.getData ( COLUMN_KEY ), newDir ) );
}
示例2: widgetSelected
@Override
public void widgetSelected ( final SelectionEvent e )
{
final Table table = this.tableViewer.getTable ();
final TableColumn newColumn = (TableColumn)e.widget;
final TableColumn currentColumn = table.getSortColumn ();
final EventTableColumn column = (EventTableColumn)newColumn.getData ( COLUMN_KEY );
if ( column == EventTableColumn.reservedColumnSourceTimestamp || column == EventTableColumn.reservedColumnEntryTimestamp )
{
final int currentDir = table.getSortDirection ();
int newDir = SWT.UP;
if ( newColumn == currentColumn )
{
newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP;
}
else
{
table.setSortColumn ( newColumn );
}
table.setSortDirection ( newDir );
this.tableViewer.setSorter ( new EventTableSorter ( column, newDir ) );
}
}
示例3: selectSortColumn
private void selectSortColumn(TreeColumn column, int columnIndex) {
TreeColumn prevSortColumn = getTree().getSortColumn();
int sortDirection = SWT.DOWN;
if (prevSortColumn != null) {
int prevSortDirection = getTree().getSortDirection();
if (column.equals(prevSortColumn)) {
sortDirection = prevSortDirection == SWT.UP ? SWT.DOWN : SWT.UP;
getTree().setSortDirection(sortDirection);
} else {
getTree().setSortColumn(column);
getTree().setSortDirection(SWT.DOWN);
}
} else {
getTree().setSortColumn(column);
getTree().setSortDirection(SWT.DOWN);
}
int fSortDirection = sortDirection;
sortColumnSelectionListeners.forEach(listener -> listener.didSelectSortColumn(column, columnIndex, fSortDirection));
}
示例4: sortAndRefresh
private void sortAndRefresh() {
if ( subscriptionsList.isDisposed()){
return;
}
for(int i = 0 ; i < subscriptionItems.length ; i++) {
subscriptionItems[i].selected = false;
}
int currentSelection = subscriptionsList.getSelectionIndex();
if(currentSelection >= 0 && currentSelection < subscriptionItems.length) {
subscriptionItems[currentSelection].selected = true;
}
final int dir = subscriptionsList.getSortDirection() == SWT.DOWN ? 1 : -1;
final boolean nameSort = subscriptionsList.getColumn(0) == subscriptionsList.getSortColumn();
Arrays.sort(subscriptionItems,new Comparator() {
@Override
public int compare(Object arg0, Object arg1) {
SubscriptionItemModel item0 = (SubscriptionItemModel) arg0;
SubscriptionItemModel item1 = (SubscriptionItemModel) arg1;
if(nameSort) {
return dir * item0.name.compareTo(item1.name);
} else {
return dir * (int) (item1.popularity - item0.popularity);
}
}
});
subscriptionsList.setItemCount(subscriptionItems.length);
subscriptionsList.clearAll();
if(currentSelection >= 0 && currentSelection < subscriptionItems.length) {
for(int i = 0 ; i < subscriptionItems.length ; i++) {
if(subscriptionItems[i].selected) {
subscriptionsList.setSelection(i);
}
}
}
}
示例5: invert
private int invert ( final int result )
{
return ( this.dir == SWT.DOWN ? -1 : 1 ) * result;
}
示例6: getDirection
public int getDirection() {
return direction == 1 ? SWT.DOWN : SWT.UP;
}
示例7: rotate
/**
* Rotate an image
* @param image the source
* @param direction : SWT.LEFT will rotate by 90 degrees on the left, SWT.RIGHT will rotate by 90 degrees on the right, SWT.DOWN will rotate by 180 degrees.
* @return the rotated image
*/
private Image rotate(Image image, int direction) {
ImageData srcData = image.getImageData();
int bytesPerPixel = srcData.bytesPerLine / srcData.width;
int destBytesPerLine = (direction == SWT.DOWN) ? srcData.width * bytesPerPixel : srcData.height * bytesPerPixel;
byte[] newData = new byte[srcData.data.length];
boolean isAlpha = srcData.alphaData != null;
byte[] newAlphaData = null;
if (isAlpha) {
newAlphaData = new byte[srcData.alphaData.length];
}
ImageData imgData =
new ImageData((direction == SWT.DOWN) ? srcData.width : srcData.height, (direction == SWT.DOWN) ? srcData.height : srcData.width, srcData.depth,
srcData.palette, destBytesPerLine, newData);
if (isAlpha) {
imgData.alphaData = newAlphaData;
}
imgData.alpha = srcData.alpha;
for (int srcY = 0; srcY < srcData.height; srcY++) {
for (int srcX = 0; srcX < srcData.width; srcX++) {
int destX = 0, destY = 0;
switch (direction) {
case SWT.LEFT: // left 90 degrees
destX = srcY;
destY = srcData.width - srcX - 1;
break;
case SWT.RIGHT: // right 90 degrees
destX = srcData.height - srcY - 1;
destY = srcX;
break;
case SWT.DOWN: // 180 degrees
destX = srcData.width - srcX - 1;
destY = srcData.height - srcY - 1;
break;
}
imgData.setPixel(destX, destY, srcData.getPixel(srcX, srcY));
if (isAlpha) {
imgData.setAlpha(destX, destY, srcData.getAlpha(srcX, srcY));
}
}
}
return new Image(image.getDevice(), imgData);
}
示例8: compare
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
int compareResult = 0;
DBProcess process1 = (DBProcess) e1;
DBProcess process2 = (DBProcess) e2;
switch (columnIndex) {
case 0:
compareResult = compareIntegerValues(process1.getPid(), process2.getPid());
break;
case 1:
compareResult = compareIntegerValues(process1.getChildren().size(), process2.getChildren().size());
break;
case 2:
compareResult = compareStringValues(process1.getQueryCaller().getApplicationName(),
process2.getQueryCaller().getApplicationName());
break;
case 3:
compareResult = compareStringValues(process1.getQueryCaller().getDatabaseName(),
process2.getQueryCaller().getDatabaseName());
break;
case 4:
compareResult = compareStringValues(process1.getQueryCaller().getUserName(),
process2.getQueryCaller().getUserName());
break;
case 5:
compareResult = compareStringValues(process1.getQueryCaller().getClient(),
process2.getQueryCaller().getClient());
break;
case 6:
compareResult = DateUtils.compareDates(process1.getQuery().getBackendStart(),
process2.getQuery().getBackendStart());
break;
case 7:
compareResult = DateUtils.compareDates(process1.getQuery().getQueryStart(),
process2.getQuery().getQueryStart());
break;
case 8:
compareResult = DateUtils.compareDates(process1.getQuery().getXactStart(),
process2.getQuery().getXactStart());
break;
case 9:
compareResult = compareStringValues(process1.getState(), process2.getState());
break;
case 10:
compareResult = DateUtils.compareDates(process1.getStateChange(), process2.getStateChange());
break;
case 11:
compareResult = compareStringValues(process1.getBlocksPidsString(), process2.getBlocksPidsString());
break;
case 12:
compareResult = compareStringValues(process1.getBlocksLocktypesString(),
process2.getBlocksLocktypesString());
break;
case 13:
compareResult = compareStringValues(process1.getBlocksRelationsString(),
process2.getBlocksRelationsString());
break;
case 14:
compareResult = compareStringValues(process1.getQuery().getQueryString(),
process2.getQuery().getQueryString());
break;
case 15:
compareResult = compareBooleans(process1.getQuery().isSlowQuery(), process2.getQuery().isSlowQuery());
break;
default:
break;
}
return sortDirection == SWT.DOWN ? compareResult : -compareResult;
}
示例9: createButton
/**
* Creates the button for this cell area under the given parent control.
* <p>
* The default implementation of this framework method creates the button
* display on the right hand side of the dialog cell area. Subclasses
* may extend or reimplement.
* </p>
*
* @param parent the parent control
* @return the new button control
*/
protected Button createButton(Composite parent) {
Button result = new Button(parent, SWT.DOWN);
result.setText("..."); //$NON-NLS-1$
GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdata.heightHint = 22;
result.setLayoutData(gdata);
return result;
}