UiXML event handlers - how to define once across pages
I have a number of event handlers which will be used by several of my pages. Is there a way of including the definitions in each of those pages having only defined them once?
Cheers
Ian
The simplest approach is to override AbstractPageBroker.getEventHandler() - but
that requires that the page broker have global knowledge of all your pages.
So, what follows is a way to add a single element to any of your pages that will
add event handlers (in this case, a single handler).
It's a little less trivial than I'd assumed, but I've included here actual functional
source code to implement the whole thing. This is a very, very silly example;
it lets you add a single element to a page:
<page xmlns="http://xmlns.oracle.com/uix/controller">
<scream xmlns="http://www.example.org/scream"/>
...With this element, the "scream" event will be handled by, well, screaming.
Silly, yes; but it demonstrates the technique. Exactly the same technique
would also let you execute code immediately before and/or immediately after
a page renders (e.g., automatically register data providers). Here's the code;
it's four classes, but they're all small.
ScreamUIExtension[b]
package scream;
import oracle.cabo.ui.UIExtension;
import oracle.cabo.ui.laf.LookAndFeel;
import oracle.cabo.share.xml.ParserManager;
public class ScreamUIExtension implements UIExtension
public void registerSelf(ParserManager manager)
manager.registerExtension("http://www.example.org/scream",
new ScreamParserExtension());
public void registerSelf(LookAndFeel laf)
}[b]ScreamParserExtension
package scream;
import java.util.Dictionary;
import org.xml.sax.Attributes;
import oracle.cabo.share.xml.BaseParserExtension;
import oracle.cabo.share.xml.LeafNodeParser;
import oracle.cabo.share.xml.NodeParser;
import oracle.cabo.share.xml.ParseContext;
import oracle.cabo.servlet.ui.UINodePageDescription;
public class ScreamParserExtension extends BaseParserExtension
public NodeParser startExtensionElement(
ParseContext context,
String namespaceURI,
String localName,
Attributes attrs)
if ("scream".equals(localName))
return new LeafNodeParser()
protected Object getNodeValue(
ParseContext context,
String namespaceURI,
String localName,
Attributes attrs)
return "This doesn't matter in this example...";
return null;
public Object elementEnded(
ParseContext context,
String namespaceURI,
String localName,
Object parsed,
Dictionary attributes)
Object value = attributes.get("scream");
if (value == null)
return parsed;
if (!(parsed instanceof UINodePageDescription))
logWarning(context,
"The \"scream\" elements may only be used inside of <page>");
return parsed;
return new ScreamPageDescription((UINodePageDescription) parsed);
ScreamPageDescription
package scream;
import oracle.cabo.servlet.ui.UINodePageDescription;
import oracle.cabo.servlet.ui.UINodePageDescriptionProxy;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.event.EventHandler;
import oracle.cabo.servlet.event.TableEventHandler;
public class ScreamPageDescription extends UINodePageDescriptionProxy
public ScreamPageDescription(UINodePageDescription uinpd)
_uinpd = uinpd;
public EventHandler getEventHandler(BajaContext context)
TableEventHandler teh = new TableEventHandler();
teh.registerEventHandler("scream", new ScreamEventHandler());
teh.setDefaultEventHandler(getPageDescription().getEventHandler(context));
return teh;
protected UINodePageDescription getPageDescription()
return _uinpd;
private final UINodePageDescription _uinpd;
ScreamEventHandler
package scream;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.Page;
import oracle.cabo.servlet.event.EventHandler;
import oracle.cabo.servlet.event.EventResult;
import oracle.cabo.servlet.event.PageEvent;
public class ScreamEventHandler implements EventHandler
public EventResult handleEvent(
BajaContext context,
Page page,
PageEvent event)
System.out.println("SCREAM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return null;
}Now, to register these, you'll want a WEB-INF/uix-config.xml like so:
<configurations xmlns="http://xmlns.oracle.com/uix/config">
<application-configuration>
<ui-extensions>
<extension-class>scream.ScreamUIExtension</extension-class>
</ui-extensions>
</application-configuration>
</configurations>If you did want to add pre- or post-rendering code, just override
different methods inside your PageDescription class.
Final note: all of this should work unmodified in 9.0.2 except for
the uix-config.xml; you'd have to use the older, deprecated WEB-INF/web.xml
UIX configuration parameters in 9.0.2.
Similar Messages
-
OIM11 event handlers: How to avoid firing the same code in both pre+post
Hi everyone,
I have a question around event handlers. My experiments so far have gleaned the following:
Manual updates of user form in admin interface -> Fires: pre-insert + Post-insert
Reconciliation trusted creates -> Fires: Post-insert
Reconciliation trusted updates -> Fires: pre-insert + Post-insert
Now I have various handlers that trigger to update fields coming in from trusted recon. Formatting telephone numbers, setting custom user attributes.. etc. I am using the same code in both the post and pre handlers as wherever the update comes from it needs to be processed in the same way. Problem is if a handler fires twice I can't be sure exactly how the system is going to behave (updating the same field again etc), never mind it is unneeded processing.
We have to keep the pre handlers because otherwise changes completed via the admin interface won't be seen until you refresh.
Can anyone please advice how to go about ensuring a handler is only fired once? i.e. if pre fires don't fire post. Have I missed something key here?
Edit: I know I've worded this badly. They will always fire as that's how OIM behaves, what I want is some way to work out in the underlying code if a field has already been modified in pre process... or something like it.
Thanks,
Wayne.
Edited by: wblacklock on 27-Feb-2012 05:38I am sorry but I am not agree with your design.
However there is no chance to avoid this according to my knowledge. As both class has separate thread under different process, so there is no way to implement thread lock on entity operation.
Alternate way to acheive your requirement:
You can have hidden UDFs. Update hidden UDFs in prepost handler with some data (hardcoded).
"You can have the value this hidden filed like :- "NAME_UPDATE|EMAIL_UPDATED|MANGER_UPDATE"
Now in Post - Process handler check the value of hidden UDF.
Get the value of hidden UDF, tokenize with String Tokenizer. Check which filed is not updated in Pre handler.
*If it is already updated - do not update.* else Update.
Thanks,
Kuldeep -
How do I tab across pages in a multiple-page PDF Form?
After a couple hours trying to resolve this and researching Adobe's site and the web, I've had no luck. Was hoping someone here could help.
I've created a multi-page form in Adobe Acrobat X for Mac - It started out as a one-page form, and I then added three additional blank pages one at a time, adding the fields as needed. There are no special fields or formatting.
The problem is that each page has its own tab order which starts numbered from 1 as the first field to "x" being the number for the last field. I can tab through the fields of the page fine, but when I get to the last field on the page, instead of "Tab" moving me to the first field of the next page, it jumps back to the FIRST field on the page I am on.
I wasn't sure if I should have just created the form as one long page or if that was even an option. I did it this way because this form will need to be printed on 8.5 x 11 paper once it's filled out.
Is there a way to adjust tabs to move to the next page after filling in the last field on a page rather than just have it go back to the beginning?
There has to be a way to do this, or perhaps another way it should have been done in the first place. As you know, Adobe isn't known for its intuitive products.
Thanks in advance. After serveral hours of looking for help online, I'm stuck.
RonGot it to work. It returned a completely different path of course just to make life interesting and required a FN+OPTION ENTER in order to return the path. I now have the FLATTEN option in the edit menu.
Just trying it checking all the Flatten options except the fields seemed to work on the first pass. I'm going to try and load a copy of the original complete document. I assume that is the proper way to use this at this point since I created the form ***-backwards?
I've used Adobe layout programs since the Aldus days but Acrobat seems to work differently than any other program I've used.
If I understand what you're saying I should:
1. Design the layout of the form leaving spaces for the fields
2. Open Acrobat, import the document
3. Auto-add and correct, or manually add the fields
4. Fix tabbing
5. Add any additional comments or annotations
6. Flatten everything but the fields? (If the fields are flattened I can't fill out the form unless it's supposed to be a printed form only, right?)
Might just have to break down and RTFM. Acrobat is a really different animal. -
How to distribute subforms across pages without splitting them?
Hi, I got several subforms placed in 4 or 5 pages, what I'd like to do is to show them in a way that if a subform can't be shown in a single page (there is no chance a subform will occupy more than 1 page height) then that subform to be palced at the start of the next page, isntead of being cut and split into the previous and the next.
Do you know how to do this?.
Thanks!.Click on the subform in the hierarchy. Under Object >Subform unclick "Allow Page Breaks within Content".
-
How to remove event handlers for a content type currently in use?
Hi,
We had a SP 2007 solution that managed event handlers as described in
Brian Wilson's blog regarding event handlers. We then did a in-place upgrade to SP 2010. It so happend that we wanted to remove some of our old event handlers and this is where our problem started. We managed to delete event handlers
(SPEventReceiverDefinitions) for
Site and List by using the ui from Brian Wilsons feature "Manage Event Handlers" (ref the link above), but not anyone at all for
Content Types... It simply wouldn't be deleted
(remove was grayed out in the ui).
We then tried to do it by code. Below is a code snippet illustrating how we tried to delete the event handlers for content types:
using (SPWeb web = properties.Feature.Parent as SPWeb)
string targetClassName = "targetClassName.";
web.AllowUnsafeUpdates = true;
// Removing Content Type event handlers
foreach (SPContentType ct in web.ContentTypes)
for (int i = ct.EventReceivers.Count - 1; i >= 0; i--)
if (ct.EventReceivers[i].Class.StartsWith(targetClassName))
ct.EventReceivers[i].Delete();
ct.Update(true);
web.Update();
The Content Types are not sealed and are
not readonly. When debugging, we can see that the
Delete() method are called on one of the Content Types we wanted to delete event handlers for. We noted that the
ct.EventReceivers.Count remains the same, before and after Delete() is called. We did not get any exceptions when running this code.
When running the code a second time and debugging again, we see that the very same Content Type still has the very same event handler attached... As in, it wasn't deleted....
We also tried to delete the event handlers through PowerShell as described
here in the post by Per Jakobsen. However, the script did not really seem to find any EventReceivers... We tried to write the
$site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} | % {$_.EventReceivers} list to file, but it was empty.. We did however get a long list when writing $site.AllWebs | % {$_.Lists} | % {$_.ContentTypes} to file. We could then in
that file see the event handler references we want to remove registered to our Content Types, as we did during code debugging earlier on. So PowerShell might still be the way to go here...
So, does anyone know if there is a way to force this delete through, either by code, PowerShell or some other means? Any help regarding this matter would be very much appreciated :)Hi,
For your information, there's two versions (at least) exists for each content types. One is Site Content Type - exists in Root web and another is list content type. Once you add a content type to a list, a copy of the site content type is taken and stored
in the list. If you update the site content type, it may or may not affect the list conten type. So make sure you are updating the both - site content and list content type. Once you update site content type with passing paramater true to 'ct.Update(true)',
the list content types are supposed to updated too.
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com -
How to expose and code the event handlers of a base class?
I have created a class that inherits NumericUpDown. When I instantiate an object from that class, I can make it visible and have it appear on my form just like any other NUD. How can I get that instantiated object to expose the event handlers of its base
class, the NUD in this case, so that, for example, I can tell the client what action to take when the value of the instantiated object changes?
Thanks for your help.I am not sure exactly what you mean. Are you adding your NUD controls to the Form at design time from the toolbox or adding them in code at run time? If you are adding them to the form from the toolbox then you access the events the same way
you would a standart NUD control. If it is at runtime and you have a fixed amount of them you are going to add then you can declare them Class Scoped using the
WithEvents keyword which will let you access all their events.
Public Class Form1
Private WithEvents Nud1 As New NUD
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Controls.Add(Nud1)
End Sub
Private Sub Nud1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Nud1.ValueChanged
Me.Text = Nud1.Value.ToString
End Sub
End Class
Public Class NUD
Inherits NumericUpDown
'Your custom code to make it work how you want...
End Class
If this is not what you are doing then you may need to explain a bit more and show the code you are using so we understand better.
If you say it can`t be done then i`ll try it -
Acrobat SDK: How to get events and write event handlers in c#
I am trying out to get events from a pdf doc and handle it in my c# code with the samples that come with Acrobat-SDK.
I am yet to understand how I can do it. I am yet to discover the class that provides me the events. All the classes currently expose methods only. It might be that I am missing something for sure.
Can somebody help?
My use case is:
the user will open a pdf doc and my application (or my app can trigger opening the pdf doc)
when the user selects some text from the pdf doc, my app should get the event
My event can handle the selection and get the selected text.
Put a bookmark on the selection in the pdf doc (with additional attributes)
the pdf doc retains such bookmarks when the pdf is saved.
bookmarks in the pdf should be available for edit.
A different app/code should be able to parse and retrieve these bookmarks along with the additional attributes of the bookmark.
I hope, I have not asked too much.There are no “event handlers” for C# in the Acrobat SDK. You will have to “poll” for things such as selected text.
Also, I don’t know what sort of “additional attributes” you are thinking about, but that may or may not be possible from C#. -
How to define custom event and how to trigger the defined event
hi,guys
hurry issue....................hope get help.
I am using oracle weblogic 10gr3 portal.and we choiced java portlet.as of now,we got some question about custom Event.hope you can give some idea....
thank you so much.
question detail:
1.for java portlet ,how to define custom event.
2.how to trigger this event.
3 about the data,may be sometime need to transit Biz data.
auctully,I just want to implements between two portlets communicate.
for example:
existing portletA,portletB.
portletA is a list,like:
A AA <button>
after I click this buttom,then portletB will be effect,it means they are interact with each other.
does anybody hit this issue before,if you solved pls share me .
thank you for you help....Hello,
Please note that everything below applies to JSR168 portlets ONLY- JSR286 portlets and other portlet types handle events a little differently.
From inside your JSR168 portlet you can send an event during processAction or when receiving another event by using the PortletBackingContext object, such as:
import javax.portlet.ActionResponse;
import javax.portlet.ActionRequest;
import javax.servlet.http.HttpServletRequest;
import com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext;
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
HttpServletRequest httpRequest = (HttpServletRequest) actionRequest.getAttribute("javax.servlet.request");
PortletBackingContext portletBackingContext = PortletBackingContext.getPortletBackingContext(httpRequest);
portletBackingContext.fireCustomEvent("customEvent", "This is a custom event");
To receive an event, in your .portlet file you just need to put in a "handleCustomEvent" tag specifying which method to call when the event is received, such as:
<?xml version="1.0" encoding="UTF-8"?>
<portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
<netuix:javaPortlet title="Listening Portlet" definitionLabel="yourPortletName">
<netuix:handleCustomEvent event="customEvent" eventLabel="customEvent" filterable="true" description="custom event handler">
<netuix:invokeJavaPortletMethod method="processCustomEvent"/>
</netuix:handleCustomEvent>
</netuix:javaPortlet>
</portal:root>
Then, in your receiving portlet the method "processCustomEvent" would receive the event, such as:
public void processCustomEvent(ActionRequest actionRequest, ActionResponse actionResponse, Event event)
The event payload can be any Serializable object you want, but for forward-compatibility with JSR286 it would be ideal if it had a valid JAXB binding.
Kevin -
Revision: 10446
Author: [email protected]
Date: 2009-09-20 19:09:35 -0700 (Sun, 20 Sep 2009)
Log Message:
Event handlers defined in MXML can no longer be only two slashes.
Modified Paths:
flex/sdk/trunk/samples/explorer/explorer.mxml
flex/sdk/trunk/samples/ja_JP/explorer/explorer.mxmlRemember that Arch Arm is a different distribution, but we try to bend the rules and provide limited support for them. This may or may not be unique to Arch Arm, so you might try asking on their forums as well.
-
How to Deploy the Event Handlers OIM 11g
Hi
I have developed the code for post process event handler using OIM 11 G API. The OIM not invoking the EventHandlers while updating the users attribute or creating the users attribute.
I have done the following task to develop and deploy the OIM 11g Event handlers. They are
1) Implementing the PostProcessHandler interface and provide the implementation of execute method.
Sample Class
public class SamplePostProcessEventHandler implements PostProcessHandler {
private Logger logger=Logger.getLogger("TEST-LOGGER");
public SfsuPostProcessEventHandler()
logger.debug("Invoking Event Handler Plugin");
@Override
public boolean cancel(long arg0, long arg1,
AbstractGenericOrchestration arg2) {
// TODO Auto-generated method stub
return false;
@Override
public void compensate(long arg0, long arg1,
AbstractGenericOrchestration arg2) {
// TODO Auto-generated method stub
@Override
public EventResult execute(long processid, long eventid, Orchestration orchestration) {
// TODO Auto-generated method stub
logger.debug("Operation "+orchestration.getOperation());
logger.debug("Parameters "+orchestration.getInterEventData());
logger.debug("Parameters "+orchestration.getParameters());
EventResult result=new EventResult();
return result;
@Override
public BulkEventResult execute(long arg0, long arg1, BulkOrchestration arg2) {
// TODO Auto-generated method stub
return null;
@Override
public void initialize(HashMap<String, String> arg0) {
// TODO Auto-generated method stub
2) Create the Jar File SamplePostProcessEventHandler.jar
3) Create the Plugin.xml file
Sample File
<?xml version="1.0" encoding="UTF-8"?>
<oimplugins>
<plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
<plugin pluginclass="test.eventhandlers.SamplePostProcessEventHandler" version="1.0" name="SamplePostProcessEventHandler">
</plugin>
</plugins>
</oimplugins>
4) Create the directory lib and copy the SamplePostProcessEventHandler.jar file into this directory
5) Creating the Zip file with the following directory structure.
plugin.xml
lib/SamplePostProcessEventHandler.jar
6) Register the plugin
ant -f pluginregistration.xml register
7) Creating the Custom Events xml file called EventHandlers.xml
<?xml version='1.0' encoding='UTF-8'?>
<eventhandlers>
<action-handler class="test.eventhandlers.SamplePostProcessEventHandler" entity-type="User" operation="CREATE" name="SamplePostProcessEventHandler" stage="postprocess" order="LAST" sync="TRUE"/>
<action-handler class="test.eventhandlers.SamplePostProcessEventHandler" entity-type="User" operation="MODIFY" name="SamplePostProcessEventHandler" stage="postprocess" order="LAST" sync="TRUE"/>
</eventhandlers>
8) Importing the Above XML into the MDS Schema Using the weblogicImportMetadata.sh file
Directory Structure of the Event Handler Schema File
/home/oracle/eventhandler/db/EventHandlers.xml
weblogic.properties file parameters
wls_servername=oim_server1
application_name=oim
metadata_from_loc=/home/oracle/eventhandler
9) Finnally Running the PurgeCache.sh All
10) Restarted the OIM Server.
11) Testing
I have logged into the OIM Admin Console >> Search the User > Update the First Name. The event handlers are not invoked any create or update operation. I am not able to see the log entries into the log file.
My Log Entry Configuration.
log File Configuration :
/u01/app/wl-10.3.5.0/Oracle/Middleware/user_projects/domains/oim_domain/config/fmwconfig/servers/oim_server1/logging.xml
<log_handler name='test-handler' level='FINEST' class='oracle.core.ojdl.logging.ODLHandlerFactory'>
<property name='logreader:' value='off'/>
<property name='path' value='/u01/app/wl-10.3.5.0/Oracle/Middleware/user_projects/domains/oim_domain/servers/oim_server1/logs/test-event.log'/>
<property name='format' value='ODL-Text'/>
<property name='useThreadName' value='true'/>
<property name='locale' value='en'/>
<property name='maxFileSize' value='5242880'/>
<property name='maxLogSize' value='52428800'/>
<property name='encoding' value='UTF-8'/>
<logger name="TEST-LOGGER" level="FINEST" useParentHandlers="false">
<handler name="test-handler"/>
<handler name="console-handler"/>
</logger>
Is there anything is missing while deploying the event handlers.
Help is Greatly appreciated.Change as per the following :
1. Put the event hander in the /home/oracle/eventhandler /metadata/metadata directory and
2. Change the following in the weblogic properties
application_name=OIMMetadata
metadata_from_loc to =/home/oracle/eventhandler/metadata
This will work. -
How to expose event handlers of the TextBox in a NumericUpDown?
The NumericUpDown control contains a TextBox object that I have exposed by creating a class that inherits from NUD and references the TextBox as the second control in the Base class, like this:
Public Class clsNumericUpDownExt
Inherits NumericUpDown
Private TheTextBox As TextBox = MyBase.Controls(1)
Event NewLeave()
Public ReadOnly Property TextBox As TextBox
Get
Return TheTextBox
End Get
End Property
End Class
In the form, I instantiate an object from this class and display it in a tab control on the form, like this:
Public WithEvents dynNudTime As clsNumericUpDownExt = New clsNumericUpDownExt
'In the form's Load event:
Dim loc As System.Drawing.Point = New System.Drawing.Point(177, 19)
Dim fnt As System.Drawing.Font = New System.Drawing.Font("Microsoft Sans Serif", 30)
tabTimer.Controls.Add(dynNudTime)
With dynNudTime
.Width = 240
.Location = loc
.Font = fnt
.Maximum = 86399
.Visible = True
End With
Since it was declared WithEvents, I can see the event handlers of the NUD base class of the object in the form, so I can code an action for, let's say, the ValueChanged event. Is there a way to see the event handlers of the TextBox, so that I can code an
action for, say, the TextChanged event?
Thanks!Well, you could add a public event to the NUD class and raise the event when the text of the textbox is changed. You would need to do this for each event you want to handle from the textbox.
In this example i added a custom event that will pass the NUD control as the sender and the Text as the 2nd argument.
Public Class Form1
Private WithEvents nud As New clsNumericUpDownExt
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Controls.Add(nud)
End Sub
Private Sub nud_TBoxTextChanged(ByVal sender As Object, ByVal TheText As String) Handles nud.TBoxTextChanged
Me.Text = TheText
End Sub
End Class
Public Class clsNumericUpDownExt
Inherits NumericUpDown
Public Event TBoxTextChanged(ByVal sender As Object, ByVal TheText As String)
Private WithEvents TheTextBox As TextBox = CType(MyBase.Controls(1), Windows.Forms.TextBox)
Private Sub TheTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TheTextBox.TextChanged
RaiseEvent TBoxTextChanged(Me, TheTextBox.Text)
End Sub
End Class
If you say it can`t be done then i`ll try it -
Sugg on how to define load time -specific time instance across GEO location
Hi Good Morning,
How to define the loading instance of time with respect to different Geographic Loacations. If we consider daily load how would time difference play a role here, bcos all business in different regions will not close if we consider to load based on one regions time. so can any body help me out how to define that time of loading and basing all Geographic regions into consideration or what is the best way to take it up.
Thanksin Advance
- VenkatHi Venkat,
What are the Geo's that you are considering?
Things to keep in mind while deciding the load times & the no. of times your Process Chains have to run:
1. Find out which are the most important/ critical process chains which the Business requires.
2. Find out their respective load times (how long does it take to finish executing completely)
3. APAC Region is always the first to start working. So, better would be that you schedule your chains by say 20GMT or a little earlier for this region.
4. EMEA region is the next. For this you can have your chains scheduled for 3 or 4 GMT.
5. US region - schedule the chains for 10 GMT or so.
6. Have different variants scheduled at different times & include your process chains in hose variants.
These are just general views. It will vary from case to case.
Hope this helps.
Regards
Vishal -
The register statement in preregister/Postregister clause is especially useful for including named event handlers in the event loop.
I think you need to read the doc. before asking the questions:
http://docs.iplanet.com/docs/manuals/uds/50/toolref.pdf
page 151-161
ka -
Problems with .chart-plot-background and event handlers
Hello. I'm trying to add event handlers to my chart so that the user can be allowed click within the chart itself to perform certain actions like dragging, zooming, etc. To avoid having to deal with handling mouse clicks that lie outside the chart itself (for example on the axes), I've found that:
.chart-plot-background
is the Region that gives me the entire chart and nothing else. However, when I attach mouse listeners to this Region, the event is only registered on half of the cells in the chart. If you've seen the default JavaFX Chart background layout, you know that it contains alternating rows of cells with slightly different coloring. I've found that only the rows with the lightest gray coloring actually register a mouse click on them, which makes me believe the dark grey cells are not part of the .chart-plot-background, but something else on top.
To me, this feels like an oversight in how the regions of the chart are defined. Why can I not get a listener to work on the whole chart and nothing else? Currently the only workaround seems to be to take the Region:
.chart-content
instead, and compute the difference between this region and the .chart-plot-background in order to manually suppress mouse clicks that lie outside .chart-plot-background.
Anyone have suggestions? Is this worth issuing on the JavaFX Jira?Hello,
I'm not an expert on controls, but here is my guess based on your description: when you register an event handler on a "background" node, it is called only when the mouse hovers over the background node - I suppose the light gray is the background with the light gray cells being transparent and dark grey cells being filled. So the behavior seems correct - you can't expect the events to be delivered to background when it is covered by other nodes. I think you really should register the handler on the entire chart and filter out the events you don't want to handle. This however should not require much of computing the difference between the regions, it should be possible to do just something like
if (!background.contains(event.getX(), event.getY())) {
return;
Provided that the background doesn't reach under the axes as well. Note that if there are any different transforms between the background and the node with the handler registered on it, you may need to recompute the coordinates by
background.sceneToLocal(event.getSceneX(), event.getSceneY());
And use the contains method on that. -
Event Handlers and Callbacks: Best way to handle?
I'm writing an actionscript class. I'm wondering how to deal
with call backs and event handlers within my class. In particular,
I'm wondering how I might structure my class so that developers
using it can choose which arguments get passed to the callback
function as they code. I've been googling and haven't found any
particularly useful information on this.
As far as I can tell, it would appear that the parameters
passed to any callback function are determined at the time I write
my class as this anonymous function example illustrates.
var myObj:Object = new MyClass('foo', 'bar');
myObj.onLoad = function(arg) {
// the args passed to this anonymous function are dictated
by the actionscript defnining MyClass
I have also seen an approach using named functions and a
class method for setting the event handler which allows a developer
to pass some object to be used for scoping the named function but
this also results in the parameters for the callback being
predetermined by the actionscript that defines the class
function myLoad(arg) {
// the args passed to this function are also dictated by the
actionscript defining MyClass
var myObj:Object = new MyClass('foo', 'bar');
myObj.setOnLoadHandler(this, 'myLoad');
As far as I can tell, neither approach would let a developer
specify any parameters for the callback functions (onLoad() in the
first example, myLoad() in the second example). Which of these
approaches is considered 'best practice'? Also, what would I do if
I wanted to specify that the callback should operate on a
particular movieclip on my timeline? How can I pass that
movieclip's parameter to the callback function?You can download the Library from this link. Inside is an example that shows how to handle windows messages/events.
http://zone.ni.com/devzone/cda/epd/p/id/4394
Maybe you are looking for
-
6.0.2/6.0.3 Crashing when playing any audio file.
Hi Folks, I've had this problem since 6.0.2 and upgraded to 6.0.3 last night hoping it would fix the issue but it hasn't. Whenever I try to play a song in my library or playlists iTunes unexpectedly quits. I have tried deleteing all preferences. Remo
-
Confuse wat to do...
m.. using nokia 701.... and in that left ringer is not working.... i wan't to repiar it but most of the people saying that nokia t-mobile once repair will go on creating a new problm in that.... so plz sugest me as soon as possilble wat shud i do....
-
Integrate Adobe Flex and JBOSS using BlazeDS
I using this link http://simplyolaf.blogspot.com/2009/07/integrate-adobe-flex-and-jboss-using.html to create Flex Project for Blaze DS. I added the following arguments to the flex compiler: -services "F:/java_WS/iASCUE/WebContent/WEB-INF/flex/service
-
I want to set up my friends P3/550 MHz pc to dual boot Win98 and Arch Linux. How would I set it up so that he could read and compose the same email in both systems?
-
Change click behavior BAL_DSP_LOG_DISPLAY
Hello! I have an requirement that is calling FB03 from a double click on an aplication log. I'm using FM BAL_DSP_LOG_DISPLAY to show the required logs. So far so good. The problem is changing the default behavior on the double click of a message (sho