org.eclipse.draw2d.text.FlowPage Java Examples
The following examples show how to use
org.eclipse.draw2d.text.FlowPage.
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: NoteFigure.java From ermasterr with Apache License 2.0 | 5 votes |
public void create() { setBorder(new MarginBorder(RETURN_WIDTH)); setLayoutManager(new BorderLayout()); final FlowPage page = new FlowPage(); label = new TextFlow(); final ParagraphTextLayout layout = new ParagraphTextLayout(label, ParagraphTextLayout.WORD_WRAP_SOFT); label.setLayoutManager(layout); label.setOpaque(false); page.add(label); this.add(page, BorderLayout.CENTER); }
Example #2
Source File: WalkerNoteFigure.java From erflute with Apache License 2.0 | 5 votes |
public void create() { setBorder(new MarginBorder(RETURN_WIDTH)); setLayoutManager(new BorderLayout()); final FlowPage page = new FlowPage(); label = new TextFlow(); final ParagraphTextLayout layout = new ParagraphTextLayout(label, ParagraphTextLayout.WORD_WRAP_SOFT); label.setLayoutManager(layout); label.setOpaque(false); page.add(label); add(page, BorderLayout.CENTER); }
Example #3
Source File: NoteFigure.java From ermaster-b with Apache License 2.0 | 5 votes |
public void create() { this.setBorder(new MarginBorder(RETURN_WIDTH)); this.setLayoutManager(new BorderLayout()); FlowPage page = new FlowPage(); label = new TextFlow(); ParagraphTextLayout layout = new ParagraphTextLayout(label, ParagraphTextLayout.WORD_WRAP_SOFT); label.setLayoutManager(layout); label.setOpaque(false); page.add(label); this.add(page, BorderLayout.CENTER); }
Example #4
Source File: LabelFigure.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Creates a new LabelFigure with a MarginBorder that is the given size and * a FlowPage containing a TextFlow with the style WORD_WRAP_HARD. * * @param borderSize * the size of the MarginBorder */ public LabelFigure( int borderSize ) { setBorder( new MarginBorder( borderSize ) ); label = new TextFlow( ) { public void postValidate( ) { if ( DesignChoiceConstants.DISPLAY_BLOCK.equals( display ) || DesignChoiceConstants.DISPLAY_INLINE.equals( display ) ) { List list = getFragments( ); FlowBox box; int left = Integer.MAX_VALUE, top = left; int bottom = Integer.MIN_VALUE; for ( int i = 0; i < list.size( ); i++ ) { box = (FlowBox) list.get( i ); left = Math.min( left, box.getX( ) ); top = Math.min( top, box.getBaseline( ) - box.getAscent( ) ); bottom = Math.max( bottom, box.getBaseline( ) + box.getDescent( ) ); } int width = LabelFigure.this.getClientArea( ).width; if (isFixLayout) { int maxWidth = calcMaxSegment( )-getInsets( ).getWidth( ); width = Math.max( width, maxWidth); } setBounds( new Rectangle( left, top, width, Math.max( LabelFigure.this.getClientArea( ).height, bottom - top ) ) ); if (isFixLayout( )) { Figure child = (Figure)getParent( ); Rectangle rect = child.getBounds( ); child.setBounds( new Rectangle(rect.x, rect.y, width, rect.height) ); } list = getChildren( ); for ( int i = 0; i < list.size( ); i++ ) { ( (FlowFigure) list.get( i ) ).postValidate( ); } } else { super.postValidate( ); } } }; label.setLayoutManager( new ParagraphTextLayout( label, ParagraphTextLayout.WORD_WRAP_SOFT ) ); flowPage = new FlowPage( ); flowPage.add( label ); setLayoutManager( new StackLayout( ) ); add( flowPage ); }