Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » The size of figures
The size of figures [message #805042] Thu, 23 February 2012 09:18 Go to next message
bjyjtdj znjhmyy is currently offline bjyjtdj znjhmyyFriend
Messages: 5
Registered: February 2012
Junior Member
Hi guys,
I have come up with a problem of using GMF.
When I open the diagram editor and drag the border of it, all of the Figures in it automatically become larger. But if I move the position of a Figure , the problem
will not happen to it.
I want to know the possible causes of it.

Regards
  • Attachment: case.jpg
    (Size: 14.92KB, Downloaded 188 times)
Re: The size of figures [message #805183 is a reply to message #805042] Thu, 23 February 2012 12:53 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

I suspect there is a problem with figure definition -- probably there is invisible rectangle (outline=false) as a parent for figure and label.
Please post the relevant part of the gmfgraph model and generated figure code (inner class) here to confirm.

What is your intention with the figure, do you want label to have a fixed position under the square or you are fine to allow user to move it near the square?

Regards,
Michael "Borlander" Golubev
at Montages Think Tank, Prague, Czech Republic
Montages AG, Zürich, Switzerland
Re: The size of figures [message #805652 is a reply to message #805183] Fri, 24 February 2012 01:41 Go to previous message
bjyjtdj znjhmyy is currently offline bjyjtdj znjhmyyFriend
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="&lt;...>"/>
      </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="&lt;...>"/>
      </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="&lt;...>"/>
      </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;
		}

	}


Previous Topic:Use GMF outside Eclipse in standalone application
Next Topic:Rotate label
Goto Forum:
  


Current Time: Wed Apr 24 16:15:47 GMT 2024

Powered by FUDForum. Page generated in 0.03370 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top