use of org.talend.designer.gefabstractmap.figures.var.VarEntityFigure in project tdi-studio-se by Talend.
the class SearchZoneMapper method setEntryState.
public void setEntryState(MapperManager mapperManager, EntryState entryState, Figure entry) {
if (entry != null) {
if (entry instanceof XmlmapTreeNodeFigure) {
XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
if (xmlMapTreeNodeFigure != null) {
if (xmlMapTreeNodeFigure.getExpressionFigure() != null && matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(entryState.getColor());
}
if (xmlMapTreeNodeFigure.getTreeNode() != null && matcher.matches(xmlMapTreeNodeFigure.getTreeNode().getName())) {
if (XmlMapUtil.isSubElementOfDocument(xmlMapTreeNodeFigure.getTreeNode())) {
if (!xmlMapTreeNodeFigure.getTreeNode().getName().endsWith("(choice)")) {
xmlMapTreeNodeFigure.getBranchContent().setOpaque(true);
xmlMapTreeNodeFigure.getBranchContent().setBackgroundColor(entryState.getColor());
}
} else {
xmlMapTreeNodeFigure.setOpaque(true);
xmlMapTreeNodeFigure.setBackgroundColor(entryState.getColor());
xmlMapTreeNodeFigure.setOpaque(false);
if (xmlMapTreeNodeFigure.getExpressionFigure() != null && !matcher.matches(xmlMapTreeNodeFigure.getExpressionFigure().getText())) {
// xmlMapTreeNodeFigure.getExpressionFigure().setOpaque(true);
// xmlMapTreeNodeFigure.getExpressionFigure().setBackgroundColor(EntryState.NONE.getColor());
}
}
}
}
} else if (entry instanceof VarEntityFigure) {
VarEntityFigure varEntityFigure = (VarEntityFigure) entry;
if (varEntityFigure != null) {
if (varEntityFigure.getExpression() != null && matcher.matches(varEntityFigure.getExpression().getText())) {
varEntityFigure.getExpression().setOpaque(true);
varEntityFigure.getExpression().setBackgroundColor(entryState.getColor());
}
if (varEntityFigure.getVarName() != null && matcher.matches(varEntityFigure.getVarName())) {
varEntityFigure.setOpaque(true);
varEntityFigure.setBackgroundColor(entryState.getColor());
if (varEntityFigure.getExpression() == null || !matcher.matches(varEntityFigure.getExpression().getText())) {
varEntityFigure.getExpression().setOpaque(true);
varEntityFigure.getExpression().setBackgroundColor(EntryState.NONE.getColor());
}
varEntityFigure.getTypeFigure().setOpaque(true);
varEntityFigure.getTypeFigure().setBackgroundColor(EntryState.NONE.getColor());
}
}
} else if (entry instanceof XmlMapFilterContainer) {
XmlMapFilterContainer filterText = (XmlMapFilterContainer) entry;
if (filterText != null && filterText.getTextArea() != null) {
filterText.getTextArea().setOpaque(true);
filterText.getTextArea().setBackgroundColor(entryState.getColor());
}
}
}
}
use of org.talend.designer.gefabstractmap.figures.var.VarEntityFigure in project tdi-studio-se by Talend.
the class RowSelectionEditPolicy method getLocatorFigure.
private IFigure getLocatorFigure(GraphicalEditPart owner) {
IFigure figure = owner.getFigure();
if (owner instanceof TableEntityPart) {
TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
// table figure to restrict the width
MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
Rectangle treeBounds = parentFigure.getBounds();
Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
Rectangle treeNodeBounds = figure.getBounds();
figure = new Figure();
if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
return figure;
} else {
figure.setBounds(owner.getFigure().getBounds().getCopy());
figure.getBounds().height = rowBounds.height;
return figure;
}
} else if (figure instanceof VarEntityFigure) {
Rectangle copy = figure.getBounds().getCopy();
figure = new Figure();
figure.setBounds(copy);
return figure;
}
return owner.getFigure();
}
use of org.talend.designer.gefabstractmap.figures.var.VarEntityFigure in project tdi-studio-se by Talend.
the class VarColumnAnchor method getReferencePoint.
@Override
public Point getReferencePoint() {
Point ref = null;
final VarTablePart varTablePart = (VarTablePart) MapperUtils.getMapperTablePart(entityManager.getEditPart());
if (entityManager.isTableMinimized()) {
if (isSource) {
ref = varTablePart.getFigure().getBounds().getRight();
} else {
ref = varTablePart.getFigure().getBounds().getLeft();
}
} else if (getOwner() instanceof TableTreeEntityFigure) {
TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
// normal column
if (nodeFigure.getTreeBranch() == null) {
if (isSource) {
ref = getOwner().getBounds().getRight();
} else {
if (nodeFigure.getElement() != null) {
ref = nodeFigure.getElement().getBounds().getLeft();
} else {
ref = getOwner().getBounds().getLeft();
}
}
getOwner().translateToAbsolute(ref);
}
} else if (getOwner() instanceof VarEntityFigure) {
VarEntityFigure varNodeFigure = (VarEntityFigure) getOwner();
if (isSource) {
ref = getOwner().getBounds().getRight();
ref.x = varTablePart.getFigure().getBounds().getRight().x;
} else {
if (varNodeFigure.getExpression() != null) {
ref = varNodeFigure.getExpression().getBounds().getLeft();
} else {
ref = getOwner().getBounds().getLeft();
}
}
getOwner().translateToAbsolute(ref);
} else {
ref = getOwner().getBounds().getCenter();
getOwner().translateToAbsolute(ref);
}
return ref;
}
use of org.talend.designer.gefabstractmap.figures.var.VarEntityFigure in project tdi-studio-se by Talend.
the class VarNodeEditPart method performRequest.
@Override
public void performRequest(Request req) {
IFigure figure = null;
Figure selectedFigure = null;
if (RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
DirectEditRequest drequest = (DirectEditRequest) req;
Point figureLocation = drequest.getLocation();
if (getFigure() instanceof VarEntityFigure) {
figure = ((VarEntityFigure) getFigure()).findFigureAt(figureLocation);
}
// if (figure != null ) {
if (figure != null) {
// if (figure instanceof VariableContainerFigure) {
// figure = ((VariableContainerFigure) figure).getVariableLabel();
// }
selectedFigure = (Figure) figure;
directEditManager = new XmlMapNodeDirectEditManager(this, new XmlMapNodeCellEditorLocator(selectedFigure));
}
// }
if (directEditManager != null) {
directEditManager.show();
((XmlMapGraphicViewer) getViewer()).getMapperManager().setCurrentDirectEditManager(directEditManager);
}
}
}
use of org.talend.designer.gefabstractmap.figures.var.VarEntityFigure in project tdi-studio-se by Talend.
the class VarNodeEditPart method notifyChanged.
@Override
public void notifyChanged(Notification notification) {
int type = notification.getEventType();
int featureId = notification.getFeatureID(XmlmapPackage.class);
switch(type) {
case Notification.SET:
switch(featureId) {
case XmlmapPackage.VAR_NODE__EXPRESSION:
((VarEntityFigure) getFigure()).getExpression().setText(((VarNode) getModel()).getExpression());
break;
case XmlmapPackage.VAR_NODE__NULLABLE:
boolean newBoolean = notification.getNewBooleanValue();
ImageFigure checkImage = ((VarEntityFigure) getFigure()).getCheckImage();
if (newBoolean) {
checkImage.setImage(ImageProvider.getImage(EImage.CHECKED_ICON));
} else if (!newBoolean) {
checkImage.setImage(ImageProvider.getImage(EImage.UNCHECKED_ICON));
}
break;
case XmlmapPackage.VAR_NODE__NAME:
((VarEntityFigure) getFigure()).getVariableLabel().setText(((VarNode) getModel()).getName());
break;
case XmlmapPackage.VAR_NODE__TYPE:
((VarEntityFigure) getFigure()).updateVarNodeType(((VarNode) getModel()).getType(), ((VarNode) getModel()).isNullable());
// refreshVisuals();
break;
default:
}
case Notification.ADD:
switch(featureId) {
case XmlmapPackage.VAR_NODE__INCOMING_CONNECTIONS:
refreshTargetConnections();
break;
case XmlmapPackage.VAR_NODE__OUTGOING_CONNECTIONS:
case XmlmapPackage.VAR_NODE__FILTER_OUT_GOING_CONNECTIONS:
refreshSourceConnections();
break;
}
case Notification.REMOVE:
case Notification.REMOVE_MANY:
switch(featureId) {
case XmlmapPackage.VAR_NODE__INCOMING_CONNECTIONS:
refreshTargetConnections();
break;
case XmlmapPackage.VAR_NODE__OUTGOING_CONNECTIONS:
case XmlmapPackage.VAR_NODE__FILTER_OUT_GOING_CONNECTIONS:
refreshSourceConnections();
break;
}
}
}
Aggregations