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


Java Dimension類代碼示例

本文整理匯總了Java中org.eclipse.draw2d.geometry.Dimension的典型用法代碼示例。如果您正苦於以下問題:Java Dimension類的具體用法?Java Dimension怎麽用?Java Dimension使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: handleResize

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
protected void handleResize ( final Rectangle bounds )
{
    if ( !isZooming () )
    {
        final org.eclipse.draw2d.geometry.Rectangle r = new org.eclipse.draw2d.geometry.Rectangle ( bounds.x, bounds.y, bounds.width, bounds.height );
        this.connectionLayer.setPreferredSize ( r.getSize () );

        setZoom ( 1.0 );
        return;
    }

    final Dimension prefSize = getPreferredSize ( bounds );

    final double ar = prefSize.preciseWidth () / prefSize.preciseHeight ();

    double newHeight = bounds.width / ar;
    final double zoom;

    if ( newHeight > bounds.height )
    {
        newHeight = bounds.height;
    }

    zoom = newHeight / prefSize.preciseHeight ();
    setZoom ( zoom );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:VisualInterfaceViewer.java

示例2: update

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
public void update(Object array) {
		this.array = array;
		valid = model.isMatrix();
		if(valid) {
			Dimension dim = model.getMatrixDimension();
			width = dim.width;
			height = dim.height;
//			width = Array.getLength(Array.get(array, 0));
//			height = Array.getLength(array);
		}
		else {
			width = 200;
			height = 50;
		}
		setSize(width+2, height+2);
		repaint();
	}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:18,代碼來源:ImageFigure.java

示例3: prepareUIXML

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
public void prepareUIXML() {
	join = (Join) typeBaseComponent;
	super.prepareUIXML();
	LOGGER.debug("Fetching Join-Properties for -{}", componentName);

	if(inPortCounter<=2){
		inPortCounter = 2;
	}
	
	propertyMap.put(Constants.UNUSED_AND_INPUT_PORT_COUNT_PROPERTY, String.valueOf(inPortCounter));
	propertyMap.put(Constants.INPUT_PORT_COUNT_PROPERTY, String.valueOf(inPortCounter));
	propertyMap.put(Constants.UNUSED_PORT_COUNT_PROPERTY, String.valueOf(inPortCounter));
	propertyMap.put(Constants.OUTPUT_PORT_COUNT_PROPERTY, String.valueOf(1));
	propertyMap.put(Constants.JOIN_CONFIG_FIELD, getJoinConfigProperty());
	container.getComponentNextNameSuffixes().put(name_suffix, 0);
	container.getComponentNames().add(componentName);

	uiComponent.setProperties(propertyMap);
	uiComponent.setType(UIComponentsConstants.JOIN.value());
	uiComponent.setSize(new Dimension(((inPortCounter+1)*33), ((inPortCounter+1)*27) + 16));
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:23,代碼來源:JoinComponentUiConverter.java

示例4: prepareUIXML

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
public void prepareUIXML() {

	super.prepareUIXML();
	partitionByExpression = (PartitionByExpression) typeBaseComponent;
	if (outPortCounter == 0) {
		outPortCounter = 2;
	}
	propertyMap.put(Constants.OUTPUT_PORT_COUNT_PROPERTY, String.valueOf(outPortCounter));
	propertyMap.put(PropertyNameConstants.FILTER_LOGIC.value(), getOperationClassOrExpression());
	container.getComponentNextNameSuffixes().put(name_suffix, 0);
	container.getComponentNames().add(componentName);
	uiComponent.setProperties(propertyMap);
	uiComponent.setType(UIComponentsConstants.PARTITION_BY_EXPRESSION.value());
	uiComponent.setSize(new Dimension(100, ((outPortCounter + 1) * 27) + 16));

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:18,代碼來源:PartitionByExpressionUiConverter.java

示例5: updateSubJobModelProperties

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
/**
 * Update sub graph model properties.
 * 
 * @param edComponentEditPart
 *            the ed component edit part
 * @param inPort
 *            the in port
 * @param outPort
 *            the out port
 * @param file
 *            the file
 */
public void updateSubJobModelProperties(ComponentEditPart edComponentEditPart, int inPort, int outPort, IFile file) {
	edComponentEditPart.getCastedModel().completeInputPortSettings(inPort);
	edComponentEditPart.getCastedModel().completeOutputPortSettings(outPort);
	ComponentFigure compFig = (ComponentFigure) edComponentEditPart.getFigure();
	compFig.setHeight(inPort, outPort);
	Dimension newSize = new Dimension(compFig.getWidth(), compFig.getHeight()
			+ edComponentEditPart.getCastedModel().getComponentLabelMargin());

	edComponentEditPart.getCastedModel().setSize(newSize);

	String subJobFilePath = file.getFullPath().toString();
	edComponentEditPart.getCastedModel().getProperties().put(Constants.PATH, subJobFilePath.substring(1));
	if (inPort != 0 && outPort != 0)
		edComponentEditPart.getCastedModel().getProperties().put(Constants.TYPE, Constants.OPERATION);
	if (inPort != 0 && outPort == 0)
		edComponentEditPart.getCastedModel().getProperties().put(Constants.TYPE, Constants.OUTPUT);
	if (inPort == 0 && outPort != 0)
		edComponentEditPart.getCastedModel().getProperties().put(Constants.TYPE, Constants.INPUT);
	if (inPort == 0 && outPort == 0)
		edComponentEditPart.getCastedModel().getProperties().put(Constants.TYPE, Constants.STANDALONE_SUBJOB);
	edComponentEditPart.refresh();
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:35,代碼來源:SubJobUtility.java

示例6: createCommentBox

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
private Object createCommentBox(Event event) {
	CommentBox commentBox = null;
	editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();
	if (editor != null) {
		Container container = editor.getContainer();
		checkComponentCoordinates(event, container);
		org.eclipse.draw2d.geometry.Point point = new org.eclipse.draw2d.geometry.Point(event.x, event.y);
		commentBox = new CommentBox(LABEL);
		commentBox.setSize(new Dimension(300, 60));
		commentBox.setLocation(point);
		CommentBoxCommand command = new CommentBoxCommand(commentBox, LABEL, container);
		command.execute();
	}
	return commentBox;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:ComponentSearchUtility.java

示例7: paintFigure

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected void paintFigure(Graphics g) {
	super.paintFigure(g);
	
	Rectangle r = getBounds();
	Rectangle square = new Rectangle(r.getLocation().getTranslated(0, r.height/4), new Dimension(r.width/2, r.height/2));
	center = new Point(square.x + square.width/2, square.y + square.height/2);

	g.setBackgroundColor(dirty ? PandionJConstants.Colors.HIGHLIGHT : PandionJConstants.Colors.VARIABLE_BOX);
	g.fillRectangle(square);

	g.setForegroundColor(ref.getRole() == Role.FIXED_VALUE ? PandionJConstants.Colors.CONSTANT : ColorConstants.black);
	g.drawRectangle(square);

	g.setBackgroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
	g.fillOval(center.x-3, center.y-3, 7, 7);

	if(isnull) {
		g.setForegroundColor(error ? PandionJConstants.Colors.ERROR : ColorConstants.black);
		Point dest = center.getTranslated(20, 0);
		g.drawLine(center, dest);
		g.drawLine(dest.getTranslated(-3, 5), dest.getTranslated(3, -5));
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:25,代碼來源:ReferenceLabel.java

示例8: updateLayout

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
public void updateLayout() {
	if(!canvas.isDisposed()) {
		Dimension size = rootFig.getPreferredSize();
		canvas.setSize(size.width, size.height);
		org.eclipse.draw2d.GridData d = (org.eclipse.draw2d.GridData) rootGrid.getConstraint(stackFig);
		d.widthHint = Math.max(PandionJConstants.STACKCOLUMN_MIN_WIDTH, stackFig.getPreferredSize().width);
		rootGrid.layout(rootFig);
		requestLayout();
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:11,代碼來源:RuntimeViewer.java

示例9: getPreferredSize

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
private Dimension getPreferredSize ( final Rectangle bounds )
{
    if ( this.symbol != null && this.symbol.getDesignSize () != null )
    {
        return new PrecisionDimension ( this.symbol.getDesignSize ().getWidth (), this.symbol.getDesignSize ().getHeight () );
    }
    else if ( this.figure != null )
    {
        return this.figure.getPreferredSize ( bounds.width, bounds.height );
    }
    else
    {
        return new PrecisionDimension ( bounds.width, bounds.height );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:16,代碼來源:VisualInterfaceViewer.java

示例10: createFigure

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected IFigure createFigure() {
	ComponentImplementationNode model = (ComponentImplementationNode) getModel();
	ComponentImplementationFigure figure = new ComponentImplementationFigure();
	figure.setNode(model);
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
	return figure;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:12,代碼來源:ComponentImplementationEditPart.java

示例11: refreshVisuals

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected void refreshVisuals() {
	ComponentImplementationNode model = (ComponentImplementationNode) getModel();
	ComponentImplementationFigure figure = (ComponentImplementationFigure) getFigure();
	figure.setNode(model);
	figure.setBounds(model.getConstraints());
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:12,代碼來源:ComponentImplementationEditPart.java

示例12: createFigure

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected IFigure createFigure() {
	DeploymentNode model = (DeploymentNode) getModel();
	DeploymentFigure figure = new DeploymentFigure();
	figure.setNode(model);
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
	return figure;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:12,代碼來源:DeploymentEditPart.java

示例13: refreshVisuals

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected void refreshVisuals() {
	DeploymentNode model = (DeploymentNode) getModel();
	DeploymentFigure figure = (DeploymentFigure) getFigure();
	figure.setNode(model);
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:11,代碼來源:DeploymentEditPart.java

示例14: createFigure

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected IFigure createFigure() {
	LogicalSystemNode model = (LogicalSystemNode) getModel();
	LogicalSystemFigure figure = new LogicalSystemFigure();
	figure.setNode(model);
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
	return figure;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:12,代碼來源:LogicalSystemEditPart.java

示例15: refreshVisuals

import org.eclipse.draw2d.geometry.Dimension; //導入依賴的package包/類
@Override
protected void refreshVisuals() {
	LogicalSystemNode model = (LogicalSystemNode) getModel();
	LogicalSystemFigure figure = (LogicalSystemFigure) getFigure();
	figure.setNode(model);
	Dimension dim = getDimension(model);
	model.setConstraints(new Rectangle(new Point(0, 0), (dim != null) ? dim : new Dimension(1000, 1000)));
	figure.setBounds(model.getConstraints());
	figure.rebuildFigure();
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:11,代碼來源:LogicalSystemEditPart.java


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