use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class AbstractFixRatioSizeFeedbackFactory method showSizeOnDropFeedback.
@Override
public void showSizeOnDropFeedback(CreateRequest request, IFigure feedbackFigure, Insets insets) {
Point p = new Point(request.getLocation().getCopy());
IFigure feedback = getSizeOnDropFeedback(request);
feedback.translateToRelative(p);
Dimension size = request.getSize().getCopy();
feedback.translateToRelative(size);
if (isSquareSizeRequired((AbstractWidgetModel) request.getNewObject())) {
if (size.width < getMinimumWidth() && size.height < getMinimumWidth())
size.width = getMinimumWidth();
else
size.width = Math.max(size.width, getWidthFromHeight(size.height, (AbstractWidgetModel) request.getNewObject()));
size.height = getHeightFromWidth(size.width, (AbstractWidgetModel) request.getNewObject());
}
feedback.setBounds(new Rectangle(p, size).expand(insets));
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class ChangeOrientationAction method run.
@Override
public void run() {
CompoundCommand compoundCommand = new CompoundCommand(orientationType.getLabel());
for (AbstractWidgetModel widgetModel : getSelectedWidgetModels()) {
compoundCommand.add(new ChangeOrientationCommand(widgetModel, orientationType));
}
execute(compoundCommand);
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class DistributeWidgetsAction method getVerticalCompressCommand.
private Command getVerticalCompressCommand() {
AbstractWidgetModel[] sortedModelArray = getSortedModelArray(false);
CompoundCommand cmd = new CompoundCommand("Vertical Compress Distribution");
int startX = sortedModelArray[0].getY() + sortedModelArray[0].getHeight();
for (int i = 1; i < sortedModelArray.length; i++) {
cmd.add(new SetWidgetPropertyCommand(sortedModelArray[i], AbstractWidgetModel.PROP_YPOS, startX));
startX += sortedModelArray[i].getHeight();
}
return cmd;
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class DistributeWidgetsAction method getHorizontalCenterCommand.
private Command getHorizontalCenterCommand() {
AbstractWidgetModel[] sortedModelArray = getSortedModelArray(true);
CompoundCommand cmd = new CompoundCommand("Horizontal Center Distribution");
int averageGap = (getCenterLoc(sortedModelArray[sortedModelArray.length - 1], true) - getCenterLoc(sortedModelArray[0], true)) / (sortedModelArray.length - 1);
int startX = getCenterLoc(sortedModelArray[0], true);
for (int i = 1; i < sortedModelArray.length - 1; i++) {
cmd.add(new SetWidgetPropertyCommand(sortedModelArray[i], AbstractWidgetModel.PROP_XPOS, startX + averageGap - sortedModelArray[i].getWidth() / 2));
startX += averageGap;
}
return cmd;
}
use of org.csstudio.opibuilder.model.AbstractWidgetModel in project yamcs-studio by yamcs.
the class ShowMacrosAction method run.
@Override
public void run(IAction action) {
AbstractWidgetModel widget = (AbstractWidgetModel) getSelectedWidget().getModel();
String message = NLS.bind("The predefined macros of {0}:\n", widget.getName());
StringBuilder sb = new StringBuilder(message);
Map<String, String> macroMap = OPIBuilderMacroUtil.getWidgetMacroMap(widget);
for (final Map.Entry<String, String> entry : macroMap.entrySet()) {
sb.append(entry.getKey() + "=" + entry.getValue() + "\n");
}
sb.append("\n");
sb.append("Note: Macros are loaded during OPI opening, so this won't reflect the macro changes after opening." + "To reflect the latest changes, please reopen the OPI and show macros again.");
// show the dialog first, because on some linux systems the console print brings the workbench window to top,
// blocking entire CSS
MessageDialog.openInformation(targetPart.getSite().getShell(), "Predefined Macros", sb.toString());
ConsoleService.getInstance().writeInfo(sb.toString());
}
Aggregations