Resize node figure as textflow content changes [message #228622] |
Wed, 03 January 2007 16:54 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
I noticed in the Logic example that as text is entered into the Label
textflow, the figure resizes to "best fit" the new text. Can someone
point me to where in the code this is being accomplished?
|
|
|
|
Re: Resize node figure as textflow content changes [message #228641 is a reply to message #228634] |
Wed, 03 January 2007 21:56 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
That makes sense. I copied the logic example to create my node figure,
which is very similar in appearance. But even with the StackLayout code
from logic editor, I'm not seeing the behavior.
Is there an edit policy I should check for that might be preventing the
resize from happening? The parent figure (the node) is in fact
resizable by the user.
Alex Boyko wrote:
> I think this is being done by the layout manager installed on the sticky
> note figure - by the StackLayout. In general, resizing of parent figures
> to fit their children is done by layout managers.
>
|
|
|
|
Re: Resize node figure as textflow content changes [message #228703 is a reply to message #228648] |
Thu, 04 January 2007 22:28 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
OK that also makes sense. My DirectEditPolicy looks just like the
example.. But it doesn't seem to cause the expected behavior. Even
while I am typing text into the flow, it simply scrolls to accommodate
more text, instead of resizing.
Figure code here:
public ScenarioNodeFigure()
{
setBorder(new LineBorder(2));
flowPage = new FlowPage();
flowPage.setOpaque(true);
flowPage.setBackgroundColor(ColorConstants.white);
flowPage.setBorder(new MarginBorder(3));
textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
textFlow.setOpaque(false);
flowPage.add(textFlow);
flowPage.setBackgroundColor(ColorConstants.white);
setLayoutManager(new StackLayout());
add(flowPage);
incomingConnectionAnchor = new ScenarioLinkAnchor(this,true);
outgoingConnectionAnchor = new ScenarioLinkAnchor(this,false);
}
....
public void setText(String newText) {
textFlow.setText(newText);
}
Alex Boyko wrote:
> Hi,
>
> Yes, there is such an edit policy. Look at
> LabelDirectEditPolicy#showCurrentEditValue().
> This method sets the new text to text flow figure, which will eventually
> revalidate the parent figure (the StickyNoteFigure), which with the help
> of the layout manager will be assigned the proper bounds to fit the text
> flow.
> Hope this helps.
>
> Cheer,
> Alex
>
|
|
|
Re: Resize node figure as textflow content changes [message #228913 is a reply to message #228703] |
Thu, 11 January 2007 14:14 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
Does anyone else have any further suggestions or help regarding this
question?
Ben Vitale wrote:
> OK that also makes sense. My DirectEditPolicy looks just like the
> example.. But it doesn't seem to cause the expected behavior. Even
> while I am typing text into the flow, it simply scrolls to accommodate
> more text, instead of resizing.
>
> Figure code here:
>
> public ScenarioNodeFigure()
> {
> setBorder(new LineBorder(2));
>
> flowPage = new FlowPage();
> flowPage.setOpaque(true);
> flowPage.setBackgroundColor(ColorConstants.white);
> flowPage.setBorder(new MarginBorder(3));
>
> textFlow = new TextFlow();
> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
> ParagraphTextLayout.WORD_WRAP_SOFT));
> textFlow.setOpaque(false);
> flowPage.add(textFlow);
> flowPage.setBackgroundColor(ColorConstants.white);
>
> setLayoutManager(new StackLayout());
> add(flowPage);
>
> incomingConnectionAnchor = new ScenarioLinkAnchor(this,true);
> outgoingConnectionAnchor = new ScenarioLinkAnchor(this,false);
> }
>
> ...
>
> public void setText(String newText) {
> textFlow.setText(newText);
> }
>
>
> Alex Boyko wrote:
>> Hi,
>>
>> Yes, there is such an edit policy. Look at
>> LabelDirectEditPolicy#showCurrentEditValue().
>> This method sets the new text to text flow figure, which will
>> eventually revalidate the parent figure (the StickyNoteFigure), which
>> with the help of the layout manager will be assigned the proper bounds
>> to fit the text flow.
>> Hope this helps.
>>
>> Cheer,
>> Alex
>>
|
|
|
|
|
Re: Resize node figure as textflow content changes [message #229081 is a reply to message #228957] |
Mon, 15 January 2007 20:22 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
Thanks for the help Alex. Turns out I was looking in the wrong place.
In refreshVisuals for the node edit part, I was setting a layout
constraint on the node figure based on the dimensions stored in the
node's model object. Removing this constraint allowed my figure to
resize at will.
Alex Boyko wrote:
> Hi Ben,
>
> You could also check if StackLayout#layout() is getting called when
> you're entering text.
>
> Cheers,
> Alex
>
|
|
|
Powered by
FUDForum. Page generated in 0.04266 seconds