Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JavaServer Faces » Where can I change the HostElement attribute value?
Where can I change the HostElement attribute value? [message #475029] Thu, 16 August 2007 03:44 Go to next message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
Hi all:

I want to change some attribute value of the host element when converter
is working:


public Element doConvertRefresh(){
....
getHostElement().setAttribute("maxsize","80");
....
}

but when I change the attribute value,the attribute object will notify
the listener to refresh the host element tag,so
the doConvertRefresh method will be invoke agian...

Where can I change the HostElement attribute value?


Thanks !
Re: Where can I change the HostElement attribute value? [message #475032 is a reply to message #475029] Thu, 16 August 2007 21:33 Go to previous messageGo to next message
Ian Trimble is currently offline Ian Trimble
Messages: 137
Registered: July 2009
Senior Member
I don't think I understand the use case. Why are you changing the "host"
element within this method? The purpose of this method is to create and
return the HTML Element that will be rendered by the Web Page Editor. If
you are trying to change an Element in the source document, this is not
the place to attempt it.

- Ian, JSF Tools Project
Re: Where can I change the HostElement attribute value? [message #475033 is a reply to message #475032] Thu, 16 August 2007 23:10 Go to previous messageGo to next message
Ian Trimble is currently offline Ian Trimble
Messages: 137
Registered: July 2009
Senior Member
To add a little more information to my previous posting, typically you
would call createElement(String) to create a new Element, manipulate this
new Element's attributes, and ultimately return the new Element.

For example:

Element resultElement = createElement("input");
resultElement.setAttribute("type", "text");
resultElement.setAttribute("value",
getHostElement().getAttribute("value"));
resultElement.setAttribute("maxsize", "80");
return resultElement;

The method "getHostElement()" will return the source document's Element
that is being converted, and even if you could manipulate it from within
the tag converter, this would not affect the expected result of a tag
conversion.

Perhaps I do not understand what it is you are attempting to do in your
tag converter. Please feel free to elaborate further.

- Ian, JSF Tools Project
Re: Where can I change the HostElement attribute value? [message #475034 is a reply to message #475032] Fri, 17 August 2007 02:41 Go to previous messageGo to next message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Ian Trimble" <ian.trimble@oracle.com>
??????:24108ccc01065d107d035447a639b132$1@www.eclipse.org...
>I don't think I understand the use case. Why are you changing the "host"
>element within this method? The purpose of this method is to create and
>return the HTML Element that will be rendered by the Web Page Editor. If
>you are trying to change an Element in the source document, this is not the
>place to attempt it.
>
> - Ian, JSF Tools Project
>
Hi Ian:

Thank you for your help.

first, I show the use case follow:
when I show the some tag , the tag don't use the "style" attribute to
control its size but
only use the special attribute "width" or "height". It means that the
"style" attribute is useless .
So when user resize the host element by web page editor ,"style" attribute
value of the host element was changed,then
the special attribute "width" or "height" should be change .

You are right,The converter's purpose is ONLY convert the tag element to
html tag element,so I think that I should install new EditPoliy for the
special tag , then I can change the host element attribute value use by some
GEF commands when I can get the resize request by my EditPolicy , right?
Re: Where can I change the HostElement attribute value? [message #475035 is a reply to message #475033] Fri, 17 August 2007 02:53 Go to previous messageGo to next message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
Thank you!

First I give my use case:

when I want to show the some tag , the tag don't use the "style" attribute
to control its size but
only use the special attribute "width" or "height". It means that the
"style" attribute is useless
So when user resize the host element by web page editor ,"style" attribute
value of the host element was changed,then
the special attribute "width" or "height" should be change .

You are right, the tag converter should only to convert the custome tag to
html tag ,so I think that I should install some
new EditPoliy for the special tag element model, then I can change the
element attribute value by some GEF commands
when I can get the resize request by my EditPolicy , right?
Re: Where can I change the HostElement attribute value? [message #475036 is a reply to message #475035] Fri, 17 August 2007 18:44 Go to previous messageGo to next message
Cameron Bateman is currently offline Cameron Bateman
Messages: 480
Registered: July 2009
Senior Member
> You are right, the tag converter should only to convert the custome tag to
> html tag ,so I think that I should install some
> new EditPoliy for the special tag element model, then I can change the
> element attribute value by some GEF commands
> when I can get the resize request by my EditPolicy , right?

That's right. My suggestion is to subclass ElementResizableEditPolicy and
override the getResizeCommand method. You can use the IElementEdit
interface to override the edit policy on targeted edit parts with your own.

If you have a list of standard use cases like this, it would be great if
you could list them here or on a bug. That will help us standardize the
edit policy interfaces with commonly used behaviour that can be quickly
customized through meta-data.


Thanks,

Cameron
Re: Where can I change the HostElement attribute value? [message #475037 is a reply to message #475036] Mon, 20 August 2007 09:29 Go to previous messageGo to next message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:24096201b4cd9251984ed39ec361579a$1@www.eclipse.org...

>
> If you have a list of standard use cases like this, it would be great if
> you could list them here or on a bug. That will help us standardize the
> edit policy interfaces with commonly used behaviour that can be quickly
> customized through meta-data.

I have writen a new ResizeEditPolicy for my tag and it was working well now.

I will write some special use cases and some suggestions here.

Thank you for your help
Re: Where can I change the HostElement attribute value? [message #475038 is a reply to message #475036] Mon, 20 August 2007 09:31 Go to previous message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:24096201b4cd9251984ed39ec361579a$1@www.eclipse.org...
>> You are right, the tag converter should only to convert the custome tag
>> to html tag ,so I think that I should install some
>> new EditPoliy for the special tag element model, then I can change the
>> element attribute value by some GEF commands
>> when I can get the resize request by my EditPolicy , right?
>
> That's right. My suggestion is to subclass ElementResizableEditPolicy and
> override the getResizeCommand method. You can use the IElementEdit
> interface to override the edit policy on targeted edit parts with your
> own.
>
> If you have a list of standard use cases like this, it would be great if
> you could list them here or on a bug. That will help us standardize the
> edit policy interfaces with commonly used behaviour that can be quickly
> customized through meta-data.
>
>
> Thanks,
>
> Cameron
>

I have writen a new ResizeEditPolicy for my host tag and it was working well
now

I will list some special use cases and suggestions here.

Thank you for your help
Re: Where can I change the HostElement attribute value? [message #614197 is a reply to message #475029] Thu, 16 August 2007 21:33 Go to previous message
Ian Trimble is currently offline Ian Trimble
Messages: 137
Registered: July 2009
Senior Member
I don't think I understand the use case. Why are you changing the "host"
element within this method? The purpose of this method is to create and
return the HTML Element that will be rendered by the Web Page Editor. If
you are trying to change an Element in the source document, this is not
the place to attempt it.

- Ian, JSF Tools Project
Re: Where can I change the HostElement attribute value? [message #614199 is a reply to message #475032] Thu, 16 August 2007 23:10 Go to previous message
Ian Trimble is currently offline Ian Trimble
Messages: 137
Registered: July 2009
Senior Member
To add a little more information to my previous posting, typically you
would call createElement(String) to create a new Element, manipulate this
new Element's attributes, and ultimately return the new Element.

For example:

Element resultElement = createElement("input");
resultElement.setAttribute("type", "text");
resultElement.setAttribute("value",
getHostElement().getAttribute("value"));
resultElement.setAttribute("maxsize", "80");
return resultElement;

The method "getHostElement()" will return the source document's Element
that is being converted, and even if you could manipulate it from within
the tag converter, this would not affect the expected result of a tag
conversion.

Perhaps I do not understand what it is you are attempting to do in your
tag converter. Please feel free to elaborate further.

- Ian, JSF Tools Project
Re: Where can I change the HostElement attribute value? [message #614203 is a reply to message #475032] Fri, 17 August 2007 02:41 Go to previous message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Ian Trimble" <ian.trimble@oracle.com>
??????:24108ccc01065d107d035447a639b132$1@www.eclipse.org...
>I don't think I understand the use case. Why are you changing the "host"
>element within this method? The purpose of this method is to create and
>return the HTML Element that will be rendered by the Web Page Editor. If
>you are trying to change an Element in the source document, this is not the
>place to attempt it.
>
> - Ian, JSF Tools Project
>
Hi Ian:

Thank you for your help.

first, I show the use case follow:
when I show the some tag , the tag don't use the "style" attribute to
control its size but
only use the special attribute "width" or "height". It means that the
"style" attribute is useless .
So when user resize the host element by web page editor ,"style" attribute
value of the host element was changed,then
the special attribute "width" or "height" should be change .

You are right,The converter's purpose is ONLY convert the tag element to
html tag element,so I think that I should install new EditPoliy for the
special tag , then I can change the host element attribute value use by some
GEF commands when I can get the resize request by my EditPolicy , right?
Re: Where can I change the HostElement attribute value? [message #614206 is a reply to message #475033] Fri, 17 August 2007 02:53 Go to previous message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
Thank you!

First I give my use case:

when I want to show the some tag , the tag don't use the "style" attribute
to control its size but
only use the special attribute "width" or "height". It means that the
"style" attribute is useless
So when user resize the host element by web page editor ,"style" attribute
value of the host element was changed,then
the special attribute "width" or "height" should be change .

You are right, the tag converter should only to convert the custome tag to
html tag ,so I think that I should install some
new EditPoliy for the special tag element model, then I can change the
element attribute value by some GEF commands
when I can get the resize request by my EditPolicy , right?
Re: Where can I change the HostElement attribute value? [message #614207 is a reply to message #475035] Fri, 17 August 2007 18:44 Go to previous message
Cameron Bateman is currently offline Cameron Bateman
Messages: 480
Registered: July 2009
Senior Member
> You are right, the tag converter should only to convert the custome tag to
> html tag ,so I think that I should install some
> new EditPoliy for the special tag element model, then I can change the
> element attribute value by some GEF commands
> when I can get the resize request by my EditPolicy , right?

That's right. My suggestion is to subclass ElementResizableEditPolicy and
override the getResizeCommand method. You can use the IElementEdit
interface to override the edit policy on targeted edit parts with your own.

If you have a list of standard use cases like this, it would be great if
you could list them here or on a bug. That will help us standardize the
edit policy interfaces with commonly used behaviour that can be quickly
customized through meta-data.


Thanks,

Cameron
Re: Where can I change the HostElement attribute value? [message #614212 is a reply to message #475036] Mon, 20 August 2007 09:29 Go to previous message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:24096201b4cd9251984ed39ec361579a$1@www.eclipse.org...

>
> If you have a list of standard use cases like this, it would be great if
> you could list them here or on a bug. That will help us standardize the
> edit policy interfaces with commonly used behaviour that can be quickly
> customized through meta-data.

I have writen a new ResizeEditPolicy for my tag and it was working well now.

I will write some special use cases and some suggestions here.

Thank you for your help
Re: Where can I change the HostElement attribute value? [message #614216 is a reply to message #475036] Mon, 20 August 2007 09:31 Go to previous message
Dart peng is currently offline Dart peng
Messages: 27
Registered: July 2009
Junior Member
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:24096201b4cd9251984ed39ec361579a$1@www.eclipse.org...
>> You are right, the tag converter should only to convert the custome tag
>> to html tag ,so I think that I should install some
>> new EditPoliy for the special tag element model, then I can change the
>> element attribute value by some GEF commands
>> when I can get the resize request by my EditPolicy , right?
>
> That's right. My suggestion is to subclass ElementResizableEditPolicy and
> override the getResizeCommand method. You can use the IElementEdit
> interface to override the edit policy on targeted edit parts with your
> own.
>
> If you have a list of standard use cases like this, it would be great if
> you could list them here or on a bug. That will help us standardize the
> edit policy interfaces with commonly used behaviour that can be quickly
> customized through meta-data.
>
>
> Thanks,
>
> Cameron
>

I have writen a new ResizeEditPolicy for my host tag and it was working well
now

I will list some special use cases and suggestions here.

Thank you for your help
Previous Topic:AbstractTagConverter#doConvertRefresh
Next Topic:Tow Tools for JST
Goto Forum:
  


Current Time: Sun Oct 26 04:41:56 GMT 2014

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

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