Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Sapphire Events(Defining Sappire Events)
Sapphire Events [message #726485] Sun, 18 September 2011 09:11 Go to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
Using Sapphire 0.3.x

I am have defined a action and handler as follows,


    <action>
            <id>Define.Event</id>
            <label>Define Event1</label>
            <hint>
                <name>style</name>
                <value>image+text</value>
            </hint>
            <context>Sapphire.ActionLink</context>
        </action>
        <action-handler>
            <action>Define.Event</action>
            <id>Define.Event</id>
            <impl>DefinePortletEventHandler</impl>
        </action-handler>


The class DefinePortletEventHandler extends from SapphireActionHandler

Now in part and under a section I am trying to add an Action Link with action-id as the above mentioned action as follows,

....
<section>
  <content>
    <label>Define Event1</label>
    <action-handler-id>Define.Event</action-handler-id>
     <action-link>
   </content>
  </section>
....


But i don't see the Action link being enabled Sad, not sure what is the reason. Can anyone help me why is that not enabled. Ideally my requirement was to have this action associated only with ActionLink i define and not for all by default.

I am having similar problem adding an action to beside the List, after Moveup button in-spite of me adding Sapphire.ListPropertyEditor to the action context and providing the after location hint as after:Sapphire.Move.Down

I searched through the samples and didn't happen to find one example demonstrating this.

~Kamesh

[Updated on: Sun, 18 September 2011 14:47]

Report message to a moderator

Re: Sapphire Events [message #726535 is a reply to message #726485] Sun, 18 September 2011 14:59 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
It looks like your snippet that shows action-link usage got garbled. Could you try posting it again? To have the action/handler be scoped only to the link, you'd put their definitions inside the action-link element.

> I am having similar problem adding an action to beside the List, after
> Moveup button in-spite of me adding Sapphire.ListPropertyEditor to the
> action context and providing the after location hint as after:Sapphire.Move.Down

Please post that as a separate question with code example showing what you've tried as I cannot figure out what might be the problem based on this description alone. Note that the gallery sample includes examples of something similar (under Actions -> List Property Editor).
Re: Sapphire Events [message #726539 is a reply to message #726535] Sun, 18 September 2011 15:04 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
here is my complete definition

<action>
			<id>Liferay.Create.Portlet</id>
			<label>Create new Portlet</label>
			<description>this will call the Liferay IDE New Portlet Wizard Page
			</description>
			<image>/icons/n16/portlet_new.png</image>
			<hint>
				<name>style</name>
				<value>image</value>
			</hint>
			<context>Sapphire.ActionLink</context>
		</action>
		<action-handler>
			<action>Liferay.Create.Portlet</action>
			<id>Liferay.Create.Portlet</id>
			<label>Create a new Portlet</label>
			<impl>CreatePortletActionHandler</impl>
		</action-handler>
		<action>
			<id>Define.Event</id>
			<hint>
				<name>style</name>
				<value>image+text</value>
			</hint>
			<label>Define Event</label>
			<context>Sapphire.ActionLink</context>
		</action>
		<action-handler>
			<action>Define.Event</action>
			<id>Define.Event</id>
			<impl>DefinePortletEventHandler</impl>
		</action-handler>



These are the two events I am trying to wire to ActionLink using the following statements

<section>
					<label>Quick Actions</label>
					<content>
						<action-link>
							<label>Add New Portlet</label>
							<show-image></show-image>
							<action-id>Liferay.Create.Portlet</action-id>
						</action-link>
						<action-link>
							<label>Define Event</label>
							<action-id>Define.Event</action-id>
							<show-image></show-image>
						</action-link>
					</content>
				</section>
Re: Sapphire Events [message #726542 is a reply to message #726539] Sun, 18 September 2011 15:10 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
The action link looks for referenced action id in self and then recursively in it's parent part. You haven't specified where you've defined your actions and handlers, but my guess is that they aren't on the direct or indirect parent of the action-link.

- Konstantin
Re: Sapphire Events [message #726543 is a reply to message #726539] Sun, 18 September 2011 15:11 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
To make the job much simpler and rely on Sapphire handlers and actions i event tried this
<section>
					<label>Quick Actions</label>
					<content>
						<action-link>
							<action-id>Sapphire.Add</action-id>
							<action-handler-id>Sapphire.Add.IPortlet</action-handler-id>
							<label>Add a new Portlet</label>
						</action-link>
						<action-link>
							<action-id>Sapphire.Add</action-id>
							<action-handler-id>Sapphire.Add.IEventDefinition</action-handler-id>
							<label>Add a new Event</label>
						</action-link>
					</content>
				</section>


Without defining my own actions but still i see them disabled Sad
Re: Sapphire Events [message #726545 is a reply to message #726543] Sun, 18 September 2011 15:18 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
You must not be in the context of those actions. The action-link will need to be in a part beneath the node part that allows you to add IPortlet/IEventDefinition. Compare what you are doing to the samples.

- Konstantin
Re: Sapphire Events [message #726548 is a reply to message #726545] Sun, 18 September 2011 15:31 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
yeah i have defined these action-links under PortletApp which is the root element and allows addition of IPortlet and IEventDefintion under it.

not sure i have explained you clearly ? Let me know otherwise.
Re: Sapphire Events [message #726558 is a reply to message #726548] Sun, 18 September 2011 16:29 Go to previous message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
Based on your last post, I am not sure if you've got it to work or not... If comparing with samples does not help to sort this out, please post enough of sdef to show the relationship between where actions links are and the part that owns these actions.

- Konstantin
Previous Topic:Implied Properties
Next Topic:Adjusting Widths of Property Editors
Goto Forum:
  


Current Time: Tue Sep 02 21:23:24 GMT 2014

Powered by FUDForum. Page generated in 0.02007 seconds