当前位置: 首页>>代码示例>>Java>>正文


Java GraphicalEditPart类代码示例

本文整理汇总了Java中org.eclipse.gef.GraphicalEditPart的典型用法代码示例。如果您正苦于以下问题:Java GraphicalEditPart类的具体用法?Java GraphicalEditPart怎么用?Java GraphicalEditPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphicalEditPart类属于org.eclipse.gef包,在下文中一共展示了GraphicalEditPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSelectionHandles

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * Create selection handles in the style as predefined in DeltaEcore
 * @see DEGraphicalEditorTheme
 */
@Override
protected List<Object> createSelectionHandles() {
	List<Object> list = new ArrayList<Object>();

	MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
	moveHandle.setDragTracker(getDragTracker());		
	
	if (isDragAllowed()) {
		moveHandle.setCursor(Cursors.SIZEALL);
	} else {
		moveHandle.setCursor(SharedCursors.ARROW);
	}
	
	// set line style to meet the predefined theme
	DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme();
	LineBorder border = new LineBorder();
	border.setColor(theme.getSelectionSecondaryColor());
	border.setWidth(theme.getLineWidth());
	moveHandle.setBorder(border);
	
	list.add(moveHandle);
	
	return list;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:DwThemedNonResizableEditPolicy.java

示例2: getFigureConstraint

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
protected Rectangle getFigureConstraint(){
	GraphicalEditPart parent = (GraphicalEditPart)getParent();
	Rectangle parentVisibleBounds = parent.getFigure().getClientArea().getCopy();
	
	Rectangle bounds;
	if(parentVisibleBounds.width < 0 || parentVisibleBounds.height < 0) {
		bounds = new Rectangle(0, 0, 300, -1);
	}else{
		Date date = featureModel.getSelectedDate();
		
		DwEnumContainerWrapped model = (DwEnumContainerWrapped)getModel();
		DwTemporalPosition position = model.getPosition(date);
		
		
		Point desiredDefaultPosition = new Point(editor.getEditorGraphicalDimension().width-20-320, 20);
		if(position == null || !position.getPosition().equals(desiredDefaultPosition) && model.getAlignment() == EditorAlignment.RightTop){
			model.addPosition(desiredDefaultPosition, date, false);
		}
	
		bounds = new Rectangle(model.getPosition(date).getPosition(), new Dimension(300, -1));
	}	
	
	return bounds;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:25,代码来源:DwEnumContainerEditPart.java

示例3: createCommand

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
private Command createCommand(final List objects, final RGB rgb) {
    if (objects.isEmpty()) {
        return null;
    }

    if (!(objects.get(0) instanceof GraphicalEditPart)) {
        return null;
    }

    final CompoundCommand command = new CompoundCommand();

    for (int i = 0; i < objects.size(); i++) {
        final GraphicalEditPart part = (GraphicalEditPart) objects.get(i);
        final Object modelObject = part.getModel();

        if (modelObject instanceof ViewableModel) {
            command.add(new ChangeBackgroundColorCommand((ViewableModel) modelObject, rgb.red, rgb.green, rgb.blue));

        } else if (modelObject instanceof ConnectionElement) {
            command.add(new ChangeConnectionColorCommand((ConnectionElement) modelObject, rgb.red, rgb.green, rgb.blue));

        }
    }

    return command;
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:27,代码来源:ChangeBackgroundColorAction.java

示例4: addHandles

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void addHandles(final GraphicalEditPart part, final List handles) {
    handles.add(new ERDiagramMoveHandle(part));
    handles.add(createHandle(part, PositionConstants.EAST));
    handles.add(createHandle(part, PositionConstants.SOUTH_EAST));
    handles.add(createHandle(part, PositionConstants.SOUTH));
    handles.add(createHandle(part, PositionConstants.SOUTH_WEST));
    handles.add(createHandle(part, PositionConstants.WEST));
    handles.add(createHandle(part, PositionConstants.NORTH_WEST));
    handles.add(createHandle(part, PositionConstants.NORTH));
    handles.add(createHandle(part, PositionConstants.NORTH_EAST));
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:13,代码来源:NodeElementSelectionEditPolicy.java

示例5: calculateEnabled

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected boolean calculateEnabled() {
	List objects = this.getSelectedObjects();

	if (objects.isEmpty()) {
		return false;
	}

	if (!(objects.get(0) instanceof GraphicalEditPart)) {
		return false;
	}

	return true;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:18,代码来源:ChangeBackgroundColorAction.java

示例6: refreshChildren

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@Override
protected void refreshChildren() {
	super.refreshChildren();
	List<?> children = getChildren();
	for (int i = 0; i < children.size(); i++) {
		EditPart editPart = (EditPart) children.get(i);
		editPart.refresh();
	}
	if (getSelection() >= 0){
		GraphicalEditPart colEP = (GraphicalEditPart) children.get(0);
		Rectangle r1 = colEP.getFigure().getBounds();
		int rowHeinght = getOneRowHeight();
		getFigure().getSelection().setBounds(new Rectangle(
				r1.x, r1.y + getSelection()*rowHeinght,
				getExpandedBounds().width - r1.x*2, rowHeinght
		));
	} else {
		getFigure().getSelection().setBounds(new Rectangle());
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:21,代码来源:PickerEditPart.java

示例7: addChildVisual

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org.eclipse.gef.EditPart, int)
 */
@Override
protected void addChildVisual(EditPart childEditPart, int index) {

    super.addChildVisual(childEditPart, index);

     if (!isCreated()) {
        if (((AbstractNode) childEditPart.getModel()).getUmlModel().equals(getAdded())) {
            DirectEditorManager dem = new DirectEditorManager((GraphicalEditPart) childEditPart,
                TextCellEditor.class,
                new DirectEditCellEditorLocator(((GraphicalEditPart) childEditPart).getFigure()));
            dem.show();
            setCreated(true);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:EnumerationLiteralsEditPart.java

示例8: getChildFigure

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * 
 *   void
 */
private void getChildFigure(EditPart currentEditPart) {
    List<EditPart> childrenEditPart = currentEditPart.getChildren();
    for( EditPart child : childrenEditPart ) {
        if( child instanceof NotationNameEditPart ) {
            if( ((NotationNameEditPart)child).getFigure() instanceof org.eclipse.draw2d.Label ) {
                
                GraphicalEditPart gEdit = (GraphicalEditPart) child;
                
                setDirectManager(new DirectEditorManager((GraphicalEditPart) child,
                    TextCellEditor.class,
                    new DirectEditCellEditorLocator(gEdit.getFigure())));
                directManager.show();
                
                break;
            } else {
                getChildFigure(child);
            }
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:AbstractNotationNodeEditPart.java

示例9: handleKeyDown

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@Override
protected boolean handleKeyDown(KeyEvent e) {
	if (isInState(STATE_INITIAL) && UIUtil.isArrowKey(e.keyCode)) {
		EditPartViewer viewer = getCurrentViewer();
		if (viewer instanceof GraphicalViewer) {
			JSSCompoundCommand ccmd = new JSSCompoundCommand(null);
			for(Object selectedEditPart : getCurrentViewer().getSelectedEditParts()) {
				if (selectedEditPart instanceof GraphicalEditPart) {
					Object modelObj = ((EditPart) selectedEditPart).getModel();
					if(modelObj instanceof MGraphicElement) {
						MGraphicElement node = (MGraphicElement) modelObj;
						ccmd.add(getNewXYCommand(e.keyCode,node));
					}
				}
			}
			if(!ccmd.isEmpty()) {
				getDomain().getCommandStack().execute(ccmd);
				return true;
			}	
		}
	}
	return super.handleKeyDown(e);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:24,代码来源:MovableSelectionTool.java

示例10: refreshVisuals

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
 */
@Override
protected void refreshVisuals() {
    try {
        super.refreshVisuals();
        
        NotationNode notationNode = (NotationNode) getModel();
        Polyline line = (Polyline) this.getFigure();
        line.removeAllPoints();
        line.addPoint(new Point(notationNode.getX(), notationNode.getY()));
        line.addPoint(new Point(notationNode.getX(), notationNode.getY() + notationNode.getHeight()));

        Rectangle bounds = new Rectangle(notationNode.getX(),
            notationNode.getY(),
            notationNode.getWidth(),
            notationNode.getHeight());
        ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
    } catch (Exception e) {
        Log.error(UMLMessage.MESSAGE_INTERACTION_USE_EDIT_PART_REFRESH_VISUALS_ERROR + e);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:InteractionUseEditPart.java

示例11: refreshVisuals

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@Override
protected void refreshVisuals()
{
  GridData gridData = new GridData();
  gridData.grabExcessHorizontalSpace = true;
  gridData.grabExcessVerticalSpace = true;
  gridData.horizontalAlignment = SWT.FILL;
  gridData.verticalAlignment = SWT.FILL;

  GraphicalEditPart parent = (GraphicalEditPart) getParent();
  parent.setLayoutConstraint(this, figure, gridData);

  GridLayout layoutManager = (GridLayout) getFigure().getLayoutManager();
  layoutManager.numColumns =
      ((ChartSet) parent.getModel()).getOrientation() == Orientation.HORIZONTAL
          ? getModelChildren().size() : 1;
  layoutManager.invalidate();
}
 
开发者ID:debrief,项目名称:limpet,代码行数:19,代码来源:ChartsPanelEditPart.java

示例12: createSelectionHandles

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@Override
protected List<AbstractHandle> createSelectionHandles() {
	List<AbstractHandle> list = new ArrayList<AbstractHandle>();

	MoveHandle handle = new MoveHandle((GraphicalEditPart) getHost());
	handle.setBorder(new MarginBorder(5));
	list.add(handle);
	
	//	 BandButtonPadHandle buttonPadHandle=new BandButtonPadHandle((GraphicalEditPart)getHost());
	//	 buttonPadHandle.setBorder(null);
	//	 list.add(buttonPadHandle);
	// NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), list);
	// list.add(new CellResizeHandle2((GraphicalEditPart) getHost(), PositionConstants.SOUTH));
	// // if (hasNorth)
	// list.add(new CellResizeHandle2((GraphicalEditPart) getHost(), PositionConstants.NORTH));
	return list;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:BandResizableEditPolicy.java

示例13: generateSnapPartsList

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * The list of element is based on the father of first selected item
 */
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected List generateSnapPartsList(List exclusions) {
	// Don't snap to any figure that is being dragged
	List children = new ArrayList();
	if (exclusions.size()>0){
		EditPart selectedItem = (EditPart)exclusions.get(0);
		children.addAll(selectedItem.getParent().getChildren());
		children.removeAll(exclusions);
		// Don't snap to hidden figures
		List hiddenChildren = new ArrayList();
		for (Iterator iter = children.iterator(); iter.hasNext();) {
			GraphicalEditPart child = (GraphicalEditPart) iter.next();
			if (!child.getFigure().isVisible())
				hiddenChildren.add(child);
		}
		children.removeAll(hiddenChildren);
	}
	return children;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:24,代码来源:SnapToGeometryThreshold.java

示例14: showCreateBendpointFeedback

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest)
 */
@Override
protected void showCreateBendpointFeedback(BendpointRequest request) {

    IFigure feedback = getDragSourceFeedbackFigure();

    Rectangle bounds = new Rectangle(getInitialFeedbackBounds().getCopy());
    PrecisionRectangle rect = new PrecisionRectangle(bounds);
    getHostFigure().translateToAbsolute(rect);
    Point movePoint = request.getLocation();
    
    movePoint.x = ((GraphicalEditPart) getHost()).getFigure().getBounds().x;//movePoint.x - rect.getSize().width / 2;
    rect.setLocation(movePoint);
    feedback.translateToRelative(rect);
    feedback.setBounds(rect);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:MessageBendpointEditPolicy.java

示例15: refreshVisuals

import org.eclipse.gef.GraphicalEditPart; //导入依赖的package包/类
@Override
protected void refreshVisuals()
{
  boolean horizontal = ((AxisLandingPad) getModel()).chart.getParent()
      .getOrientation() == Orientation.HORIZONTAL;
  nameLabel.setVertical(!horizontal);

  if (horizontal)
  {
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure,
        new GridData(GridData.FILL, GridData.CENTER, true, false));
  }
  else
  {
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure,
        new GridData(GridData.CENTER, GridData.FILL, false, true));
  }
  figure.invalidate();
}
 
开发者ID:debrief,项目名称:limpet,代码行数:20,代码来源:AxisLandingPadEditPart.java


注:本文中的org.eclipse.gef.GraphicalEditPart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。