use of org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure in project tdi-studio-se by Talend.
the class MonitorConnectionLabelConstraint method relocate.
/*
* (non-Javadoc)
*
* @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure)
*/
public void relocate(IFigure figure) {
if (!(figure instanceof SimpleHtmlFigure)) {
this.minimum = FigureUtilities.getTextExtents(text, figure.getFont());
}
figure.setSize(minimum);
Point location;
if (position.equals("start")) {
//$NON-NLS-1$
location = connFigure.getStart();
} else if (position.equals("end")) {
//$NON-NLS-1$
location = connFigure.getEnd();
} else {
location = connFigure.getPoints().getMidpoint();
}
if (offset == null) {
offset = new Point();
}
Point offsetCopy = offset.getCopy();
offsetCopy.translate(location);
offsetCopy.translate(0, -yOffset);
figure.setLocation(offsetCopy);
}
use of org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure in project tdi-studio-se by Talend.
the class ConnLabelConstraint method relocate.
/*
* (non-Javadoc)
*
* @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure)
*/
public void relocate(IFigure figure) {
if (!(figure instanceof SimpleHtmlFigure)) {
this.minimum = FigureUtilities.getTextExtents(text, figure.getFont());
}
figure.setSize(minimum);
Point location;
if (position.equals("start")) {
//$NON-NLS-1$
location = connFigure.getStart();
} else if (position.equals("end")) {
//$NON-NLS-1$
location = connFigure.getEnd();
} else {
location = connFigure.getPoints().getMidpoint();
}
Point offsetCopy = offset.getCopy();
offsetCopy.translate(location);
offsetCopy.translate(-(minimum.width / 2), 0);
figure.setLocation(offsetCopy);
}
use of org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure in project tdi-studio-se by Talend.
the class SubjobContainerFigure method initFigure.
/**
* DOC rdubois Comment method "initFigure".
*/
protected void initFigure() {
outlineFigure = new RoundedRectangle();
rectFig = new RoundedRectangle();
titleFigure = new SimpleHtmlFigure();
titleFigure.setOpaque(true);
collapseFigure = new SubjobCollapseFigure();
collapseFigure.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
IProcess2 process = subjobContainer.getProcess();
if (!process.isReadOnly()) {
PropertyChangeCommand ppc = new PropertyChangeCommand(subjobContainer, EParameterName.COLLAPSED.getName(), !subjobContainer.isCollapsed());
boolean executed = false;
if (process instanceof IGEFProcess) {
IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (designerCoreUIService != null) {
executed = designerCoreUIService.executeCommand((IGEFProcess) process, ppc);
}
}
if (!executed) {
ppc.execute();
}
reSelection();
}
}
});
}
use of org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure in project tdi-studio-se by Talend.
the class NodeLabelEditPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
Node node = ((NodeLabel) getModel()).getNode();
// Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
String text = ((NodeLabel) getModel()).getLabelText();
SimpleHtmlFigure htmlFig = (SimpleHtmlFigure) this.getFigure();
htmlFig.setText(text);
Point loc = node.getLocation().getCopy();
Point offset = ((NodeLabel) getModel()).getOffset();
Point textOffset = new Point();
Dimension size = htmlFig.getPreferredSize();
textOffset.y = node.getSize().height;
textOffset.x = (node.getSize().width - size.width) / 2;
((NodeLabel) getModel()).setTextOffset(textOffset);
loc.translate(textOffset.x + offset.x, textOffset.y + offset.y);
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure in project tdi-studio-se by Talend.
the class NodeLabelEditPart method propertyChange.
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(final PropertyChangeEvent evt) {
String request = evt.getPropertyName();
if (request.equals(NodeLabel.OFFSET_CHANGE)) {
//$NON-NLS-1$ //$NON-NLS-2$
refreshVisuals();
getParent().refresh();
}
if (request.equals(NodeLabel.TEXT_CHANGE)) {
refreshVisuals();
// set the new size to update the node container
((NodeLabel) getModel()).setLabelSize(((SimpleHtmlFigure) figure).getPreferredSize());
NodeLabel label = (NodeLabel) getModel();
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISQLBuilderService.class)) {
ISQLBuilderService service = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
service.updateSqlBuilderDialogTitle(label.getLabelText(), label.getNode().getProcess().getName(), label.getNode().getUniqueName());
}
getParent().refresh();
// refresh the title of component setting view.
ComponentSettingsView viewer = (ComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ComponentSettingsView.ID);
if (viewer != null) {
viewer.updatePropertiesViewerTitle();
}
}
if (request.equals(NodeLabel.LOCATION)) {
//$NON-NLS-1$
refreshVisuals();
getParent().refresh();
}
if (request.equals(EParameterName.ACTIVATE.getName())) {
if (((NodeLabel) getModel()).isActivate()) {
((SimpleHtmlFigure) figure).setAlpha(-1);
((SimpleHtmlFigure) figure).repaint();
refreshVisuals();
} else {
((SimpleHtmlFigure) figure).setAlpha(Node.ALPHA_VALUE);
((SimpleHtmlFigure) figure).repaint();
refreshVisuals();
}
}
EditPart editPart = getParent();
if (editPart != null) {
while ((!(editPart instanceof ProcessPart)) && (!(editPart instanceof SubjobContainerPart))) {
editPart = editPart.getParent();
}
if (editPart instanceof SubjobContainerPart) {
editPart.refresh();
}
}
}
Aggregations