use of org.eclipse.draw2d.GridData in project tdi-studio-se by Talend.
the class StatsAndLogsView method createEmptyPartControl.
/**
* Creates a empty composite if no job opened.
*
* @param parent
*/
private void createEmptyPartControl(Composite parent) {
if (parent != null && !parent.isDisposed()) {
Control[] children = parent.getChildren();
for (Control control : children) {
control.dispose();
}
}
Composite alertComposite = new Composite(parent, SWT.NONE);
alertComposite.setLayout(new GridLayout());
alertComposite.setLayoutData(new GridData());
Text alertText = new Text(alertComposite, SWT.NONE);
//$NON-NLS-1$
alertText.setText(Messages.getString("StatsAndLogsView.dataNotAvailable"));
alertText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
parent.layout();
}
use of org.eclipse.draw2d.GridData in project cubrid-manager by CUBRID.
the class GraphPlanTooltipFigure method addKeyValueItem.
public void addKeyValueItem(String key, String value) {
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = 5;
layout.verticalSpacing = 0;
layout.makeColumnsEqualWidth = true;
Label namelbl = new Label();
namelbl.setFont(bolderFont);
namelbl.setTextAlignment(PositionConstants.LEFT);
namelbl.setText(key);
GridData nameData = new GridData(SWT.NONE);
nameData.grabExcessHorizontalSpace = true;
nameData.horizontalSpan = 0;
getKeyValueCompartment().add(namelbl, nameData);
Label valueLbl = new Label();
valueLbl.setFont(normalFont);
valueLbl.setTextAlignment(PositionConstants.RIGHT);
valueLbl.setText(value);
GridData valueData = new GridData(SWT.NONE);
valueData.grabExcessHorizontalSpace = true;
valueData.horizontalSpan = 0;
getKeyValueCompartment().add(valueLbl, valueData);
updateMap(key + value, keyValueFigures, namelbl, valueLbl);
}
use of org.eclipse.draw2d.GridData in project hale by halestudio.
the class CellFigureTaskLabelContribution method contribute.
// private TaskServiceListener taskServiceListener;
@Override
public void contribute(CellFigure figure, Cell cell) {
TaskService taskService = HaleUI.getServiceProvider().getService(TaskService.class);
Collection<ResolvedTask<Cell>> tasks = taskService.getTasks(cell).stream().map(t -> taskService.resolveTask(t)).collect(Collectors.toList());
tasks = tasks.stream().filter(t -> t.isOpen()).collect(Collectors.toList());
if (tasks.isEmpty()) {
return;
}
Label tasksLabel = new Label();
Image tasksImage = null;
tasksImage = CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_TASKS);
tasksLabel.setIcon(tasksImage);
tasksLabel.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent me) {
try {
IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TaskTreeView.ID);
// the alignment/mapping view
if (part instanceof TaskTreeView) {
((TaskTreeView) part).update(new StructuredSelection(cell));
}
me.consume();
} catch (PartInitException e) {
log.error("Error creating task view", e);
}
}
@Override
public void mousePressed(MouseEvent me) {
// ignore
}
@Override
public void mouseDoubleClicked(MouseEvent me) {
// ignore
}
});
if (tasksImage != null) {
Label priorityTip = new Label(MessageFormat.format("There {0} {1} open tasks for this cell. Please refer to the Tasks view for details.", (tasks.size() == 1) ? "is" : "are", tasks.size()));
tasksLabel.setToolTip(priorityTip);
}
GridData tasksLabelGD = new GridData(GridData.CENTER, GridData.FILL, false, true);
figure.add(tasksLabel, tasksLabelGD);
}
use of org.eclipse.draw2d.GridData in project archi by archimatetool.
the class TextPositionDelegate method updateTextPosition.
public void updateTextPosition() {
int textPosition = SWT.CENTER;
switch(fTextPositionObject.getTextPosition()) {
case ITextPosition.TEXT_POSITION_TOP:
textPosition = SWT.TOP;
break;
case ITextPosition.TEXT_POSITION_CENTRE:
textPosition = SWT.CENTER;
break;
case ITextPosition.TEXT_POSITION_BOTTOM:
textPosition = SWT.BOTTOM;
break;
default:
break;
}
int textAlignment = SWT.CENTER;
if (fTextPositionObject instanceof ITextAlignment) {
switch(((ITextAlignment) fTextPositionObject).getTextAlignment()) {
case ITextAlignment.TEXT_ALIGNMENT_LEFT:
textAlignment = SWT.LEFT;
break;
case ITextAlignment.TEXT_ALIGNMENT_CENTER:
textAlignment = SWT.CENTER;
break;
case ITextAlignment.TEXT_ALIGNMENT_RIGHT:
textAlignment = SWT.RIGHT;
break;
default:
break;
}
}
GridData gd = new GridData(textAlignment, textPosition, true, true);
fParentFigure.setConstraint(fChildFigure, gd);
}
use of org.eclipse.draw2d.GridData in project archi by archimatetool.
the class AbstractTextControlContainerFigure method createTextFlowControl.
protected TextFlow createTextFlowControl(Locator textLocator) {
TextFlow textFlow = new TextFlow();
int wordWrapStyle = Preferences.STORE.getInt(IPreferenceConstants.ARCHIMATE_FIGURE_WORD_WRAP_STYLE);
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, wordWrapStyle));
BlockFlow block = new BlockFlow();
block.add(textFlow);
FlowPage page = new FlowPage();
page.add(block);
Figure textWrapperFigure = new Figure();
GridLayout layout = new GridLayout();
layout.marginWidth = getTextControlMarginWidth();
layout.marginHeight = 5;
textWrapperFigure.setLayoutManager(layout);
GridData gd = new GridData(SWT.CENTER, SWT.TOP, true, true);
textWrapperFigure.add(page, gd);
if (getDiagramModelObject() instanceof ITextPosition) {
fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, page, (ITextPosition) getDiagramModelObject());
}
add(textWrapperFigure, textLocator);
return textFlow;
}
Aggregations