Java源码示例:org.eclipse.draw2d.ToolbarLayout
示例1
public EventFigure(ITimelineEvent event) {
final ToolbarLayout layout = new ToolbarLayout(false);
layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
layout.setStretchMinorAxis(true);
setLayoutManager(layout);
setLayoutManager(new CenterLayout());
setLineWidth(2);
fLabel = new Label(event.getTitle());
fLabel.setForegroundColor(ColorConstants.black);
add(fLabel);
if (event.getMessage() != null)
setToolTip(new EventTooltip(event.getMessage()));
}
示例2
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(final Figure top) {
final ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例3
private void addRow(String name, String value, String tableStyle) {
final Border border = new MarginBorder(5);
final ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
final Label nameLabel = new Label();
final Label valueLabel = new Label();
nameLabel.setBorder(border);
nameLabel.setText(name);
nameLabel.setLabelAlignment(PositionConstants.LEFT);
nameLabel.setForegroundColor(foregroundColor);
add(nameLabel);
if (!DisplayMessages.getMessage("action.title.change.design.simple").equals(tableStyle)
&& !DisplayMessages.getMessage("action.title.change.design.frame").equals(tableStyle)) {
valueLabel.setBackgroundColor(ColorConstants.white);
valueLabel.setOpaque(true);
valueLabel.setForegroundColor(ColorConstants.black);
} else {
valueLabel.setOpaque(false);
valueLabel.setForegroundColor(foregroundColor);
}
valueLabel.setBorder(border);
valueLabel.setText(value);
valueLabel.setLabelAlignment(PositionConstants.LEFT);
add(valueLabel);
}
示例4
@Override
public void initTitleBar(Figure top) {
final ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
this.nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例5
public ClassFigure(String name, Color color) {
ToolbarLayout layout = new ToolbarLayout();
layout.setSpacing(5);
setLayoutManager(layout);
setBorder(new CompoundBorder( new LineBorder(1), new MarginBorder(0, 0, 0, 0)));
setBackgroundColor(color);
setOpaque(true);
Label className = new Label(name, DecorationConstants.CLASS);
className.setToolTip(new Label(name));
className.setFont(DecorationConstants.classFont);
add(className);
new ClassFigureMover(this);
}
示例6
public PMClassFigure(String name, int numOfAttributes, int numOfMethods){
this.numOfAttributes = numOfAttributes;
this.numOfMethods= numOfMethods;
this.name = name;
Label classLabel = new Label(name , DecorationConstants.CLASS);
Label infoLabel = new Label(" Number Of Methods: "+ numOfMethods + "\n Number Of Attributes: "+ numOfAttributes);
originalTooltip.setLayoutManager(new ToolbarLayout());
originalTooltip.add(classLabel);
originalTooltip.add(infoLabel);
setToolTip(originalTooltip);
originalBorder.setColor(originalColor);
setBorder(originalBorder);
setBackgroundColor(originalColor);
}
示例7
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(Figure top) {
ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
this.nameLabel = new Label();
this.nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(this.getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例8
public TrackFigure(String title, ITimelineStyleProvider styleProvider) {
fTitle = title;
final ToolbarLayout layout = new ToolbarLayout(false);
layout.setStretchMinorAxis(true);
layout.setSpacing(5);
setLayoutManager(layout);
updateStyle(styleProvider);
}
示例9
protected AbstractNode(EObject eObject, String text, Font font, Region textRegion) {
if (eObject != null)
grammarElementURI = EcoreUtil.getURI(eObject);
setLayoutManager(new ToolbarLayout());
setBackgroundColor(getUnselectedBackgroundColor());
label = new Label(text);
add(label);
setBorder(createBorder());
setFont(font);
this.textRegion = textRegion;
}
示例10
public CategoryFigure(final String name) {
setOpaque(true);
final ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
label = new Label();
label.setText(name);
label.setBorder(new MarginBorder(7));
this.add(label);
}
示例11
private void addRow(final String name, final String value, final String tableStyle) {
final Border border = new MarginBorder(5);
final ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
final Label nameLabel = new Label();
final Label valueLabel = new Label();
nameLabel.setBorder(border);
nameLabel.setText(name);
nameLabel.setLabelAlignment(PositionConstants.LEFT);
nameLabel.setForegroundColor(foregroundColor);
this.add(nameLabel);
if (!ResourceString.getResourceString("action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString("action.title.change.design.frame").equals(tableStyle)) {
valueLabel.setBackgroundColor(ColorConstants.white);
valueLabel.setOpaque(true);
valueLabel.setForegroundColor(ColorConstants.black);
} else {
valueLabel.setOpaque(false);
valueLabel.setForegroundColor(foregroundColor);
}
valueLabel.setBorder(border);
valueLabel.setText(value);
valueLabel.setLabelAlignment(PositionConstants.LEFT);
this.add(valueLabel);
}
示例12
protected void initColumnArea(final IFigure columns) {
final ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
layout.setSpacing(0);
columns.setBorder(new MarginBorder(0, 2, 2, 2));
columns.setLayoutManager(layout);
columns.setBackgroundColor(null);
columns.setOpaque(false);
}
示例13
private static void main() throws FileNotFoundException {
try {
shell.setSize(100, 100);
final LightweightSystem lws = new LightweightSystem(shell);
final IFigure panel = new Figure();
panel.setLayoutManager(new ToolbarLayout());
initialize(panel);
lws.setContents(panel);
shell.open();
final Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} finally {
if (image != null) {
image.dispose();
}
}
}
示例14
public CategoryFigure(String name) {
setOpaque(true);
final ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
this.label = new Label();
label.setText(name);
label.setBorder(new MarginBorder(7));
add(label);
}
示例15
public ERModelFigure(String name) {
setOpaque(true);
final ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
this.label = new Label();
label.setText(name);
label.setBorder(new MarginBorder(7));
add(label);
}
示例16
public WalkerGroupFigure(String name) {
setOpaque(true);
final ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
this.label = new Label();
label.setText(name);
label.setBorder(new MarginBorder(7));
add(label);
}
示例17
protected void initColumnArea(IFigure columns) {
final ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
layout.setSpacing(0);
columns.setBorder(new MarginBorder(0, 2, 2, 2));
columns.setLayoutManager(layout);
columns.setBackgroundColor(null);
columns.setOpaque(false);
}
示例18
public MethodClassSection(){
//setFont( Display.getCurrent().getSystemFont() );
ToolbarLayout layout = new ToolbarLayout();
layout.setSpacing(5);
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
setLayoutManager(layout);
}
示例19
public TableNodeFigure( String name )
{
ToolbarLayout mainLayout = new ToolbarLayout( );
mainLayout.setStretchMinorAxis( true );
mainLayout.setVertical( true );
mainLayout.setSpacing( 1 );
this.setLayoutManager( mainLayout );
this.setOpaque( true );
}
示例20
private static void main() throws FileNotFoundException {
// �f�t�H���gDisplay���g�p���ăV�F�����쐬
try {
shell.setSize(100, 100); // �V�F���̃T�C�Y���w��
// �쐬�����V�F�����g�p����LightweightSystem�̍쐬
LightweightSystem lws = new LightweightSystem(shell);
// ���[�g�E�t�B�M���A�̍쐬
IFigure panel = new Figure();
panel.setLayoutManager(new ToolbarLayout());
initialize(panel);
// ���[�g�E�t�B�M���A�̓o�^
lws.setContents(panel);
// �ȉ��́A���̑���SWT�A�v���P�[�V�����Ɠ��l
shell.open();
Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} finally {
if (image != null) {
image.dispose();
}
}
}
示例21
public VGroupFigure(String name) {
this.setOpaque(true);
ToolbarLayout layout = new ToolbarLayout();
this.setLayoutManager(layout);
this.label = new Label();
this.label.setText(name);
this.label.setBorder(new MarginBorder(7));
this.add(this.label);
}
示例22
public CategoryFigure(String name) {
this.setOpaque(true);
ToolbarLayout layout = new ToolbarLayout();
this.setLayoutManager(layout);
this.label = new Label();
this.label.setText(name);
this.label.setBorder(new MarginBorder(7));
this.add(this.label);
}
示例23
public ERModelFigure(String name) {
this.setOpaque(true);
ToolbarLayout layout = new ToolbarLayout();
this.setLayoutManager(layout);
this.label = new Label();
this.label.setText(name);
this.label.setBorder(new MarginBorder(7));
this.add(this.label);
}
示例24
private void addRow(String name, String value, String tableStyle) {
Border border = new MarginBorder(5);
ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
Label nameLabel = new Label();
Label valueLabel = new Label();
nameLabel.setBorder(border);
nameLabel.setText(name);
nameLabel.setLabelAlignment(PositionConstants.LEFT);
nameLabel.setForegroundColor(this.foregroundColor);
this.add(nameLabel);
if (!ResourceString.getResourceString(
"action.title.change.design.simple").equals(tableStyle)
&& !ResourceString.getResourceString(
"action.title.change.design.frame").equals(tableStyle)) {
valueLabel.setBackgroundColor(ColorConstants.white);
valueLabel.setOpaque(true);
valueLabel.setForegroundColor(ColorConstants.black);
} else {
valueLabel.setOpaque(false);
valueLabel.setForegroundColor(this.foregroundColor);
}
valueLabel.setBorder(border);
valueLabel.setText(value);
valueLabel.setLabelAlignment(PositionConstants.LEFT);
this.add(valueLabel);
}
示例25
protected void initColumnArea(IFigure columns) {
ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
layout.setSpacing(0);
columns.setBorder(new MarginBorder(0, 2, 2, 2));
columns.setLayoutManager(layout);
columns.setBackgroundColor(null);
columns.setOpaque(false);
}
示例26
public TracksLayer() {
final ToolbarLayout layout = new ToolbarLayout(false);
layout.setStretchMinorAxis(true);
setLayoutManager(layout);
}
示例27
public CursorTimingsLayer() {
setLayoutManager(new ToolbarLayout(false));
setVisible(false);
}
示例28
@Override
protected LayoutManager createLayoutManager() {
ToolbarLayout layout = new ToolbarLayout();
layout.setSpacing(ILayoutConstants.VSPACE_BETWEEN_TRACKS);
return layout;
}
示例29
protected boolean isHorizontal() {
IFigure figure = ((GraphicalEditPart)getHost()).getContentPane();
return ((ToolbarLayout)figure.getLayoutManager()).isHorizontal();
}