• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GridColumn类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.eclipse.nebula.widgets.grid.GridColumn的典型用法代码示例。如果您正苦于以下问题:Java GridColumn类的具体用法?Java GridColumn怎么用?Java GridColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GridColumn类属于org.eclipse.nebula.widgets.grid包,在下文中一共展示了GridColumn类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createColumns

点赞 3

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/***************************************************************************
 * Create the table columns
 **************************************************************************/
protected void createColumns()
{
	for (CodeViewerColumn colModel : CodeViewerColumn.values())
	{
		// Create the TableColumn with right alignment
		int style = colModel.getAlignment() | SWT.H_SCROLL;
		GridViewerColumn viewerColumn = new GridViewerColumn(this, style);

		GridColumn column = viewerColumn.getColumn();
		column.setText(colModel.getName());
		column.setAlignment(colModel.getAlignment());
		column.setWidth(colModel.getInitialWidth());
		column.setResizeable(colModel.isResizable());
	}
}
 

开发者ID:Spacecraft-Code,
项目名称:SPELL,
代码行数:19,
代码来源:CodeViewer.java

示例2: resetColumnWidths

点赞 3

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/***************************************************************************
 * Reset the column widths to defaults
 **************************************************************************/
public void resetColumnWidths()
{
	int totalWidth = 0;
	for (CodeViewerColumn colModel : CodeViewerColumn.values())
	{
		if (colModel.equals(CodeViewerColumn.CODE)) continue;
		GridColumn column = getGrid().getColumn(colModel.ordinal());
		int width = colModel.getInitialWidth();
		totalWidth += width;
		column.setWidth(width);
	}
	int gridWidth = getGrid().getBounds().width;
	if (getGrid().getVerticalBar().isVisible())
	{
		gridWidth -= getGrid().getVerticalBar().getSize().x;
	}
	if (totalWidth < gridWidth)
	{
		int widthForCode = gridWidth - totalWidth - 4;
		getGrid().getColumn(CodeViewerColumn.CODE.ordinal()).setWidth( widthForCode );
	}
}
 

开发者ID:Spacecraft-Code,
项目名称:SPELL,
代码行数:26,
代码来源:CodeViewer.java

示例3: clearSelection

点赞 3

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
void clearSelection() {
	int start = selection.x;
	int end = selection.y;
	selection.x = selection.y = caretOffset;
	selectionAnchor = -1;
	// redraw old selection, if any
	if (end - start > 0 && gridTable.getItems().length != 0) {
		if (layout == null && focusItemIndex != -1 && focusItemIndex != -1) {
			GridItem item = gridTable.getItem(focusItemIndex);
			GridColumn col = gridTable.getColumn(focusColIndex);
			GridCellRenderer gcr = col.getCellRenderer();
			if (gcr != null && gcr instanceof XGridCellRenderer) {
				GC gc = new GC(gcr.getDisplay());
				layout = ((XGridCellRenderer) gcr).getTextLayout(gc, item, focusColIndex, true, false);
				gc.dispose();
			}
			if (layout == null) {
				return;
			}
		}
		Rectangle rect = layout.getBounds(start, end);
		gridTable.redraw(rect.x + coordinateOffsetX, rect.y + coordinateOffsetY, rect.width, rect.height, false);
	}
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:25,
代码来源:GridCopyEnable.java

示例4: createColumn

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
private static GridColumn createColumn(Grid table, int style, int index) 
{
    if (index >= 0) 
    {
        return new GridColumn(table, style, index);
    }

    return new GridColumn(table, style);
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:10,
代码来源:GridViewerColumn.java

示例5: getControlBounds

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
 * @return the bounds reserved for the control
 */
protected Rectangle getControlBounds(Object value, boolean preferred) {
	Rectangle bounds = getBounds();
	GridColumn column = (GridColumn) value;
	Point controlSize = computeControlSize(column);

	int y = getBounds().y + getBounds().height - bottomMargin - controlSize.y;

	return new Rectangle(bounds.x+3,y,bounds.width-6,controlSize.y);
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:13,
代码来源:DefaultColumnHeaderRenderer.java

示例6: SWTGridColumn

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
 * Create a new column
 *
 * @param grid
 *            the containing grid
 * @param cellValueFunction
 *            the value function
 * @param style
 *            SWT style
 */
protected SWTGridColumn(@NonNull SWTGridTable<R> grid, @NonNull Function<@NonNull R, @Nullable C> cellValueFunction, int style) {
	this.cellValueFunctionProperty = new SimpleProperty<>(cellValueFunction);
	this.grid = grid;
	this.indexProperty = new SimpleProperty<@NonNull Integer>(new Integer(grid.getColumns().size()));

	nebulaColumn = new GridColumn(grid.getNebulaGrid(), style);

	registerListeners();
	registerPropertyListeners();
}
 

开发者ID:BestSolution-at,
项目名称:framework-grid,
代码行数:21,
代码来源:SWTGridColumn.java

示例7: construct

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
@Override
public Control construct(Composite parent) {
	Composite content = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(content);
	GridLayoutFactory.swtDefaults().numColumns(1).applyTo(content);

	Grid grid = new Grid(content, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid.setHeaderVisible(true);

	GridColumn treeColumn = new GridColumn(grid, SWT.NONE);
	treeColumn.setWidth(120);
	treeColumn.setText("Name");
	treeColumn.setTree(true);

	GridColumn emptyHeaderColumn = new GridColumn(grid, SWT.CHECK);
	emptyHeaderColumn.setWidth(30);

	GridColumn duplicateHeaderColumn = new GridColumn(grid, SWT.NONE);
	duplicateHeaderColumn.setWidth(120);
	duplicateHeaderColumn.setText("Name");

	GridItem item = new GridItem(grid, SWT.NONE);
	item.setText("Item");
	GridItem editItem = new GridItem(grid, SWT.NONE);
	editItem.setText("Editable Item");

	GridItem childItem1 = new GridItem(item, SWT.NONE);
	childItem1.setText("Child 1");
	GridItem childItem2 = new GridItem(item, SWT.NONE);
	childItem2.setText("Child 2");

	GridEditor editor = new GridEditor(grid);
	editor.grabHorizontal = true;
	Text text = new Text(grid, SWT.NONE);
	text.setText("Editable");
	editor.setEditor(text, editItem, 2);

	GridDataFactory.fillDefaults().grab(true, true).applyTo(grid);
	return content;
}
 

开发者ID:xored,
项目名称:q7.quality.mockups,
代码行数:41,
代码来源:GridDemo.java

示例8: construct

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
@Override
public Control construct(Composite parent) {
	Composite content = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.FILL).grab(true, true).applyTo(content);
	GridLayoutFactory.swtDefaults().numColumns(2).applyTo(content);

	Grid grid1 = new Grid(content, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid1.setHeaderVisible(true);

	GridColumn treeColumn = new GridColumn(grid1, SWT.NONE);
	treeColumn.setWidth(120);
	treeColumn.setText("Name");
	treeColumn.setTree(true);

	GridItem item = new GridItem(grid1, SWT.NONE);
	item.setText("Item");
	GridItem childItem1 = new GridItem(item, SWT.NONE);
	childItem1.setText("Child 1");
	GridItem childItem2 = new GridItem(item, SWT.NONE);
	childItem2.setText("Child 2");

	Grid grid2 = new Grid(content, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid2.setHeaderVisible(true);

	GridColumn emptyHeaderColumn = new GridColumn(grid2, SWT.CHECK);
	emptyHeaderColumn.setWidth(30);

	GridItem item2 = new GridItem(grid2, SWT.NONE);
	item2.setText("Item in Grid 2");

	GridDataFactory.fillDefaults().grab(true, true).applyTo(grid1);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(grid2);
	return content;
}
 

开发者ID:xored,
项目名称:q7.quality.mockups,
代码行数:35,
代码来源:TwoGrids.java

示例9: handleVerticalScroll

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
void handleVerticalScroll(Event event) {
	GridVisibleRange visibleR = gridTable.getVisibleRange();
	GridItem[] items = visibleR.getItems();
	boolean itemFlg = false;
	for (GridItem item : items) {
		if (focusItem == item) {
			itemFlg = true;
		}
	}
	boolean columnFlg = false;
	GridColumn[] columns = visibleR.getColumns();
	if (columns.length - 1 >= focusColIndex) {
		columnFlg = true;
	}
	if (!itemFlg || !columnFlg) {
		defaultCaret.setVisible(false);
		return;
	}
	defaultCaret.setVisible(true);

	GridColumn col = gridTable.getColumn(focusColIndex);
	GridCellRenderer gcr = col.getCellRenderer();
	int colIndex = gcr.getColumn();
	if (gcr == null || !(gcr instanceof XGridCellRenderer) || !copyAbleColumnIndexs.contains(colIndex)) {
		return;
	}
	XGridCellRenderer cellRender = (XGridCellRenderer) gcr;

	Rectangle cellBounds = focusItem.getBounds(colIndex);
	GC gc = new GC(Display.getDefault());
	TextLayout layout = null;
	try {
		layout = cellRender.getTextLayout(gc, focusItem, colIndex, true, false);
		if (layout == null) {
			gc.dispose();
			return;
		}
		Point point = layout.getLocation(caretOffset, false);
		coordinateOffsetX = cellBounds.x + cellRender.leftMargin;
		coordinateOffsetY = cellBounds.y + cellRender.topMargin + cellRender.textTopMargin;
		defaultCaret.setLocation(point.x + coordinateOffsetX, point.y + coordinateOffsetY);
	} finally {
		if (layout != null) {
			layout.dispose();
		}
		if (gc != null) {
			gc.dispose();
		}
	}
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:51,
代码来源:GridCopyEnable.java

示例10: GridViewerColumn

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
GridViewerColumn(ColumnViewer viewer, GridColumn column) {
	super(viewer, column);
	this.viewer = viewer;
    this.column = column;
    hookColumnResizeListener();
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:7,
代码来源:GridViewerColumn.java

示例11: computeSize

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
    * {@inheritDoc}
    */
   public Point computeSize(GC gc, int wHint, int hHint, Object value)
   {
       GridColumn column = (GridColumn)value;

       gc.setFont(column.getHeaderFont());

       int x = leftMargin;
       int y = topMargin + gc.getFontMetrics().getHeight() + bottomMargin;


       if (column.getImage() != null)
       {
           x += column.getImage().getBounds().width + imageSpacing;

           y = Math.max(y, topMargin + column.getImage().getBounds().height + bottomMargin);
       }
       if (!isWordWrap())
       {
         x += gc.stringExtent(column.getText()).x + rightMargin;
       }
       else
       {
         int plainTextWidth;
         if (wHint == SWT.DEFAULT)
           plainTextWidth = getBounds().width - x - rightMargin;
         else
           plainTextWidth = wHint - x - rightMargin;

         getTextLayout(gc, column);
           textLayout.setText(column.getText());
           textLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth);

           x += plainTextWidth + rightMargin;

           int textHeight = topMargin;
           textHeight += textLayout.getBounds().height;
           textHeight += bottomMargin;

           y = Math.max(y, textHeight);
       }


	y += computeControlSize(column).y;

	return new Point(x, y);
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:50,
代码来源:DefaultColumnHeaderRenderer.java

示例12: computeControlSize

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
private Point computeControlSize(GridColumn column) {
	if( column.getHeaderControl() != null ) {
		return column.getHeaderControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
	}
	return new Point(0,0);
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:7,
代码来源:DefaultColumnHeaderRenderer.java

示例13: doMouseLocationChange

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
void doMouseLocationChange(int x, int y, boolean select) {
	if (gridTable.getItems().length == 0) {
		defaultCaret.setVisible(false);
		return;
	}
	Point eventP = new Point(x, y);
	GridItem _focusItem = gridTable.getItem(eventP);
	GridColumn col = gridTable.getColumn(eventP);
	if (_focusItem == null) {
		return;
	}
	GridCellRenderer gcr = col.getCellRenderer();
	int colIndex = gcr.getColumn();
	if (gcr == null || !(gcr instanceof XGridCellRenderer) || !copyAbleColumnIndexs.contains(colIndex)) {
		return;
	}
	XGridCellRenderer cellRender = (XGridCellRenderer) gcr;

	Rectangle cellBounds = _focusItem.getBounds(colIndex);
	GC gc = new GC(Display.getDefault());
	layout = cellRender.getTextLayout(gc, _focusItem, colIndex, true, false);
	if (layout == null) {
		gc.dispose();
		return;
	}
	focusContent = layout.getText();
	coordinateOffsetX = cellBounds.x + cellRender.leftMargin;
	coordinateOffsetY = cellBounds.y + cellRender.topMargin + cellRender.textTopMargin;
	if (!select) {
		focusCellRect.x = cellBounds.x;
		focusCellRect.y = cellBounds.y;
		focusCellRect.height = cellBounds.height;
		focusCellRect.width = cellBounds.width;
		focusColIndex = colIndex;
		focusItemIndex = gridTable.getIndexOfItem(_focusItem);
	}

	int[] trailing = new int[1];
	int newCaretOffset = layout.getOffset(x - coordinateOffsetX, y - coordinateOffsetY, trailing);

	int newCaretLine = layout.getLineIndex(newCaretOffset + trailing[0]);
	int lineStart = layout.getLineOffsets()[newCaretLine];
	Point point = null;
	if (newCaretOffset + trailing[0] == lineStart && trailing[0] != 0) {
		newCaretOffset += trailing[0];
		newCaretOffset = layout.getPreviousOffset(newCaretOffset, SWT.MOVEMENT_CLUSTER);
		point = layout.getLocation(newCaretOffset, true);
	} else {
		newCaretOffset += trailing[0];
		point = layout.getLocation(newCaretOffset, false);
	}

	// check area, only in cell area effective
	boolean vchange = focusCellRect.y <= y && y < focusCellRect.y + focusCellRect.height;
	boolean hchange = focusCellRect.x <= x && x < focusCellRect.x + focusCellRect.width;

	if (vchange && hchange && newCaretOffset != caretOffset) {
		focusItem = _focusItem;
		caretOffset = newCaretOffset;
		if (select) {
			doMouseSelection();
		}
		defaultCaret.setVisible(true);
		Rectangle rc = layout.getLineBounds(newCaretLine);
		defaultCaret.setBounds(point.x + coordinateOffsetX, point.y + coordinateOffsetY, 0, rc.height);
	}
	if (!select) {
		caretOffset = newCaretOffset;
		clearSelection();
	}
	layout.dispose();
	layout = null;
	gc.dispose();
}
 

开发者ID:heartsome,
项目名称:tmxeditor8,
代码行数:75,
代码来源:GridCopyEnable.java

示例14: getNebulaColumn

点赞 2

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
 * @return nebula grid column
 */
public GridColumn getNebulaColumn() {
	return nebulaColumn;
}
 

开发者ID:BestSolution-at,
项目名称:framework-grid,
代码行数:7,
代码来源:SWTGridColumn.java

示例15: computeSize

点赞 1

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Point computeSize(GC gc, int wHint, int hHint, Object value)
{
    GridColumn column = (GridColumn)value;

    gc.setFont(column.getFooterFont());

    int x = 0;

    x += leftMargin;

    x += gc.stringExtent(column.getText()).x + rightMargin;

    int y = 0;

    y += topMargin;

    y += gc.getFontMetrics().getHeight();

    y += bottomMargin;

    if (column.getFooterImage() != null)
    {
        x += column.getFooterImage().getBounds().width + imageSpacing;

        y = Math.max(y, topMargin + column.getFooterImage().getBounds().height + bottomMargin);
    }

    return new Point(x, y);
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:33,
代码来源:DefaultColumnFooterRenderer.java

示例16: getColumn

点赞 1

import org.eclipse.nebula.widgets.grid.GridColumn; //导入依赖的package包/类
/**
 * Returns the underlying column.
 * 
 * @return the underlying Nebula column
 */
public GridColumn getColumn() 
{
    return column;
}
 

开发者ID:heartsome,
项目名称:translationstudio8,
代码行数:10,
代码来源:GridViewerColumn.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)