Java 类org.eclipse.draw2d.text.FlowPage 实例源码

项目:Hydrograph    文件:ComponentLabelFigure.java   
/**
 * Creates a new LabelFigure with a MarginBorder that is the given size and
 * a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public ComponentLabelFigure(int borderSize) {
    setBorder(new MarginBorder(borderSize));
    flowPage = new FlowPage();

    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
            ParagraphTextLayout.WORD_WRAP_SOFT));


    flowPage.add(textFlow);
    flowPage.setHorizontalAligment(PositionConstants.CENTER);

    setLayoutManager(new StackLayout());
    add(flowPage);
    font = new Font( Display.getDefault(), "Arial", 9,
            SWT.NORMAL );
    setFont(font);
    setForegroundColor(ColorConstants.black);

}
项目:Hydrograph    文件:CommentBoxFigure.java   
/**
 * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
 * with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public CommentBoxFigure(int borderSize) {
    setBorder(new MarginBorder(5));
    FlowPage flowPage = new FlowPage();

    textFlow = new TextFlow();

    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));

    flowPage.add(textFlow);

    setLayoutManager(new StackLayout());
    add(flowPage);
    font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
    setFont(font);
    setForegroundColor(ColorConstants.black);
    setOpaque(false);

}
项目:NEXCORE-UML-Modeler    文件:NoteFigure.java   
/**
 * createTextFlow
 * 
 * @return TextFlow
 */
public TextFlow createTextFlow() {
    flowPage = new FlowPage();

    flow = new TextFlow();

    flow.setLayoutManager(new ParagraphTextLayout(flow, ParagraphTextLayout.WORD_WRAP_SOFT));
    flow.setForegroundColor(new Color(null, 0, 0, 0));

    if (getName() != null)
        flow.setText(getName());
    else
        flow.setText(""); //$NON-NLS-1$

    flowPage.add(flow);
    flowPage.setHorizontalAligment(PositionConstants.LEFT);
    flowPage.setBorder(new MarginBorder(new Insets(15, 7, 7, 7)));
    setLayoutManager(new StackLayout());
    add(flowPage);

    return flow;
}
项目:bts    文件:TextAnnotationsComposite.java   
/**
 * @param fig
 * @param object
 */
private void addAllPropertiesToFigure(AnnotationFigure fig, BTSObject object) {
    // add name

    String label = null;
    if (object instanceof BTSCorpusObject)
    {
        label = passportConfigurationController.getAllPassportDataAsString((BTSCorpusObject) object);
    }
    else if (object instanceof BTSComment)
    {
        label = ((BTSComment)object).getComment();
    }
    if (label != null && !"".equals(label))
    {
        System.out.println(label);
        TextFlow content = new TextFlow(label +"----------------------------------------------------");
        FlowPage fp = new FlowPage();
        fp.add(content);
        fig.add(fp);
    }
}
项目:gef-gwt    文件:PaletteEditPart.java   
/**
 * Create the tool tip for this palette edit part.
 * 
 * @return the tool tip figure.
 */
protected IFigure createToolTip() {
    String message = getToolTipText();
    if (message == null || message.length() == 0)
        return null;

    FlowPage fp = new FlowPage() {
        public Dimension getPreferredSize(int w, int h) {
            Dimension d = super.getPreferredSize(-1, -1);
            if (d.width > 150)
                d = super.getPreferredSize(150, -1);
            return d;
        }
    };
    fp.setOpaque(true);
    fp.setBorder(TOOLTIP_BORDER);
    TextFlow tf = new TextFlow();
    tf.setText(message);
    fp.add(tf);
    return fp;
}
项目:gef-gwt    文件:DetailedLabelFigure.java   
/**
 * Constructor
 */
public DetailedLabelFigure() {
    image = new SelectableImageFigure();
    image.setAlignment(PositionConstants.NORTH);
    page = new FlowPage();
    page.setBorder(PAGE_BORDER);

    nameText = new TextFlow();
    nameText.setLayoutManager(new ParagraphTextLayout(nameText,
            ParagraphTextLayout.WORD_WRAP_TRUNCATE));

    descText = new TextFlow();
    descText.setLayoutManager(new ParagraphTextLayout(descText,
            ParagraphTextLayout.WORD_WRAP_TRUNCATE));

    page.add(nameText);
    add(image);
    add(page);
    BorderLayout layout = new BorderLayout();
    layout.setHorizontalSpacing(2);
    layout.setVerticalSpacing(0);
    setLayoutManager(layout);
}
项目:wt-studio    文件:TextAreaModelFigure.java   
public TextAreaModelFigure()
{

    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);
    this.setBorder(new LineBorder());
    this.setMinimumSize(new Dimension(RETURN_WIDTH * 2, RETURN_WIDTH * 2));
}
项目:wt-studio    文件:NoteModelFigure.java   
public void create() {
    this.setBackgroundColor(ColorConstants.yellow);
    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);
}
项目:seg.jUCMNav    文件:GrlNodeFigure.java   
/**
 * Constructor of the node figure. Set the layout manager and the line width
 */
public GrlNodeFigure() {
    super();
    autoResize = true;
    setAntialias(GeneralPreferencePage.getAntialiasingPref());

    xylayout = new XYLayout();
    this.setLayoutManager(xylayout);
    setLineWidth(3);

    initAnchor();

    flowPage = new FlowPage();
    // Center text in GRL nodes. Vertical centering not available...
    flowPage.setHorizontalAligment(PositionConstants.CENTER);

    textFlow = new TextFlow();
    // Slightly larger font here used for GRL node labels.
    textFlow.setFont(new Font(Display.getDefault(), new FontData("Tahoma", 9, SWT.NONE))); //$NON-NLS-1$
    textFlow.setVisible(!shouldHideInnerText());
    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_HARD));

    flowPage.add(textFlow);
    add(flowPage);
}
项目:ermasterr    文件:NoteFigure.java   
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);
}
项目:ermaster-k    文件:NoteFigure.java   
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);
}
项目:erflute    文件:WalkerNoteFigure.java   
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);
}
项目:ermaster-nhit    文件:NoteFigure.java   
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);
}
项目:gef-gwt    文件:MultiLineLabel.java   
/**
 * Constructs a new MultiLineLabel with the given parent.
 * 
 * @param parent
 *            the parent
 */
public MultiLineLabel(Composite parent) {
    super(parent);
    setViewport(new FocusableViewport());

    FlowPage page = new FlowPage();
    textFlow = new TextFlow();
    page.add(textFlow);

    setContents(page);
    getViewport().setContentsTracksWidth(true);
    addAccessibility();
}
项目:seg.jUCMNav    文件:KPIViewObjectFigure.java   
private void setSubjectFlowPageConstraint(FlowPage flowPage, int y) {
    flowPage.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
    Dimension dimEditableLabel = flowPage.getPreferredSize().getCopy();

    // Calculate the size of the label and of the figure
    // Max size available for the label
    int width = getDefaultDimension().width - 2 * LABEL_PADDING_X - 50;
    int height = dimEditableLabel.height;

    int minWidth = flowPage.getPreferredSize(width, 1).width;

    // Loop until we have good dimension for the labels to fit in the node
    while (dimEditableLabel.width > (width * Math.floor((height - 1) / dimEditableLabel.height)) || width < minWidth) {
        height = height + dimEditableLabel.height;
        width = width + 20;

    }
    if (height < (getDefaultDimension().height - 2 * LABEL_PADDING_Y)) {
        height = getDefaultDimension().height - 2 * LABEL_PADDING_Y;
    }

    Rectangle r = new Rectangle();
    r.x = LABEL_PADDING_X;
    r.y = y;
    r.width = width;
    r.height = height;

    setConstraint(flowPage, r);
    flowPage.setLocation(new Point(r.x, r.y));
}
项目:seg.jUCMNav    文件:KPIViewObjectFigure.java   
private void setKPITextFlowPageConstraint(FlowPage flowPage, int x, int y) {
    flowPage.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
    Dimension dimEditableLabel = flowPage.getPreferredSize().getCopy();

    // Calculate the size of the label and of the figure
    // Max size available for the label
    int width = getDefaultTextDimension().width;
    int height = dimEditableLabel.height;

    int minWidth = flowPage.getPreferredSize(width, 1).width;

    // Loop until we have good dimension for the labels to fit in the node
    while (dimEditableLabel.width > (width * Math.floor((height - 1) / dimEditableLabel.height)) || width < minWidth) {
        height = height + dimEditableLabel.height;
        width = width + 20;

    }
    if (height < (getDefaultTextDimension().height)) {
        height = getDefaultTextDimension().height;
    }

    Rectangle r = new Rectangle();
    r.x = x;
    r.y = y;
    r.width = width;
    r.height = height;

    setConstraint(flowPage, r);
    flowPage.setLocation(new Point(r.x, r.y));
}
项目:birt    文件:LabelFigure.java   
/**
 * 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 );
}
项目:seg.jUCMNav    文件:StartPointFigure.java   
/**
 * An ellipse that fills 2/3 of the area.
 * 
 * @see seg.jUCMNav.figures.PathNodeFigure#createFigure()
 */
protected void createFigure() {

    int width = preferredSize.width;
    int height = preferredSize.height;

    ellipse = new Ellipse();
    ellipse.setBounds(new Rectangle(13, 13, 16, 16));
    ellipse.setBackgroundColor(ColorManager.LINE);
    ellipse.setAntialias(GeneralPreferencePage.getAntialiasingPref());


    add(ellipse);

    // create the text inside the main figure
    flowPage = new FlowPage();
    stubTypeText = new TextFlow();
    stubTypeText.setLayoutManager(new SimpleTextLayout(stubTypeText));
    // TODO CONCERNS: should use default font?
    stubTypeText.setFont(new Font(null, "Verdana", 12, SWT.BOLD)); //$NON-NLS-1$
    stubTypeText.setText("F"); //$NON-NLS-1$
    stubTypeText.setForegroundColor(ColorManager.WHITE);
    flowPage.add(stubTypeText);
    // TODO CONCERNS: depends on font size!
    flowPage.setBounds(new Rectangle(16, 12, 20, 20));
    flowPage.setVisible(false);

    add(flowPage);

    // The lightning for an abort failure point
    PointList pts = new PointList();
    pts.addPoint(23, 27);
    pts.addPoint(27, 33);
    pts.addPoint(20, 32);
    pts.addPoint(28, 42);
    pts.addPoint(28, 37);
    pts.addPoint(28, 42);
    pts.addPoint(23, 41);

    lightning = new Polyline();
    lightning.setLineWidth(2);
    lightning.setAntialias(GeneralPreferencePage.getAntialiasingPref());
    lightning.setPoints(pts);
    lightning.setVisible(false);

    add(lightning);

    bar = new Polyline();
    bar.addPoint(new Point(15, 15));
    bar.addPoint(new Point(27, 27));
    bar.setLineWidth(3);
    bar.setVisible(false);
    bar.setForegroundColor(ColorManager.WHITE);

    add(bar);
}
项目:seg.jUCMNav    文件:KPIViewObjectFigure.java   
private void initializeFigure() {
    xylayout = new XYLayout();
    this.setLayoutManager(xylayout);

    this.setBackgroundColor(ColorManager.WHITE);
    this.setSize(getDefaultDimension());
    this.setOpaque(true);
    this.setForegroundColor(ColorManager.BLACK);

    GroupBoxBorder border = new GroupBoxBorder();
    border.setLabel(kpiViewObject.getName() + " (" + kpiViewObject.getId() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
    border.setTextColor(ColorManager.BLUE);
    this.setBorder(border);

    groupsFlowPage = new FlowPage();
    intElemsFlowPage = new FlowPage();
    kpiInformationFlowPage = new FlowPage();
    descFlowPage = new FlowPage();
    unitFlowPage = new FlowPage();
    targetValueFlowPage = new FlowPage();
    thresholdValueFlowPage = new FlowPage();
    worstValueFlowPage = new FlowPage();
    evalValueFlowPage = new FlowPage();

    groupsTextFlow = new TextFlow();
    intElemsTextFlow = new TextFlow();
    kpiInformationTextFlow = new TextFlow();
    descTextFlow = new TextFlow();
    unitTextFlow = new TextFlow();
    targetValueTextFlow = new TextFlow();
    thresholdValueTextFlow = new TextFlow();
    worstValueTextFlow = new TextFlow();
    evalValueTextFlow = new TextFlow();

    groupsTextFlow.setLayoutManager(new ParagraphTextLayout(groupsTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    intElemsTextFlow.setLayoutManager(new ParagraphTextLayout(intElemsTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    kpiInformationTextFlow.setLayoutManager(new ParagraphTextLayout(kpiInformationTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    descTextFlow.setLayoutManager(new ParagraphTextLayout(descTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    unitTextFlow.setLayoutManager(new ParagraphTextLayout(unitTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    targetValueTextFlow.setLayoutManager(new ParagraphTextLayout(targetValueTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    thresholdValueTextFlow.setLayoutManager(new ParagraphTextLayout(thresholdValueTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    worstValueTextFlow.setLayoutManager(new ParagraphTextLayout(worstValueTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    evalValueTextFlow.setLayoutManager(new ParagraphTextLayout(evalValueTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));

    groupsFlowPage.add(groupsTextFlow);
    intElemsFlowPage.add(intElemsTextFlow);
    kpiInformationFlowPage.add(kpiInformationTextFlow);
    descFlowPage.add(descTextFlow);
    unitFlowPage.add(unitTextFlow);
    targetValueFlowPage.add(targetValueTextFlow);
    thresholdValueFlowPage.add(thresholdValueTextFlow);
    worstValueFlowPage.add(worstValueTextFlow);
    evalValueFlowPage.add(evalValueTextFlow);

    add(groupsFlowPage);
    add(intElemsFlowPage);
    add(kpiInformationFlowPage);
    add(descFlowPage);
    add(unitFlowPage);
    add(targetValueFlowPage);
    add(thresholdValueFlowPage);
    add(worstValueFlowPage);
    add(evalValueFlowPage);
}