Home » Modeling » GMF (Graphical Modeling Framework) » The size of figures
| |
Re: The size of figures [message #805652 is a reply to message #805183] |
Fri, 24 February 2012 01:41 |
bjyjtdj znjhmyy Messages: 5 Registered: February 2012 |
Junior Member |
|
|
Hi,
Thanks for your reply. In fact, I just want to develop a workflow editor and the figure is correspond to a component.
But the problem mentioned above troubles me a lot. Here I make a detailed description:
Even the figure enlarges(drag the border of the editor, not the figure), it will not be saved. When I exit and re-open, the size of
the figure will not change. No exception throws with these opreations.
name="process">
<figures
name="Default">
<figures
xsi:type="gmfgraph:PolylineDecoration"
name="FolderFoldersTargetDecoration"/>
<figures
xsi:type="gmfgraph:PolylineDecoration"
name="FolderFilesTargetDecoration"/>
<descriptors
name="ComponentFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="ComponentFigure">
<layout
xsi:type="gmfgraph:GridLayout"/>
<backgroundColor
xsi:type="gmfgraph:ConstantColor"
value="lightGray"/>
<children
xsi:type="gmfgraph:Label"
name="ComponentNameFigure"
text=""/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.0/@actualFigure/@children.0"/>
</descriptors>
<descriptors
name="ConnectionFigure">
<actualFigure
xsi:type="gmfgraph:PolylineConnection"
name="ConnectionFigure">
<children
xsi:type="gmfgraph:Label"
name="ConnectionNameFigure"/>
<children
xsi:type="gmfgraph:PolygonDecoration"
name="Arrow"
lineWidth="2">
<template
x="-2"
y="2"/>
<template/>
<template
x="-2"
y="-2"/>
</children>
</actualFigure>
<accessors
accessor="getFigureConnectionNameFigure"
figure="//@figures.0/@descriptors.1/@actualFigure/@children.0"/>
</descriptors>
<descriptors
name="FileFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="FileFigure">
<layout
xsi:type="gmfgraph:FlowLayout"/>
<children
xsi:type="gmfgraph:Label"
name="FileNameFigure"
text="<...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.2/@actualFigure/@children.0"/>
</descriptors>
<descriptors
name="FolderFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="FolderFigure">
<layout
xsi:type="gmfgraph:FlowLayout"/>
<children
xsi:type="gmfgraph:Label"
name="FolderNameFigure"
text="<...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.3/@actualFigure/@children.0"/>
</descriptors>
<descriptors
name="FolderFoldersFigure">
<actualFigure
xsi:type="gmfgraph:PolylineConnection"
name="FolderFoldersFigure"
targetDecoration="//@figures.0/@figures.0"/>
</descriptors>
<descriptors
name="TestFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="TestFigure">
<layout
xsi:type="gmfgraph:FlowLayout"/>
<children
xsi:type="gmfgraph:Label"
name="TestNameFigure"
text="<...>"/>
</actualFigure>
<accessors
figure="//@figures.0/@descriptors.5/@actualFigure/@children.0"/>
</descriptors>
<descriptors
name="FolderFilesFigure">
<actualFigure
xsi:type="gmfgraph:PolylineConnection"
name="FolderFilesFigure"
targetDecoration="//@figures.0/@figures.1"/>
</descriptors>
</figures>
<nodes
name="Component"
figure="ComponentFigure"/>
<nodes
name="File"
figure="FileFigure"/>
<nodes
name="Folder"
figure="FolderFigure"/>
<nodes
name="Test"
figure="TestFigure"/>
<connections
name="Connection"
figure="ConnectionFigure"/>
<connections
name="FolderFolders"
figure="FolderFoldersFigure"/>
<connections
name="FolderFiles"
figure="FolderFilesFigure"/>
<labels
name="ComponentName"
figure="ComponentFigure"
elementIcon="false"
accessor="//@figures.0/@descriptors.0/@accessors.0"/>
<labels
name="ConnectionName"
figure="ConnectionFigure"
elementIcon="false"
accessor="//@figures.0/@descriptors.1/@accessors.0"/>
<labels
name="FileName"
figure="FileFigure"
accessor="//@figures.0/@descriptors.2/@accessors.0"/>
<labels
name="FolderName"
figure="FolderFigure"
accessor="//@figures.0/@descriptors.3/@accessors.0"/>
<labels
name="TestName"
figure="TestFigure"
accessor="//@figures.0/@descriptors.5/@accessors.0"/>
</gmfgraph:Canvas>
public class ComponentFigure extends RectangleFigure {
public static final int NO_LABEL = 0;
public static final int SUCCESS_LABEL = 2;
public static final int FAIL_LABEL = 3;
private static final String SUCCESS_IMAGE_PATH = "icons/imagesCAGJMN7G.jpg";
private static final String FAILED_IMAGE_PATH = "icons/imagesCAJI64PE.jpg";
ImageFigure imageFigure;
LineBorder border = new LineBorder();
/**
* @generated
*/
private WrappingLabel fFigureComponentNameFigure;
/**
* @generated
*/
public ComponentFigure() {
GridLayout layoutThis = new GridLayout();
this.setLayoutManager(layoutThis);
this.setLineWidth(1);
createContents(NO_LABEL);
this.setBorder(this.border);
}
public void setBorderColor(Color color) {
this.border.setWidth(4);
this.border.setColor(color);
}
public void removeBorder() {
this.border.setWidth(1);
this.border.setColor(ColorConstants.darkGray);
}
// /**
// * @generated
// */
// private void createContents() {
// this.removeAll();
// ComponentDefinition def = ComponentManager.getComponentRegistry()
// .get(component.getType());
// Image image = ImageFactory.getImage(def.getIcon(), def
// .getBundleid());
// imageFigure = new ImageFigure(image);
// add(imageFigure, new GridData(SWT.CENTER, SWT.CENTER, false, false,
// 1, 1));
// fFigureComponentNameFigure = new WrappingLabel();
// fFigureComponentNameFigure.setText("");
// add(fFigureComponentNameFigure, new GridData(SWT.CENTER,
// SWT.BOTTOM, false, false, 1, 1));
//
//
// }
private void createContents(int label) {
this.removeAll();
Image image2 = null;
switch (label) {
case SUCCESS_LABEL:
image2 = ImageFactory.getImage(SUCCESS_IMAGE_PATH,
ProcessDiagramEditorPlugin.ID);
break;
case FAIL_LABEL:
image2 = ImageFactory.getImage(FAILED_IMAGE_PATH,
ProcessDiagramEditorPlugin.ID);
break;
}
if (image2 != null) {
ImageFigure imageF = new ImageFigure(image2);
imageF.setSize(20, 20);
add(imageF,
new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
}
ComponentDefinition def = ComponentManager.getComponentRegistry()
.get(component.getType());
Image image = ImageFactory.getImage(def.getIcon(), def
.getBundleid());
imageFigure = new ImageFigure(image);
add(imageFigure, new GridData(SWT.CENTER, SWT.CENTER, false, false,
1, 1));
fFigureComponentNameFigure = this.getFigureComponentNameFigure();
add(fFigureComponentNameFigure, new GridData(SWT.CENTER,
SWT.BOTTOM, false, false, 1, 1));
}
/**
* @generated
*/
private boolean myUseLocalCoordinates = false;
/**
* @generated
*/
protected boolean useLocalCoordinates() {
return myUseLocalCoordinates;
}
/**
* @generated
*/
protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
myUseLocalCoordinates = useLocalCoordinates;
}
/**
* @generated
*/
public WrappingLabel getFigureComponentNameFigure() {
if (this.fFigureComponentNameFigure == null) {
fFigureComponentNameFigure = new WrappingLabel();
fFigureComponentNameFigure.setText("");
}
return fFigureComponentNameFigure;
}
}
|
|
|
Goto Forum:
Current Time: Wed Apr 24 16:15:47 GMT 2024
Powered by FUDForum. Page generated in 0.03370 seconds
|