Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Word-wrap in Label -> TextFlow?
Word-wrap in Label -> TextFlow? [message #62234] Wed, 05 February 2003 19:59 Go to next message
Eclipse UserFriend
Originally posted by: dinkloh.DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de

Hello!

I have a Figure and would like to add some text in it, which should be
word-wrapped so that it fills the Rectangle from getBounds(). First I tried
to add a Label to my Figure, but the text is not wrapped. So I looked in the
Javadoc and found the class TextFlow, which fits my needs "An inline flow
that renders a sting of text across one or more lines.".

Now my problem: Simply instanciating and add()-ing it to my figure, gives me
a NullPointerException, so I guess the warning "It does not provide a
FlowContext" has probably something to do with it.

My code snippet and the full error message is below, does anybody know how
to do this?

Thank you very much in advance,
Martin

public MartinsFigure() {

TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");

this.add(tf);

}

java.lang.NullPointerException
at
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
56)
at
org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
at org.eclipse.draw2d.Figure.layout(Figure.java:862)
at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
at
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
at
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
at
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
dSize(FreeformViewport.java:20)
at
org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
at
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
va:76)
at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
at org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
at
org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
at org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
at
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
er.java:156)
at
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
..java:90)
at
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
105)
at
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
plateTransferDropTargetListener.java:95)
at
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
ansferDropTargetListener.java:84)
at
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
DropTargetListener.java:150)
at
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
28)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
:839)
at org.eclipse.core.runtime.Platform.run(Platform.java:416)
at
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
5)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
at org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
a:831)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
Re: Word-wrap in Label -> TextFlow? [message #62259 is a reply to message #62234] Wed, 05 February 2003 20:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

From TextFlow's superclass:

* ... An
* <code>InlineFlow</code>'s parent must be either a {@link BlockFlow} or
another
* InlineFlow.

FlowPage is the only figure that does not have the restriction, so place a
TextFlow inside a FlowPage.

"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> wrote
in message news:b1rp4a$ejh$1@rogue.oti.com...
> Hello!
>
> I have a Figure and would like to add some text in it, which should be
> word-wrapped so that it fills the Rectangle from getBounds(). First I
tried
> to add a Label to my Figure, but the text is not wrapped. So I looked in
the
> Javadoc and found the class TextFlow, which fits my needs "An inline flow
> that renders a sting of text across one or more lines.".
>
> Now my problem: Simply instanciating and add()-ing it to my figure, gives
me
> a NullPointerException, so I guess the warning "It does not provide a
> FlowContext" has probably something to do with it.
>
> My code snippet and the full error message is below, does anybody know how
> to do this?
>
> Thank you very much in advance,
> Martin
>
> public MartinsFigure() {
>
> TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
>
> this.add(tf);
>
> }
>
> java.lang.NullPointerException
> at
>
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
> 56)
> at
> org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
> at org.eclipse.draw2d.Figure.layout(Figure.java:862)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> at
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> at
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> at
>
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
> dSize(FreeformViewport.java:20)
> at
> org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
> at
>
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
> va:76)
> at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
> at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
> at org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
> at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
> at
> org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
> at org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
> at
>
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
> er.java:156)
> at
>
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
> .java:90)
> at
>
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
> 105)
> at
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
> plateTransferDropTargetListener.java:95)
> at
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
> ansferDropTargetListener.java:84)
> at
>
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
> DropTargetListener.java:150)
> at
>
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
> 28)
> at
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> :839)
> at org.eclipse.core.runtime.Platform.run(Platform.java:416)
> at
>
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
> 5)
> at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
> at org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
> at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
> at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
> at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
> at
> org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
> at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
> at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
> at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
> at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
> at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
> at
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> a:831)
> at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
> at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
>
>
Re: Word-wrap in Label -> TextFlow? [message #62380 is a reply to message #62259] Thu, 06 February 2003 10:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dinkloh.DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de

Thank you for the quick response, this worked out well. But although it is
is showing in one line "WRAPME ", now, it is still not word-wrapping the
text. My new code snippet is below. I checked the bounds Rectangle with the
debugger and it is (height = 36, width = 64) for all three IFigures
(MartinsFigure, tf, fp), so that the text should actually get wrapped.

public MartinsFigure() {}


Thank you, Martin

"Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
news:b1rsan$mfb$1@rogue.oti.com...
> From TextFlow's superclass:
>
> * ... An
> * <code>InlineFlow</code>'s parent must be either a {@link BlockFlow} or
> another
> * InlineFlow.
>
> FlowPage is the only figure that does not have the restriction, so place a
> TextFlow inside a FlowPage.
>
> "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> wrote
> in message news:b1rp4a$ejh$1@rogue.oti.com...
> > Hello!
> >
> > I have a Figure and would like to add some text in it, which should be
> > word-wrapped so that it fills the Rectangle from getBounds(). First I
> tried
> > to add a Label to my Figure, but the text is not wrapped. So I looked in
> the
> > Javadoc and found the class TextFlow, which fits my needs "An inline
flow
> > that renders a sting of text across one or more lines.".
> >
> > Now my problem: Simply instanciating and add()-ing it to my figure,
gives
> me
> > a NullPointerException, so I guess the warning "It does not provide a
> > FlowContext" has probably something to do with it.
> >
> > My code snippet and the full error message is below, does anybody know
how
> > to do this?
> >
> > Thank you very much in advance,
> > Martin
> >
> > public MartinsFigure() {
> >
> > TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
> >
> > this.add(tf);
> >
> > }
> >
> > java.lang.NullPointerException
> > at
> >
>
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
> > 56)
> > at
> >
org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
> > at org.eclipse.draw2d.Figure.layout(Figure.java:862)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > at
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > at
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > at
> >
>
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
> > dSize(FreeformViewport.java:20)
> > at
> >
org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
> > at
> >
>
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
> > va:76)
> > at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
> > at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
> > at
org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
> > at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
> > at
> >
org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
> > at
org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
> > at
> >
>
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
> > er.java:156)
> > at
> >
>
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
> > .java:90)
> > at
> >
>
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
> > 105)
> > at
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
> > plateTransferDropTargetListener.java:95)
> > at
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
> > ansferDropTargetListener.java:84)
> > at
> >
>
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
> > DropTargetListener.java:150)
> > at
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
> > 28)
> > at
> >
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> > :839)
> > at org.eclipse.core.runtime.Platform.run(Platform.java:416)
> > at
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
> > 5)
> > at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
> > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> > at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
> > at org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
> > at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
> > at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
> > at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
> > at
> >
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
> > at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
> > at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
> > at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
> > at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
> > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
> > at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
> > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
> > at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
> > at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
> > at
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > a:831)
> > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
> > at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
> >
> >
>
>
Re: Word-wrap in Label -> TextFlow? [message #62404 is a reply to message #62380] Thu, 06 February 2003 10:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dinkloh.DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de

Here the code snippet:

public MartinsFigure() {}

TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");

FlowPage fp = new FlowPage();

fp.add(tf);

add(fp);

}

"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> schrieb
im Newsbeitrag news:b1td86$ist$1@rogue.oti.com...
> Thank you for the quick response, this worked out well. But although it is
> is showing in one line "WRAPME ", now, it is still not word-wrapping the
> text. My new code snippet is below. I checked the bounds Rectangle with
the
> debugger and it is (height = 36, width = 64) for all three IFigures
> (MartinsFigure, tf, fp), so that the text should actually get wrapped.
>
> public MartinsFigure() {}
>
>
> Thank you, Martin
>
> "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> news:b1rsan$mfb$1@rogue.oti.com...
> > From TextFlow's superclass:
> >
> > * ... An
> > * <code>InlineFlow</code>'s parent must be either a {@link BlockFlow} or
> > another
> > * InlineFlow.
> >
> > FlowPage is the only figure that does not have the restriction, so place
a
> > TextFlow inside a FlowPage.
> >
> > "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
wrote
> > in message news:b1rp4a$ejh$1@rogue.oti.com...
> > > Hello!
> > >
> > > I have a Figure and would like to add some text in it, which should be
> > > word-wrapped so that it fills the Rectangle from getBounds(). First I
> > tried
> > > to add a Label to my Figure, but the text is not wrapped. So I looked
in
> > the
> > > Javadoc and found the class TextFlow, which fits my needs "An inline
> flow
> > > that renders a sting of text across one or more lines.".
> > >
> > > Now my problem: Simply instanciating and add()-ing it to my figure,
> gives
> > me
> > > a NullPointerException, so I guess the warning "It does not provide a
> > > FlowContext" has probably something to do with it.
> > >
> > > My code snippet and the full error message is below, does anybody know
> how
> > > to do this?
> > >
> > > Thank you very much in advance,
> > > Martin
> > >
> > > public MartinsFigure() {
> > >
> > > TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
> > >
> > > this.add(tf);
> > >
> > > }
> > >
> > > java.lang.NullPointerException
> > > at
> > >
> >
>
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
> > > 56)
> > > at
> > >
> org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
> > > at org.eclipse.draw2d.Figure.layout(Figure.java:862)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > at
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > at
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > at
> > >
> >
>
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
> > > dSize(FreeformViewport.java:20)
> > > at
> > >
> org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
> > > at
> > >
> >
>
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
> > > va:76)
> > > at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
> > > at
org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
> > > at
> org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
> > > at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
> > > at
> > >
> org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
> > > at
> org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
> > > at
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
> > > er.java:156)
> > > at
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
> > > .java:90)
> > > at
> > >
> >
>
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
> > > 105)
> > > at
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
> > > plateTransferDropTargetListener.java:95)
> > > at
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
> > > ansferDropTargetListener.java:84)
> > > at
> > >
> >
>
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
> > > DropTargetListener.java:150)
> > > at
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
> > > 28)
> > > at
> > >
> >
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> > > :839)
> > > at org.eclipse.core.runtime.Platform.run(Platform.java:416)
> > > at
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
> > > 5)
> > > at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
> > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> > > at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
> > > at
org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
> > > at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
> > > at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
> > > at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
> > > at
> > >
> org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
> > > at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
> > > at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
> > > at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
> > > at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
> > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
> > > at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
> > > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
> > > at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
> > > at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
> > > at
> > >
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > > a:831)
> > > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
> > > at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
> > >
> > >
> >
> >
>
>
Re: Word-wrap in Label -> TextFlow? [message #62559 is a reply to message #62404] Thu, 06 February 2003 14:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

MartinsFigure is not laying out the FlowPage. Add a StackLayout to
MartinsFigure, then it will size the flowpage to be 64x36 also.


"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> wrote
in message news:b1tdg0$j2q$1@rogue.oti.com...
> Here the code snippet:
>
> public MartinsFigure() {}
>
> TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
>
> FlowPage fp = new FlowPage();
>
> fp.add(tf);
>
> add(fp);
>
> }
>
> "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
schrieb
> im Newsbeitrag news:b1td86$ist$1@rogue.oti.com...
> > Thank you for the quick response, this worked out well. But although it
is
> > is showing in one line "WRAPME ", now, it is still not word-wrapping the
> > text. My new code snippet is below. I checked the bounds Rectangle with
> the
> > debugger and it is (height = 36, width = 64) for all three IFigures
> > (MartinsFigure, tf, fp), so that the text should actually get wrapped.
> >
> > public MartinsFigure() {}
> >
> >
> > Thank you, Martin
> >
> > "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> > news:b1rsan$mfb$1@rogue.oti.com...
> > > From TextFlow's superclass:
> > >
> > > * ... An
> > > * <code>InlineFlow</code>'s parent must be either a {@link BlockFlow}
or
> > > another
> > > * InlineFlow.
> > >
> > > FlowPage is the only figure that does not have the restriction, so
place
> a
> > > TextFlow inside a FlowPage.
> > >
> > > "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
> wrote
> > > in message news:b1rp4a$ejh$1@rogue.oti.com...
> > > > Hello!
> > > >
> > > > I have a Figure and would like to add some text in it, which should
be
> > > > word-wrapped so that it fills the Rectangle from getBounds(). First
I
> > > tried
> > > > to add a Label to my Figure, but the text is not wrapped. So I
looked
> in
> > > the
> > > > Javadoc and found the class TextFlow, which fits my needs "An inline
> > flow
> > > > that renders a sting of text across one or more lines.".
> > > >
> > > > Now my problem: Simply instanciating and add()-ing it to my figure,
> > gives
> > > me
> > > > a NullPointerException, so I guess the warning "It does not provide
a
> > > > FlowContext" has probably something to do with it.
> > > >
> > > > My code snippet and the full error message is below, does anybody
know
> > how
> > > > to do this?
> > > >
> > > > Thank you very much in advance,
> > > > Martin
> > > >
> > > > public MartinsFigure() {
> > > >
> > > > TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
> > > >
> > > > this.add(tf);
> > > >
> > > > }
> > > >
> > > > java.lang.NullPointerException
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
> > > > 56)
> > > > at
> > > >
> >
org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
> > > > at org.eclipse.draw2d.Figure.layout(Figure.java:862)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
> > > > dSize(FreeformViewport.java:20)
> > > > at
> > > >
> >
org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
> > > > va:76)
> > > > at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
> > > > at
> org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
> > > > at
> > org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
> > > > at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
> > > > at
> > > >
> >
org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
> > > > at
> > org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
> > > > er.java:156)
> > > > at
> > > >
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
> > > > .java:90)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
> > > > 105)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
> > > > plateTransferDropTargetListener.java:95)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
> > > > ansferDropTargetListener.java:84)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
> > > > DropTargetListener.java:150)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
> > > > 28)
> > > > at
> > > >
> > >
> >
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> > > > :839)
> > > > at org.eclipse.core.runtime.Platform.run(Platform.java:416)
> > > > at
> > > >
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
> > > > 5)
> > > > at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
> > > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> > > > at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
> > > > at
> org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
> > > > at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
> > > > at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
> > > > at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
> > > > at
> > > >
> >
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
> > > > at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
> > > > at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
> > > > at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
> > > > at
org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
> > > > at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
> > > > at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
> > > > at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
> > > > at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
> > > > at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
> > > > at
> > > >
> > >
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > > > a:831)
> > > > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
> > > > at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Word-wrap in Label -> TextFlow? [message #62727 is a reply to message #62559] Thu, 06 February 2003 17:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dinkloh.DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de

Sorry to be so annoying, but it is still not working. In the debugger the
LayoutManagers show up as follows: MartinsFigure:StackLayout,
fp:PageFlowLayout, tf:ParagraphTextLayout.

public MartinsFigure() {

setLayoutManager(new StackLayout());

TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");

FlowPage fp = new FlowPage();

fp.add(tf);

add(fp);

}

"Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
news:b1tqe3$tb4$1@rogue.oti.com...
> MartinsFigure is not laying out the FlowPage. Add a StackLayout to
> MartinsFigure, then it will size the flowpage to be 64x36 also.
>
>
> "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> wrote
> in message news:b1tdg0$j2q$1@rogue.oti.com...
> > Here the code snippet:
> >
> > public MartinsFigure() {}
> >
> > TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
> >
> > FlowPage fp = new FlowPage();
> >
> > fp.add(tf);
> >
> > add(fp);
> >
> > }
> >
> > "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
> schrieb
> > im Newsbeitrag news:b1td86$ist$1@rogue.oti.com...
> > > Thank you for the quick response, this worked out well. But although
it
> is
> > > is showing in one line "WRAPME ", now, it is still not word-wrapping
the
> > > text. My new code snippet is below. I checked the bounds Rectangle
with
> > the
> > > debugger and it is (height = 36, width = 64) for all three IFigures
> > > (MartinsFigure, tf, fp), so that the text should actually get wrapped.
> > >
> > > public MartinsFigure() {}
> > >
> > >
> > > Thank you, Martin
> > >
> > > "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> > > news:b1rsan$mfb$1@rogue.oti.com...
> > > > From TextFlow's superclass:
> > > >
> > > > * ... An
> > > > * <code>InlineFlow</code>'s parent must be either a {@link
BlockFlow}
> or
> > > > another
> > > > * InlineFlow.
> > > >
> > > > FlowPage is the only figure that does not have the restriction, so
> place
> > a
> > > > TextFlow inside a FlowPage.
> > > >
> > > > "Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
> > wrote
> > > > in message news:b1rp4a$ejh$1@rogue.oti.com...
> > > > > Hello!
> > > > >
> > > > > I have a Figure and would like to add some text in it, which
should
> be
> > > > > word-wrapped so that it fills the Rectangle from getBounds().
First
> I
> > > > tried
> > > > > to add a Label to my Figure, but the text is not wrapped. So I
> looked
> > in
> > > > the
> > > > > Javadoc and found the class TextFlow, which fits my needs "An
inline
> > > flow
> > > > > that renders a sting of text across one or more lines.".
> > > > >
> > > > > Now my problem: Simply instanciating and add()-ing it to my
figure,
> > > gives
> > > > me
> > > > > a NullPointerException, so I guess the warning "It does not
provide
> a
> > > > > FlowContext" has probably something to do with it.
> > > > >
> > > > > My code snippet and the full error message is below, does anybody
> know
> > > how
> > > > > to do this?
> > > > >
> > > > > Thank you very much in advance,
> > > > > Martin
> > > > >
> > > > > public MartinsFigure() {
> > > > >
> > > > > TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
> > > > >
> > > > > this.add(tf);
> > > > >
> > > > > }
> > > > >
> > > > > java.lang.NullPointerException
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
> > > > > 56)
> > > > > at
> > > > >
> > >
> org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
> > > > > at org.eclipse.draw2d.Figure.layout(Figure.java:862)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > > > at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
> > > > > dSize(FreeformViewport.java:20)
> > > > > at
> > > > >
> > >
> org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
> > > > > va:76)
> > > > > at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
> > > > > at
> > org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
> > > > > at
> > > org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
> > > > > at
org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
> > > > > at
> > > > >
> > >
> org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
> > > > > at
> > > org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
> > > > > er.java:156)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
> > > > > .java:90)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
> > > > > 105)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
> > > > > plateTransferDropTargetListener.java:95)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
> > > > > ansferDropTargetListener.java:84)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
> > > > > DropTargetListener.java:150)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
> > > > > 28)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> > > > > :839)
> > > > > at org.eclipse.core.runtime.Platform.run(Platform.java:416)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
> > > > > 5)
> > > > > at
org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
> > > > > at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> > > > > at
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
> > > > > at
> > org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
> > > > > at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
> > > > > at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
> > > > > at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
> > > > > at
> > > > >
> > >
> org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
> > > > > at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native
Method)
> > > > > at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
> > > > > at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
> > > > > at
> org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
> > > > > at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
> > > > > at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
> > > > > at
> > org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
> > > > > at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
> > > > > at
> > org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
> > > > > at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
> > > > > at
> > > > >
> > > >
> > >
> >
>
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
> > > > > a:831)
> > > > > at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
> > > > > at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Word-wrap in Label -> TextFlow? [message #183254 is a reply to message #62727] Tue, 31 May 2005 23:48 Go to previous message
Kevin MacDonell is currently offline Kevin MacDonellFriend
Messages: 5
Registered: July 2009
Junior Member
Did you ever get this to work? I'm having the same problem...

Martin Dinkloh wrote:
> Sorry to be so annoying, but it is still not working. In the debugger the
> LayoutManagers show up as follows: MartinsFigure:StackLayout,
> fp:PageFlowLayout, tf:ParagraphTextLayout.
>
> public MartinsFigure() {
>
> setLayoutManager(new StackLayout());
>
> TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
>
> FlowPage fp = new FlowPage();
>
> fp.add(tf);
>
> add(fp);
>
> }
>
> "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> news:b1tqe3$tb4$1@rogue.oti.com...
>
>>MartinsFigure is not laying out the FlowPage. Add a StackLayout to
>>MartinsFigure, then it will size the flowpage to be 64x36 also.
>>
>>
>>"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de> wrote
>>in message news:b1tdg0$j2q$1@rogue.oti.com...
>>
>>>Here the code snippet:
>>>
>>>public MartinsFigure() {}
>>>
>>> TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
>>>
>>> FlowPage fp = new FlowPage();
>>>
>>> fp.add(tf);
>>>
>>> add(fp);
>>>
>>>}
>>>
>>>"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
>>
>>schrieb
>>
>>>im Newsbeitrag news:b1td86$ist$1@rogue.oti.com...
>>>
>>>>Thank you for the quick response, this worked out well. But although
>
> it
>
>>is
>>
>>>>is showing in one line "WRAPME ", now, it is still not word-wrapping
>
> the
>
>>>>text. My new code snippet is below. I checked the bounds Rectangle
>
> with
>
>>>the
>>>
>>>>debugger and it is (height = 36, width = 64) for all three IFigures
>>>>(MartinsFigure, tf, fp), so that the text should actually get wrapped.
>>>>
>>>>public MartinsFigure() {}
>>>>
>>>>
>>>>Thank you, Martin
>>>>
>>>>"Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
>>>>news:b1rsan$mfb$1@rogue.oti.com...
>>>>
>>>>>From TextFlow's superclass:
>>>>>
>>>>>* ... An
>>>>>* <code>InlineFlow</code>'s parent must be either a {@link
>
> BlockFlow}
>
>>or
>>
>>>>>another
>>>>>* InlineFlow.
>>>>>
>>>>>FlowPage is the only figure that does not have the restriction, so
>>
>>place
>>
>>>a
>>>
>>>>>TextFlow inside a FlowPage.
>>>>>
>>>>>"Martin Dinkloh" <dinkloh@DELETE_THIS_SPAMBLOCKipd.uni-karlsruhe.de>
>>>
>>>wrote
>>>
>>>>>in message news:b1rp4a$ejh$1@rogue.oti.com...
>>>>>
>>>>>>Hello!
>>>>>>
>>>>>>I have a Figure and would like to add some text in it, which
>
> should
>
>>be
>>
>>>>>>word-wrapped so that it fills the Rectangle from getBounds().
>
> First
>
>>I
>>
>>>>>tried
>>>>>
>>>>>>to add a Label to my Figure, but the text is not wrapped. So I
>>
>>looked
>>
>>>in
>>>
>>>>>the
>>>>>
>>>>>>Javadoc and found the class TextFlow, which fits my needs "An
>
> inline
>
>>>>flow
>>>>
>>>>>>that renders a sting of text across one or more lines.".
>>>>>>
>>>>>>Now my problem: Simply instanciating and add()-ing it to my
>
> figure,
>
>>>>gives
>>>>
>>>>>me
>>>>>
>>>>>>a NullPointerException, so I guess the warning "It does not
>
> provide
>
>>a
>>
>>>>>>FlowContext" has probably something to do with it.
>>>>>>
>>>>>>My code snippet and the full error message is below, does anybody
>>
>>know
>>
>>>>how
>>>>
>>>>>>to do this?
>>>>>>
>>>>>>Thank you very much in advance,
>>>>>>Martin
>>>>>>
>>>>>>public MartinsFigure() {
>>>>>>
>>>>>> TextFlow tf = new TextFlow("WRAPME WRAPME WRAPME");
>>>>>>
>>>>>> this.add(tf);
>>>>>>
>>>>>>}
>>>>>>
>>>>>>java.lang.NullPointerException
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.text.ParagraphTextLayout.layout(Paragraph TextLayout.java:
>
>>>>>>56)
>>>>>> at
>>>>>>
>>>>
>> org.eclipse.draw2d.text.FlowFigureLayout.layout(FlowFigureLa yout.java:67)
>>
>>>>>> at org.eclipse.draw2d.Figure.layout(Figure.java:862)
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1523)
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
>
>>>>>> at org.eclipse.draw2d.Figure.validate(Figure.java:1525)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLaye redPane.java:68)
>
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.c alculatePreferre
>
>>>>>>dSize(FreeformViewport.java:20)
>>>>>> at
>>>>>>
>>>>
>> org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractL ayout.java:83)
>>
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(Abstr actHintLayout.ja
>
>>>>>>va:76)
>>>>>> at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:604)
>>>>>> at
>>>
>>> org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.j ava:44)
>>>
>>>>>> at
>>>>
>>>> org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas. java:161)
>>>>
>>>>>> at
>
> org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:1 59)
>
>>>>>> at
>>>>>>
>>>>
>> org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCan vas.java:124)
>>
>>>>>> at
>>>>
>>>> org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManage r.java:63)
>>>>
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.DeferredUpdateManager.validateFigures(Def erredUpdateManag
>
>>>>>>er.java:156)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.draw2d.DeferredUpdateManager.performUpdate(Defer redUpdateManager
>
>>>>>>.java:90)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.ui.parts.GraphicalViewerImpl.flush(Graphical ViewerImpl.java:
>
>>>>>>105)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.dnd.TemplateTransferDropTargetListener.selec tAddedObject(Tem
>
>>>>>>plateTransferDropTargetListener.java:95)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.dnd.TemplateTransferDropTargetListener.handl eDrop(TemplateTr
>
>>>>>>ansferDropTargetListener.java:84)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.dnd.AbstractTransferDropTargetListener.drop( AbstractTransfer
>
>>>>>>DropTargetListener.java:150)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.dnd.DelegatingDropAdapter$3.run(DelegatingDr opAdapter.java:1
>
>>>>>>28)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
>
>>>>>>:839)
>>>>>> at org.eclipse.core.runtime.Platform.run(Platform.java:416)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.gef.dnd.DelegatingDropAdapter.drop(DelegatingDro pAdapter.java:12
>
>>>>>>5)
>>>>>> at
>
> org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java :61)
>
>>>>>> at
>
> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
>
>>>>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
>>>>>> at
>
> org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:6 36)
>
>>>>>> at
>>>
>>> org.eclipse.swt.dnd.DropTarget.notifyListeners(DropTarget.ja va:548)
>>>
>>>>>> at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:485)
>>>>>> at org.eclipse.swt.dnd.DropTarget.access$7(DropTarget.java:413)
>>>>>> at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:205 )
>>>>>> at
>>>>>>
>>>>
>> org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMOb ject.java:111)
>>
>>>>>> at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native
>
> Method)
>
>>>>>> at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:295)
>>>>>> at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:276)
>>>>>> at
>>
>> org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java :144)
>>
>>>>>> at
>
> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :77)
>
>>>>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
>>>>>> at
>>>
>>> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:1529)
>>>
>>>>>> at
>>
>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1291)
>>
>>>>>> at
>>>
>>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1343)
>>>
>>>>>> at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
>>>>>> at
>>>>>>
>>>>>
> org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.jav
>
>>>>>>a:831)
>>>>>> at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432)
>>>>>> at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>
Previous Topic:How to activate property sheets to gef edit parts
Next Topic:Is it possible to export Plug-ins as stand-alone application
Goto Forum:
  


Current Time: Tue Dec 03 08:46:25 GMT 2024

Powered by FUDForum. Page generated in 0.06961 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top