當前位置: 首頁>>代碼示例>>Java>>正文


Java IFigure.add方法代碼示例

本文整理匯總了Java中org.eclipse.draw2d.IFigure.add方法的典型用法代碼示例。如果您正苦於以下問題:Java IFigure.add方法的具體用法?Java IFigure.add怎麽用?Java IFigure.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.draw2d.IFigure的用法示例。


在下文中一共展示了IFigure.add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: connect

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
private void connect ( final IFigure figure, final IFigure source, final IFigure target )
{
    final PolylineConnection c = new PolylineConnection ();
    c.setSourceAnchor ( new ChopboxAnchor ( source ) );
    c.setTargetAnchor ( new ChopboxAnchor ( target ) );

    final PolygonDecoration dec = new PolygonDecoration ();
    dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
    dec.setBackgroundColor ( ColorConstants.black );
    c.setTargetDecoration ( dec );

    figure.add ( c );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:14,代碼來源:InputScaleDetails.java

示例2: align

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
/**
 * Aligns the selected {@link PossibleStepEditPart}.
 */
private void align() {
	final IFigure figure = getFigure();
	int existing = 0;
	while (figure.getChildren().size() - existing - 2 >= 0
			&& figure.getChildren().get(figure.getChildren().size() - existing - 2) instanceof PaddingFigure) {
		++existing;
	}
	final int offset = ((BranchEditPart)getParent()).getModel().getTimelineWindow().getMaxSelectedIndex(
			getModel().getBranch())
			- getModel().getConnectedIndex();

	if (existing < offset) {
		for (int i = 0; i < offset - existing; ++i) {
			figure.add(new PaddingFigure(), figure.getChildren().size() - 1);
		}
	} else if (existing > offset) {
		for (int i = 1; i <= existing - offset; ++i) {
			if (figure.getChildren().size() - 2 >= 0) {
				final IFigure toRemoveFigure = (IFigure)figure.getChildren().get(
						figure.getChildren().size() - 2);
				if (toRemoveFigure instanceof PaddingFigure) {
					figure.remove(toRemoveFigure);
				}
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:31,代碼來源:ChoiceEditPart.java

示例3: createDiagram

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
private static void createDiagram(IFigure root, VarParser parser) {
		VariableInfo sum = parser.locateVariable("sum", 24);
		VariableInfo i = parser.locateVariable("i", 24);

		MockArray array = new MockArray("int", "a", 1,2,3,4);
		MockArrayIndex i1 = new MockArrayIndex(i.getName(), null, 1, IArrayIndexModel.Direction.FORWARD,-4);
//		MockArrayIndex v = new MockArrayIndex(v, null, 0, IArrayIndexModel.Direction.FORWARD, 3); ;
		array.addIndexVariable(i1);
		ArrayPrimitiveFigure fig = new ArrayPrimitiveFigure(array);
		fig.setSize(fig.getPreferredSize());
		fig.setLocation(new Point(100, 100));
		root.add(fig);
		
		
		Button but = new Button("test");
		but.setLocation(new Point(5, 5));
		but.setSize(but.getPreferredSize());
		but.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent event) {
				try {
					array.set(i1.getCurrentIndex(), 9);
					i1.set(i1.getCurrentIndex() + 1);
					i1.set(i1.getCurrentIndex() - 1);
					
				}
				catch(IndexOutOfBoundsException e) {
					e.printStackTrace();
				}
			}
		});
		root.add(but);
	}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:34,代碼來源:TestFigureParser.java

示例4: createFigure

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
/**
 * Returns the CustomFeedbackFigure.
 *  
 * @return the CustomFeedbackFigure
 */
protected IFigure createFigure(GraphicalEditPart part, IFigure parent) {
	IFigure child = getCustomFeedbackFigure(part.getModel());
		
	if (parent != null)
		parent.add(child);

	Rectangle childBounds = part.getFigure().getBounds().getCopy();
	
	IFigure walker = part.getFigure().getParent();
	
	while (walker != ((GraphicalEditPart)part.getParent()).getFigure()) {
		walker.translateToParent(childBounds);
		walker = walker.getParent();
	}
	
	child.setBounds(childBounds);
	
	Iterator i = part.getChildren().iterator();
	
	while (i.hasNext())
		createFigure((GraphicalEditPart)i.next(), child);
	
	return child;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:30,代碼來源:CommentBoxResizableEditPolicy.java

示例5: createDiagram

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
private static void createDiagram(IFigure root) {
	// Array com iteradores
	MockArray array = new MockArray("Integer", 1,2,3,4,5);
	//		MockVariable var = new MockVariable("int[]", "v", null, array);
	MockReference ref = new MockReference("int[]", "v", array, false);
	
	MockValue i1 = new MockValue("int", "i1", null, 0, false);
	MockArrayIndex ii1 = new MockArrayIndex(i1, ref, Direction.NONE);
	MockValue i2 = new MockValue("int", "i2", null, 1, false);
	MockArrayIndex ii2 = new MockArrayIndex(i2, ref, Direction.FORWARD);
	MockValue i3 = new MockValue("int", "i3", null, 5, false);
	MockArrayIndex ii3 = new MockArrayIndex(i3, ref, Direction.FORWARD, new MyBound(-1, BoundType.OPEN, "-1"));

	//		array.addIndexVariable(ii1);
	//		array.addIndexVariable(ii2);
	//		array.addIndexVariable(ii3);

	List<IArrayIndexModel> vars = new ArrayList<>();
	vars.add(ii1);
	vars.add(ii2);

	ArrayReferenceFigure fig = new ArrayReferenceFigure(array);
	fig.setLocation(new Point(100, 100));

	root.add(fig);



	//		IllustrationBorder b = new IllustrationBorder(vars, fig);
	//		MarginBorder b = new MarginBorder(15);
	//		fig.setBorder(b);



	// Array com lenght maior que o tamanho maximo da figura
	MockArray array2 = new MockArray("int", 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
	ArrayPrimitiveFigure fig2 = new ArrayPrimitiveFigure(array2);
	fig2.setLocation(new Point(250, 300));
	root.add(fig2);

	// Array vazia
	MockArray array3 = new MockArray("int");
	ArrayPrimitiveFigure fig3 = new ArrayPrimitiveFigure(array3);
	fig3.setLocation(new Point(400, 200));
	root.add(fig3);

	Connection c = new PolylineConnection();
	ChopboxAnchor a = new ChopboxAnchor(fig);
	ChopboxAnchor b = new ChopboxAnchor(fig2);
	c.setSourceAnchor(a);
	c.setTargetAnchor(b);

	root.add(c);

	Button but = new Button("test");
	but.setLocation(new Point(5, 5));
	but.setSize(but.getPreferredSize());
	but.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent event) {
			i1.set(ii1.getCurrentIndex()+1);
			try {
				if(ii3.getBound().getValue() != ii3.getCurrentIndex()) {
					i3.set(ii3.getCurrentIndex() - 1);
				}
				array.set(ii3.getCurrentIndex(), 9);
			}
			catch(IndexOutOfBoundsException e) {
				e.printStackTrace();
			}
			fig.repaint();
		}
	});
	root.add(but);
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:76,代碼來源:TestFigure.java


注:本文中的org.eclipse.draw2d.IFigure.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。