org.eclipse.gef.LayerConstants Java Examples

The following examples show how to use org.eclipse.gef.LayerConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void activate( )
{
	if ( handles == null )
	{
		handles = getHandleList( );
	}
	// IFigure layer = getLayer( CrosstabTableEditPart.CELL_HANDLE_LAYER );
	IFigure layer = getLayer( LayerConstants.HANDLE_LAYER );
	int size = handles.size( );
	for ( int i = 0; i < size; i++ )
	{
		Figure handle = (Figure) handles.get( i );
		layer.add( handle );
	}
	super.activate( );
}
 
Example #2
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calculates height of row
 * 
 * @param part
 * @param row
 * @return
 */
public static int caleVisualHeight( TableEditPart part, Object row )
{

	RowHandleAdapter adapt = HandleAdapterFactory.getInstance( )
			.getRowHandleAdapter( row );

	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return adapt.getHeight( );
	}
	int rowNumber = adapt.getRowNumber( );
	if ( rowNumber <= data.rowHeights.length )
	{
		return data.findRowData( rowNumber ).height;
	}
	return 0;
}
 
Example #3
Source File: CrosstabTableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calculates the width of column
 * 
 * @param part
 * @param Column
 * @return
 */
public static int caleVisualWidth( AbstractTableEditPart part,
		int columnNumber )
{
	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}

	if ( columnNumber <= data.columnWidths.length )
	{
		return data.findColumnData( columnNumber ).width;
	}
	return 0;
}
 
Example #4
Source File: CrosstabTableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calculates height of row
 * 
 * @param part
 * @param row
 * @return
 */
public static int caleVisualHeight( AbstractTableEditPart part,
		int rowNumber )
{

	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}

	if ( rowNumber <= data.rowHeights.length )
	{
		return data.findRowData( rowNumber ).height;
	}
	return 0;
}
 
Example #5
Source File: SaveImageAction.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void run() {
	if (file == null)
		return;
	log.trace("export product graph as image: {}", file);
	ScalableRootEditPart editPart = (ScalableRootEditPart) editor.getGraphicalViewer().getRootEditPart();
	IFigure rootFigure = editPart.getLayer(LayerConstants.PRINTABLE_LAYERS);
	Rectangle bounds = rootFigure.getBounds();
	Image img = new Image(null, bounds.width, bounds.height);
	GC imageGC = new GC(img);
	Graphics graphics = new SWTGraphics(imageGC);
	rootFigure.paint(graphics);
	ImageLoader imgLoader = new ImageLoader();
	imgLoader.data = new ImageData[] { img.getImageData() };
	imgLoader.save(file.getAbsolutePath(), SWT.IMAGE_PNG);
}
 
Example #6
Source File: CrosstabCellEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void activate( )
{
	if ( handles == null )
	{
		handles = getHandleList( );
	}
	// IFigure layer = getLayer( CrosstabTableEditPart.CELL_HANDLE_LAYER );
	IFigure layer = getLayer( LayerConstants.HANDLE_LAYER );
	int size = handles.size( );
	for ( int i = 0; i < size; i++ )
	{
		Figure handle = (Figure) handles.get( i );
		layer.add( handle );
	}
	super.activate( );
}
 
Example #7
Source File: TableViewGraphicalNodeEditPolicy.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void eraseTargetFeedback(Request request) {
    final LayerManager manager = (LayerManager) getHost().getRoot();
    final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
    getFeedbackLayer().setBounds(layer.getBounds());

    final List<?> list = getFeedbackLayer().getChildren();

    for (final Iterator<?> iter = list.iterator(); iter.hasNext();) {
        final Object obj = iter.next();
        if (obj instanceof Label) {
            iter.remove();
        }
    }
    getFeedbackLayer().repaint();

    super.eraseTargetFeedback(request);
}
 
Example #8
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void showThumbnail() {
	if (quickMode) {
		return;
	}
	// RootEditPart�̃r���[���\�[�X�Ƃ��ăT���l�C�����쐬
	ScalableFreeformRootEditPart editPart = (ScalableFreeformRootEditPart) this.graphicalViewer
			.getRootEditPart();

	if (this.thumbnail != null) {
		this.thumbnail.deactivate();
	}

	this.thumbnail = new ScrollableThumbnail((Viewport) editPart
			.getFigure());
	this.thumbnail.setSource(editPart
			.getLayer(LayerConstants.PRINTABLE_LAYERS));

	this.lws.setContents(this.thumbnail);

}
 
Example #9
Source File: TableViewGraphicalNodeEditPolicy.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
@Override
public void eraseTargetFeedback(final Request request) {
    final LayerManager manager = (LayerManager) getHost().getRoot();
    final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
    getFeedbackLayer().setBounds(layer.getBounds());

    final List list = getFeedbackLayer().getChildren();

    for (final Iterator iter = list.iterator(); iter.hasNext();) {
        final Object obj = iter.next();
        if (obj instanceof Label) {
            iter.remove();
        }
    }
    getFeedbackLayer().repaint();

    super.eraseTargetFeedback(request);
}
 
Example #10
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static int caleVisualWidth( TableEditPart part, int columnIndex,
		Object column )
{
	ColumnHandleAdapter adapt = HandleAdapterFactory.getInstance( )
			.getColumnHandleAdapter( column );

	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return adapt.getWidth( );
	}

	int columnNumber = ( columnIndex <= 0 ) ? adapt.getColumnNumber( )
			: columnIndex;

	if ( columnNumber <= data.columnWidths.length )
	{
		return data.findColumnData( columnNumber ).width;
	}
	return 0;
}
 
Example #11
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Get minimum height of row.
 * 
 * @param part
 * @param rowNumber
 * @return
 */
public static int getMinHeight( AbstractTableEditPart part, int rowNumber )
{

	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}
	if ( rowNumber <= data.rowHeights.length )
	{
		return data.findRowData( rowNumber ).minRowHeight;
	}
	return 0;
}
 
Example #12
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Get minimum width of column.
 * 
 * @param part
 * @param columnNumber
 * @return
 */
public static int getMinWidth( AbstractTableEditPart part, int columnNumber )
{

	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}
	if ( columnNumber <= data.columnWidths.length )
	{
		return data.findColumnData( columnNumber ).minColumnWidth;
	}
	return 0;
}
 
Example #13
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets the table contents height
 * 
 * @param part
 * @return
 */
public static int getTableContentsHeight( TableEditPart part )
{
	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}
	int height = 0;
	if ( data.rowHeights == null )
	{
		return height;
	}
	int len = data.rowHeights.length;
	for ( int i = 0; i < len; i++ )
	{
		height = height + data.rowHeights[i].height;
	}

	return height;
}
 
Example #14
Source File: TableUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets the table contents width
 * 
 * @param part
 * @return
 */
public static int getTableContentsWidth( TableEditPart part )
{
	IFigure figure = part.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );
	if ( data == null )
	{
		return 0;
	}
	int width = 0;
	if ( data.columnWidths == null )
	{
		return width;
	}
	int len = data.columnWidths.length;
	for ( int i = 0; i < len; i++ )
	{
		width = width + data.columnWidths[i].width;
	}

	return width;
}
 
Example #15
Source File: NonInterruptingBoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #16
Source File: TableViewGraphicalNodeEditPolicy.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
@Override
public void eraseTargetFeedback(Request request) {
	LayerManager manager = (LayerManager) this.getHost().getRoot();
	IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
	this.getFeedbackLayer().setBounds(layer.getBounds());

	List list = this.getFeedbackLayer().getChildren();

	for (Iterator iter = list.iterator(); iter.hasNext();) {
		Object obj = iter.next();
		if (obj instanceof Label) {
			iter.remove();
		}
	}
	this.getFeedbackLayer().repaint();

	super.eraseTargetFeedback(request);
}
 
Example #17
Source File: BoundaryMessageEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #18
Source File: BoundaryMessageEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #19
Source File: TableResizeEditPolice.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void removeSelectionHandles( )
{
	if ( handles == null )
		return;
	IFigure layer = getLayer( LayerConstants.HANDLE_LAYER );
	for ( int i = 0; i < handles.size( ); i++ )
	{
		Object figure = handles.get( i );
		if ( figure instanceof IFigure )
		{
			layer.remove( (IFigure) figure );
		}

	}
	handles = null;
}
 
Example #20
Source File: IntermediateErrorCatchEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #21
Source File: TableCellResizeEditPolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void removeSelectionHandles( )
{
	if ( handles == null )
		return;
	IFigure layer = getLayer( LayerConstants.HANDLE_LAYER );
	IFigure topLayer = getTopLayer( LayerConstants.HANDLE_LAYER );
	for ( int i = 0; i < handles.size( ); i++ )
	{
		Object figure = handles.get( i );
		if ( figure instanceof TableHFHandle )
		{
			topLayer.remove( (IFigure) figure );
		}
		else if ( figure instanceof TableSelectionHandle )
		{
			layer.remove( (IFigure) figure );
		}
		else if ( figure instanceof IFigure )
		{
			layer.remove( (IFigure) figure );
		}

	}

	handles = null;
}
 
Example #22
Source File: BoundaryTimerEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #23
Source File: BoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #24
Source File: IntermediateErrorCatchEvent3EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #25
Source File: IntermediateErrorCatchEvent4EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #26
Source File: IntermediateErrorCatchEvent5EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #27
Source File: TableBorderLayer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private int caleVisualWidth( int columnIndex )
{
	IFigure figure = source.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );

	if ( data == null )
	{
		return 0;
	}

	if ( columnIndex <= data.columnWidths.length )
	{
		return data.findColumnData( columnIndex ).width;
	}

	return 0;
}
 
Example #28
Source File: TableBorderLayer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private int caleVisualHeight( int rowIndex )
{
	IFigure figure = source.getLayer( LayerConstants.PRIMARY_LAYER );
	TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager( )
			.getConstraint( figure );

	if ( data == null )
	{
		return 0;
	}

	if ( rowIndex <= data.rowHeights.length )
	{
		return data.findRowData( rowIndex ).height;
	}
	return 0;
}
 
Example #29
Source File: BoundarySignalEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example #30
Source File: IntermediateErrorCatchEvent6EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}