本文整理汇总了Java中org.eclipse.draw2d.GridLayout.setConstraint方法的典型用法代码示例。如果您正苦于以下问题:Java GridLayout.setConstraint方法的具体用法?Java GridLayout.setConstraint怎么用?Java GridLayout.setConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.GridLayout
的用法示例。
在下文中一共展示了GridLayout.setConstraint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReferenceFigure
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
public ReferenceFigure(IReferenceModel model) {
super(model, false);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = 3;
layout.verticalSpacing = 0;
setLayoutManager(layout);
label = new Label(model.getName());
label.setForegroundColor(ColorConstants.black);
FontManager.setFont(label, PandionJConstants.VAR_FONT_SIZE);
String tooltip = Utils.getTooltip(model);
Collection<String> tags = model.getTags();
if(!tags.isEmpty())
tooltip += "\ntags: " + String.join(", ", tags);
label.setToolTip(new Label(tooltip));
add(label);
refLabel = new ReferenceLabel(model);
add(refLabel);
layout.setConstraint(refLabel, new GridData(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH));
}
示例2: createPositionsFig
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
private RoundedRectangle createPositionsFig() {
RoundedRectangle fig = new RoundedRectangle();
fig.setOpaque(false);
fig.setCornerDimensions(PandionJConstants.OBJECT_CORNER);
fig.setBackgroundColor(PandionJConstants.Colors.OBJECT);
GridLayout layout = new GridLayout(horizontal ? (model.getLength() > PandionJView.getMaxArrayLength() ? N + 1 : Math.max(1, N)) : 1, false);
layout.verticalSpacing = 0;
layout.horizontalSpacing = PandionJConstants.ARRAY_POSITION_SPACING;
layout.marginWidth = PandionJConstants.ARRAY_MARGIN;
layout.marginHeight = PandionJConstants.ARRAY_MARGIN;
fig.setLayoutManager(layout);
fig.setToolTip(new Label("length = " + model.getLength()));
if(N == 0) {
Label empty = new Label("");
GridData layoutData = new GridData(POSITION_WIDTH/2, POSITION_WIDTH);
layout.setConstraint(empty, layoutData);
fig.add(empty);
}
else {
Iterator<Integer> it = model.getValidModelIndexes();
while(it.hasNext()) {
Integer i = it.next();
if(!it.hasNext() && model.getLength() > PandionJView.getMaxArrayLength()) {
Position emptyPosition = new Position(null);
fig.add(emptyPosition);
}
Position p = new Position(i);
fig.add(p);
positions.add(p);
}
}
return fig;
}
示例3: Position
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
public Position(Integer index) {
GridLayout layout = new GridLayout(horizontal ? 1 : 2, false);
if(horizontal){
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
layout.marginHeight = 0;
}
else{
layout.verticalSpacing = 6;
layout.horizontalSpacing = 3;
layout.marginHeight = 4;
}
layout.marginWidth = 0;
setLayoutManager(layout);
if(index != null){
valueLabel = createValueLabel(model.getElementModel(index));
}else{
valueLabel = new ValueLabel("...", false);
}
layout.setConstraint(valueLabel, createValueLabelGridData(index == null));
add(valueLabel);
indexLabel = new ValueLabel(indexText(index), true);
layout.setConstraint(indexLabel, createIndexLabelGridData());
add(indexLabel, horizontal ? 1 : 0);
}
示例4: ValueExtensionFigure
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
public ValueExtensionFigure(IValueModel model, IFigure figure) {
super(model, false);
layout = new GridLayout(1, false);
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
layout.marginHeight = 0;
layout.marginWidth = 0;
setLayoutManager(layout);
Figure comp = new Figure();
GridLayout compLayout = new GridLayout(2,false);
compLayout.marginHeight = 0;
compLayout.marginWidth = 0;
compLayout.horizontalSpacing = 3;
compLayout.verticalSpacing = 0;
comp.setLayoutManager(compLayout);
String tooltip = Utils.getTooltip(model);
Label nameLabel = new Label(model.getName());
nameLabel.setForegroundColor(ColorConstants.black);
FontManager.setFont(nameLabel, PandionJConstants.VAR_FONT_SIZE);
nameLabel.setToolTip(new Label(tooltip));
comp.add(nameLabel);
comp.add(figure);
add(comp);
layout.setConstraint(comp, new GridData(SWT.RIGHT, SWT.DEFAULT, true, false));
}
示例5: Position
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
public Position(Integer index) {
int width = POSITION_WIDTH;
if(model.isDecimal())
width *= 2;
GridData layoutData = new GridData(width, POSITION_WIDTH+20);
arrayLayout.setConstraint(this, layoutData);
GridLayout layout = Constants.getOneColGridLayout();
setLayoutManager(layout);
if(index != null) {
IValueModel m = model.getElementModel(index);
valueLabel = new ValueLabel(m);
layout.setConstraint(valueLabel, new GridData(width, POSITION_WIDTH));
add(valueLabel);
}else {
Label emptyLabel = new Label("...");
FontManager.setFont(this, Constants.VALUE_FONT_SIZE);
IValueModel measure = model.getElementModel(model.getLength() - 1);
setSize(measure.isDecimal() || measure.isBoolean() ? Constants.POSITION_WIDTH*2 : Constants.POSITION_WIDTH, Constants.POSITION_WIDTH);
layout.setConstraint(emptyLabel, new GridData(width, POSITION_WIDTH));
add(emptyLabel);
}
indexLabel = new Label(index == null ? "..." : Integer.toString(index));
FontManager.setFont(indexLabel, INDEX_FONT_SIZE);
indexLabel.setLabelAlignment(SWT.CENTER);
indexLabel.setForegroundColor(ColorConstants.gray);
layout.setConstraint(indexLabel, layoutCenter);
add(indexLabel);
}
示例6: RuntimeViewer
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
RuntimeViewer(Composite parent) {
super(parent, SWT.BORDER);
instance = this;
setLayout(new FillLayout());
setBackground(PandionJConstants.Colors.VIEW_BACKGROUND);
scroll = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL);
scroll.setBackground(PandionJConstants.Colors.VIEW_BACKGROUND);
canvas = new Canvas(scroll, SWT.DOUBLE_BUFFERED);
canvas.setBackground(ColorConstants.white);
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
scroll.setContent(canvas);
addMenu();
// rootFig = new ScalableLayeredPane();
// ((ScalableLayeredPane) rootFig).setScale(2);
rootFig = new Figure();
rootFig.setOpaque(true);
rootGrid = new GridLayout(2, false);
rootGrid.horizontalSpacing = PandionJConstants.STACK_TO_OBJECTS_GAP;
rootGrid.marginWidth = PandionJConstants.MARGIN;
rootGrid.marginHeight = PandionJConstants.MARGIN;
rootFig.setLayoutManager(rootGrid);
stackFig = new StackContainer();
rootFig.add(stackFig);
org.eclipse.draw2d.GridData d = new org.eclipse.draw2d.GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
d.widthHint = Math.max(PandionJConstants.STACKCOLUMN_MIN_WIDTH, stackFig.getPreferredSize().width);
rootGrid.setConstraint(stackFig, d);
objectContainers = new ArrayList<>();
objectContainer = ObjectContainer.create(true);
rootFig.add(objectContainer);
rootGrid.setConstraint(objectContainer, new org.eclipse.draw2d.GridData(SWT.FILL, SWT.FILL, true, true));
lws = new LightweightSystem(canvas);
lws.setContents(rootFig);
pointersMap = new HashMap<>();
pointersMapOwners = ArrayListMultimap.create();
}
示例7: setupSize
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
private void setupSize(JRDesignChart jdc, GridLayout lm, ChartFigure cf) {
GridData gd = new GridData();
gd.heightHint = jdc.getHeight();
gd.widthHint = jdc.getWidth();
lm.setConstraint(cf, gd);
}
示例8: refreshVisuals
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
@Override
protected void refreshVisuals()
{
axisNameLabel.setName(getAxis().getName());
GraphicalEditPart parent = (GraphicalEditPart) getParent();
boolean horizontal =
((ChartSet) parent.getParent().getParent().getParent().getModel())
.getOrientation() == Orientation.HORIZONTAL;
GridLayout layout = (GridLayout) getFigure().getLayoutManager();
if (horizontal)
{
layout.numColumns = 1;
parent.setLayoutConstraint(this, figure, new GridData(GridData.FILL,
GridData.CENTER, true, false));
layout.setConstraint(datasetsPane, new GridData(GridData.FILL,
GridData.CENTER, true, false));
layout.setConstraint(arrowFigure, new GridData(GridData.FILL,
GridData.CENTER, true, false));
layout.setConstraint(axisNameLabel, new GridData(GridData.FILL,
GridData.CENTER, true, false));
axisNameLabel.setVertical(false);
arrowFigure.setHorizontal(true);
}
else
{
layout.numColumns = figure.getChildren().size();
parent.setLayoutConstraint(this, figure, new GridData(GridData.CENTER,
GridData.FILL, false, true));
layout.setConstraint(datasetsPane, new GridData(GridData.CENTER,
GridData.FILL, false, true));
layout.setConstraint(arrowFigure, new GridData(GridData.CENTER,
GridData.FILL, false, true));
layout.setConstraint(axisNameLabel, new GridData(GridData.CENTER,
GridData.FILL, false, true));
axisNameLabel.setVertical(true);
arrowFigure.setHorizontal(false);
}
layout.invalidate();
parent.refresh();
GridLayout layoutManager = (GridLayout) datasetsPane.getLayoutManager();
layoutManager.numColumns = horizontal ? 1 : getModelChildren().size();
layoutManager.invalidate();
}
示例9: refreshVisuals
import org.eclipse.draw2d.GridLayout; //导入方法依赖的package包/类
@Override
protected void refreshVisuals()
{
String name = getAxis().getName();
if (name == null)
{
name = "<unnamed>";
}
axisNameLabel.getLabel().setText("Shared axis: " + name);
if (boldFont == null)
{
FontData fontData = axisNameLabel.getFont().getFontData()[0];
boldFont = new Font(Display.getCurrent(), new FontData(fontData.getName(),
fontData.getHeight(), SWT.BOLD));
}
axisNameLabel.getLabel().setFont(boldFont);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
EditPart parent = getParent();
((GraphicalEditPart) parent).setLayoutConstraint(this, figure, gridData);
boolean horizontal = ((ChartSet) parent.getModel())
.getOrientation() == Orientation.HORIZONTAL;
GridLayout layoutManager = (GridLayout) getFigure().getLayoutManager();
if (horizontal)
{
arrowFigure.setHorizontal(false);
axisNameLabel.setVertical(true);
layoutManager.setConstraint(arrowFigure, new GridData(GridData.CENTER,
GridData.FILL, false, true));
layoutManager.setConstraint(axisNameLabel, new GridData(GridData.CENTER,
GridData.FILL, false, true));
layoutManager.numColumns = getFigure().getChildren().size();
}
else
{
arrowFigure.setHorizontal(true);
axisNameLabel.setVertical(false);
layoutManager.setConstraint(arrowFigure, new GridData(GridData.FILL,
GridData.CENTER, true, false));
layoutManager.setConstraint(axisNameLabel, new GridData(GridData.FILL,
GridData.CENTER, true, false));
layoutManager.numColumns = 1;
}
layoutManager.invalidate();
getFigure().invalidate();
}