Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Make Label to have several editable parts?
Make Label to have several editable parts? [message #55655] Fri, 17 January 2003 19:31 Go to next message
Hal is currently offline HalFriend
Messages: 67
Registered: July 2009
Member
Hi,

Couple months ago I post a message about how to make label to have several
editable parts. Randy Hudson, that can be done if a simple change is made in
GEF. Would you please tell me if that change is in the latest build?

Thank you.

Subject: Re: Make Label to have serval editable parts?
From: hudsonr@us.eye-bee-em.com (Randy Hudson)
Newsgroups: eclipse.tools.gef
Organization: EclipseCorner
Date: Oct 09 2002 20:24:13

If we make a simple change in GEF (SelectEditPartTracker), Hal could use
this figure with a single editpart. The change would be to make "direct
edit" a LocationRequest. Hal could just take the Request and compare its
location to the location of the 3 labels.

However, both of these solution only work with the mouse. You would still
have to figure out how to switch between the 3 CellEditors with the
keyboard.


> > public void performRequest(Request request) {
> > if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {

Point where = ((LocationRequest)request).getLocation(); //Returns the
location on the Canvas
getMonthLabel().translateToRelative(where); //You could use any of the
3 labels for this translation
if (getMonthLabel().containsPoint(where)){
performMonthDirectEdit();
} else if ...
//etc.

> > }
> > }
Re: Make Label to have several editable parts? [message #55688 is a reply to message #55655] Fri, 17 January 2003 20:17 Go to previous messageGo to next message
Eric Bordeau is currently offline Eric BordeauFriend
Messages: 259
Registered: July 2009
Senior Member
Yes, DirectEditRequest is now a subclass of LocationRequest.

Eric

Hal wrote:
> Hi,
>
> Couple months ago I post a message about how to make label to have several
> editable parts. Randy Hudson, that can be done if a simple change is made in
> GEF. Would you please tell me if that change is in the latest build?
>
> Thank you.
>
> Subject: Re: Make Label to have serval editable parts?
> From: hudsonr@us.eye-bee-em.com (Randy Hudson)
> Newsgroups: eclipse.tools.gef
> Organization: EclipseCorner
> Date: Oct 09 2002 20:24:13
>
> If we make a simple change in GEF (SelectEditPartTracker), Hal could use
> this figure with a single editpart. The change would be to make "direct
> edit" a LocationRequest. Hal could just take the Request and compare its
> location to the location of the 3 labels.
>
> However, both of these solution only work with the mouse. You would still
> have to figure out how to switch between the 3 CellEditors with the
> keyboard.
>
>
>
>>>public void performRequest(Request request) {
>>>if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
>
>
> Point where = ((LocationRequest)request).getLocation(); //Returns the
> location on the Canvas
> getMonthLabel().translateToRelative(where); //You could use any of the
> 3 labels for this translation
> if (getMonthLabel().containsPoint(where)){
> performMonthDirectEdit();
> } else if ...
> //etc.
>
>
>>>}
>>>}
>
>
>
>
>
>
>
>
>
Re: Make Label to have several editable parts? [message #56008 is a reply to message #55688] Sat, 18 January 2003 19:20 Go to previous message
Hal is currently offline HalFriend
Messages: 67
Registered: July 2009
Member
Thanks. I try this, but the getLocation() always return me the *SAME*
co-ordinate regardless where I click on the label.

Here is what I did:
- create a new LocationEditManager and in its createDirectEditRequest(),
copy the location from the incoming directEditRequest to this new Direct
edit request that it is going to create.
protected DirectEditRequest createDirectEditRequest(){

DirectEditRequest req = new DirectEditRequest();


if (request != null){

req.setLocation(incomingDirectEditRequest.getLocation());

}


req.setCellEditor(getCellEditor());

return req;

}

- create a new DirectEditPolicy, I print out the location of the request:
But the location is ALWAYS the same, regardless where I click the label:
protected void showCurrentEditValue(DirectEditRequest request) {

System.out.println ("showCurrentEditValue x:" + request.getLocation().x + "
y:" + request.getLocation().y);

LogicSubpart host =
(LogicSubpart)((AbstractGraphicalEditPart)getHost()).getMode l();

//...

}

- in my editPart, I install this new direct edit policy and create my new
directEditManager when necessary.

Could you please if I miss anything? What I want to do is I have a label
looks like this "XX / MM / YY", if user clicks between the beginning of the
label to the first "/", I only pops up "XX". Same thing if user clicks
between the first "/" and the last "/", only "MM" will pop up.

Thanks for any help.




"Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
news:b09ncg$hvk$1@rogue.oti.com...
> Yes, DirectEditRequest is now a subclass of LocationRequest.
>
> Eric
>
> Hal wrote:
> > Hi,
> >
> > Couple months ago I post a message about how to make label to have
several
> > editable parts. Randy Hudson, that can be done if a simple change is
made in
> > GEF. Would you please tell me if that change is in the latest build?
> >
> > Thank you.
> >
> > Subject: Re: Make Label to have serval editable parts?
> > From: hudsonr@us.eye-bee-em.com (Randy Hudson)
> > Newsgroups: eclipse.tools.gef
> > Organization: EclipseCorner
> > Date: Oct 09 2002 20:24:13
> >
> > If we make a simple change in GEF (SelectEditPartTracker), Hal could use
> > this figure with a single editpart. The change would be to make "direct
> > edit" a LocationRequest. Hal could just take the Request and compare
its
> > location to the location of the 3 labels.
> >
> > However, both of these solution only work with the mouse. You would
still
> > have to figure out how to switch between the 3 CellEditors with the
> > keyboard.
> >
> >
> >
> >>>public void performRequest(Request request) {
> >>>if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
> >
> >
> > Point where = ((LocationRequest)request).getLocation(); //Returns
the
> > location on the Canvas
> > getMonthLabel().translateToRelative(where); //You could use any of
the
> > 3 labels for this translation
> > if (getMonthLabel().containsPoint(where)){
> > performMonthDirectEdit();
> > } else if ...
> > //etc.
> >
> >
> >>>}
> >>>}
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
Previous Topic:graph?
Next Topic:selection in I20030116
Goto Forum:
  


Current Time: Fri Mar 29 04:43:07 GMT 2024

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

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

Back to the top