Home » Eclipse Projects » JavaServer Faces » How to ignore some tags when create or display the host tag?
| |
Re: How to ignore some tags when create or display the host tag? [message #475180 is a reply to message #475177] |
Wed, 07 November 2007 07:46 |
Dart peng Messages: 27 Registered: July 2009 |
Junior Member |
|
|
Hi Cameron:
Thank you for your reply.
First I'm very sorry that I can't descrip my problem clearly because that
my English is too bad.
Actually I asked two question
1. I doubt the AbstractTagConverter#shouldIgnore method.
I want to make my TagConverter can know which children tag is illegal,so
when the TagConverter
is adding the children tags,it can ignore those illegal tags and don't add
it into the children nodes.
For example:
I write the HTML code "<table><td></td></table>" into the text editor,in
the fact, the <td> tag is
illegal,when my TableTagConverter add the children,It shouldn't add the <td>
element.But actually the
AbstractTagConverter don't do this,I have to do this work by myself----I
need to judge which child
element is illegal.
At first I think that the shouldIgnore method can help me to do the
work,but it didn't.So I don't
know how to use the sholdIgnore method.
I think maybe the AbstractTagConverter#addChild method can be modified
like this:
protected void addChild(Node childNode, ConvertPosition position) {
if(shouldIgnore(childNode)) return;
_childNodes.add(childNode);
_childNodePositions.put(childNode, position);
}
2.I want to control where a palette/canvas item can dropped.I have writed
a new edit policy and
instal it into the editpart to control,but you gave me a best method,I will
try it, thank you very much
--Dart
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:83029092893ef188ca19acfc01c3bf1b$1@www.eclipse.org...
> Hi Dart,
>
> I'm a little confused by what you are trying to do. Are you trying to
> control where an element can be dropped or whether it will appear once it
> is part of the page?
>
> The ITagConverter interface controls only what HTML is rendered at design
> time for a particular tag. The shouldIgnore in this case controls whether
> children get convertered to HTML for rendering in the visual canvas. This
> won't change whether a user can drop the tag, only whether it will show
> up.
>
> If you want more control over where a palette/canvas item can dropped,
> look instead the IElementEdit interface. This provides a method
> "getDropRequestorLocationStrategy" that can return a strategy object that
> finds the closest position to the current mouse position where an element
> may be validly dropped (or null if none exists). Look at
> ColumnElementEdit for an example of how we use this in the out-of-the-box
> framework to allow us to control where and how an h:column can be dropped
> inside an h:dataTable.
>
>
> --Cam
>
>
> Dart peng wrote:
>
>> Hi all:
>> I create a tag converter for my host element A .I don't want that every
>> tag can drag into the A and been created ,so I need to add a new
>> ItemCreationTagEditPolicy and overwrite the getCommand method to ignore
>> some tags been created.When my converter to add the child elements I need
>> to judge the element , if the element is illegal , I will don't add it.
>> But I find that there is a method : shouldIgnore in the
>> AbstractTagConverter class,so I overwrite the method to ignore the tags
>> but it's useless .It's only called by copyChildren method and
>> dumCopyChildren method.
>> Some tag converter for example the CommandLinkTagConverter class uses
>> the shouldIgnore method when it add the child elements.
>> why don't write the shouldIgnore method inside the addChild method to
>> judge which element can be added? And I find that the
>> ItemCreationTagEditPolicy didn't do any work to ingnore some illegal
>> elements.
>
>
|
|
| |
Re: How to ignore some tags when create or display the host tag? [message #614472 is a reply to message #475177] |
Wed, 07 November 2007 07:46 |
Dart peng Messages: 27 Registered: July 2009 |
Junior Member |
|
|
Hi Cameron:
Thank you for your reply.
First I'm very sorry that I can't descrip my problem clearly because that
my English is too bad.
Actually I asked two question
1. I doubt the AbstractTagConverter#shouldIgnore method.
I want to make my TagConverter can know which children tag is illegal,so
when the TagConverter
is adding the children tags,it can ignore those illegal tags and don't add
it into the children nodes.
For example:
I write the HTML code "<table><td></td></table>" into the text editor,in
the fact, the <td> tag is
illegal,when my TableTagConverter add the children,It shouldn't add the <td>
element.But actually the
AbstractTagConverter don't do this,I have to do this work by myself----I
need to judge which child
element is illegal.
At first I think that the shouldIgnore method can help me to do the
work,but it didn't.So I don't
know how to use the sholdIgnore method.
I think maybe the AbstractTagConverter#addChild method can be modified
like this:
protected void addChild(Node childNode, ConvertPosition position) {
if(shouldIgnore(childNode)) return;
_childNodes.add(childNode);
_childNodePositions.put(childNode, position);
}
2.I want to control where a palette/canvas item can dropped.I have writed
a new edit policy and
instal it into the editpart to control,but you gave me a best method,I will
try it, thank you very much
--Dart
"Cameron Bateman" <cameron.bateman@oracle.com>
??????:83029092893ef188ca19acfc01c3bf1b$1@www.eclipse.org...
> Hi Dart,
>
> I'm a little confused by what you are trying to do. Are you trying to
> control where an element can be dropped or whether it will appear once it
> is part of the page?
>
> The ITagConverter interface controls only what HTML is rendered at design
> time for a particular tag. The shouldIgnore in this case controls whether
> children get convertered to HTML for rendering in the visual canvas. This
> won't change whether a user can drop the tag, only whether it will show
> up.
>
> If you want more control over where a palette/canvas item can dropped,
> look instead the IElementEdit interface. This provides a method
> "getDropRequestorLocationStrategy" that can return a strategy object that
> finds the closest position to the current mouse position where an element
> may be validly dropped (or null if none exists). Look at
> ColumnElementEdit for an example of how we use this in the out-of-the-box
> framework to allow us to control where and how an h:column can be dropped
> inside an h:dataTable.
>
>
> --Cam
>
>
> Dart peng wrote:
>
>> Hi all:
>> I create a tag converter for my host element A .I don't want that every
>> tag can drag into the A and been created ,so I need to add a new
>> ItemCreationTagEditPolicy and overwrite the getCommand method to ignore
>> some tags been created.When my converter to add the child elements I need
>> to judge the element , if the element is illegal , I will don't add it.
>> But I find that there is a method : shouldIgnore in the
>> AbstractTagConverter class,so I overwrite the method to ignore the tags
>> but it's useless .It's only called by copyChildren method and
>> dumCopyChildren method.
>> Some tag converter for example the CommandLinkTagConverter class uses
>> the shouldIgnore method when it add the child elements.
>> why don't write the shouldIgnore method inside the addChild method to
>> judge which element can be added? And I find that the
>> ItemCreationTagEditPolicy didn't do any work to ingnore some illegal
>> elements.
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 08:39:27 GMT 2024
Powered by FUDForum. Page generated in 0.02560 seconds
|