Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Refreshing figure
Refreshing figure [message #178011] Sat, 16 April 2005 16:25 Go to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

Hi! All
This is my case:
I have a model ,represented by figure, on the editor.
My model are network components which are situated at various geographical
location. Suppose i have a Router situated at location NewYork,so in the
createFigure,im using a Label to setText.So the figure on the editor says
Router@NewYork .
This figure is created after we call addChild for the model.
Now my application requirments is such that ,if we have another Router at
location NewYork,i dont have to create / return a new Figure.
I just have to refresh the old figure on the editor saying somthing like
Router@NewYork [2]

So my question is how do i refresh the figure.
Any suggestion is greatly appreciated.
Thanking in advance.
Many Regards.
ved
Re: Refreshing figure [message #178020 is a reply to message #178011] Sat, 16 April 2005 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gslade.no.spam.us.ibm.com

What happens when you drag a figure round on the editor, or resize it,
or add childern to it.... or do anything else that means things need to
redraw themselves? Trace though any of the samples and you will see that
refreshVisuals on edit parts gets called.
So change the value of the string ( or whatever else you want to
change...size, position etc ) and then have your edit part call
refreshVisuals().

Guy


ved gunjan wrote:
>
> Hi! All
> This is my case:
> I have a model ,represented by figure, on the editor.
> My model are network components which are situated at various
> geographical location. Suppose i have a Router situated at location
> NewYork,so in the createFigure,im using a Label to setText.So the figure
> on the editor says Router@NewYork .
> This figure is created after we call addChild for the model.
> Now my application requirments is such that ,if we have another Router
> at location NewYork,i dont have to create / return a new Figure.
> I just have to refresh the old figure on the editor saying somthing like
> Router@NewYork [2]
>
> So my question is how do i refresh the figure.
> Any suggestion is greatly appreciated.
> Thanking in advance.
> Many Regards.
> ved
>
Re: Refreshing figure [message #178028 is a reply to message #178011] Sun, 17 April 2005 21:38 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
--

Pratik Shah
"ved gunjan" <gunjan_sir@yahoo.com> wrote in message
news:232da82d632c711d014097eddf9c26fc$1@www.eclipse.org...
>
> Hi! All
> This is my case:
> I have a model ,represented by figure, on the editor.
> My model are network components which are situated at various geographical
> location. Suppose i have a Router situated at location NewYork,so in the
> createFigure,im using a Label to setText.So the figure on the editor says

You should be setting the text in refreshVisuals() if it's something that
can change, and not in createFigure(). Like our examples do.

> Router@NewYork .
> This figure is created after we call addChild for the model.
> Now my application requirments is such that ,if we have another Router at
> location NewYork,i dont have to create / return a new Figure.
> I just have to refresh the old figure on the editor saying somthing like
> Router@NewYork [2]
>
> So my question is how do i refresh the figure.
> Any suggestion is greatly appreciated.
> Thanking in advance.
> Many Regards.
> ved
>
Re: Refreshing figure [message #178250 is a reply to message #178028] Tue, 19 April 2005 11:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

Pratik Shah wrote:




Hi!
Thanks a lot..but can i know which examples u are refering to.
Regards
Ved gunjan
Re: Refreshing figure [message #178256 is a reply to message #178020] Tue, 19 April 2005 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

Thanks Guy!!!
Point taken and understood also, but my question is when i drag and drop
same model twice from the palette,i dont want to create a new figure....i
just have to change the label of the figure ....
here is my code
public IFigure createFigure(String imgStr, String selected_model, String
location) {
imgFileName = imgStr;
modelName = selected_entity;
modelLocation = location;
label = new Label();
Image modelImage = new Image(null,
Model.class.getResourceAsStream(imgFileName));
modelDetailsString = modelName + '\n' + "@" + " " + modelLocation
;
label.setIcon(modelImage);
label.setText(modelDetailsString);
}

Now when the model are location are same(means already present on the
editor) i just have updated / refresh the old figure on the editor with
the a new
modelDetailsString
somthing like this...
modelDetailsString = modelName + '\n' + "@" + " " + modelLocation +
count;

and this new string should be setText on the old figure,
I DONT HAVE TO CREATE A NEW FIGURE .

Hope u got my problem.
Reagards
Ved
Re: Refreshing figure [message #178298 is a reply to message #178256] Tue, 19 April 2005 16:28 Go to previous message
Eclipse UserFriend
Originally posted by: gslade.no.spam.us.ibm.com

so you could do something like...
You have some form of addChild() method in the model obhject you are
adding the child to.
Change this to check for duplicates.
If you detect a dup then don't add the child
Either ask the model object that already exists as a child to update
itself directly ( since you now know what who he is ).
Or fire an event passing the object that was trying to add itself as a
child. All existing children could be listeners to the parent part and
the one that is the dup would respond by updating itself.

By updating itself I mean that it could increment a counter and then
fire an event to its edit part, the edit part would then used the
counter to rebuild the string and then refresh visuals

and yes, you DONT NEED TO CREATE A NEW FIGURE :-) ... never said you did.

Guy


ved gunjan wrote:
>
> Thanks Guy!!!
> Point taken and understood also, but my question is when i drag and drop
> same model twice from the palette,i dont want to create a new
> figure....i just have to change the label of the figure ....
> here is my code
> public IFigure createFigure(String imgStr, String selected_model, String
> location) {
> imgFileName = imgStr;
> modelName = selected_entity;
> modelLocation = location;
> label = new Label();
> Image modelImage = new Image(null,
> Model.class.getResourceAsStream(imgFileName));
> modelDetailsString = modelName + '\n' + "@" + " " + modelLocation ;
> label.setIcon(modelImage);
> label.setText(modelDetailsString);
> }
>
> Now when the model are location are same(means already present on the
> editor) i just have updated / refresh the old figure on the editor with
> the a new modelDetailsString
> somthing like this...
> modelDetailsString = modelName + '\n' + "@" + " " + modelLocation +
> count;
>
> and this new string should be setText on the old figure,
> I DONT HAVE TO CREATE A NEW FIGURE .
>
> Hope u got my problem.
> Reagards
> Ved
>
>
>
Previous Topic:how does GEF interpret user actions to REQUESTs?
Next Topic:Article proposal: Aspects of the graph related layout with GEF
Goto Forum:
  


Current Time: Wed Feb 08 08:38:45 GMT 2023

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

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

Back to the top