I had a large dialog that I wanted to be able to move out of the way so that I could see what was behind it without closing it. Normally any part of the dialog cannot be dragged off the edge of the browser window. Configuring this turned out to be pretty simple. Just add an inline style for the margin and give negative numbers to the sides you want to drag off the edge of the screen. In the example below I don't want the top to be draggable past the top edge (because the top bar wouldn't be visible to drag it back down) The left and right I set to -200 so that I could drag it 200 pixels to the left or right of the windows edge and 300 pixels past the bottom of the window. This allows me to move it mostly out of the way without having to close it.
I modified this slightly in that my particular page didn't need to save the original onMouseMove and onMouseUp handlers.
To wire this up add a client listener to the popup <af:clientListener type="popupOpened" method="popupOpened"/>
// This method attaches the frame with id of "fid" to the mouse event handler
var frame = document.getElementById( e.getSource().findComponent("fid").getClientId()+'::f');
// iframe causes the page to lose the mouse events when dragging the dialog
// this fixes it by propagating mouse events in the iframe to the parent page
iframe.contentWindow.onmousemove = propagateToParent;
iframe.contentWindow.onmouseup = propagateToParent;
// Create a new event for the this window
var evt = document.createEvent("MouseEvents");
// We'll need this to offset the mouse move appropriately
var boundingClientRect = iframe.getBoundingClientRect();
// Initialize the event, copying exiting event values
// for the most part
true, // bubbles
false, // not cancelable
e.clientX + boundingClientRect.left,
e.clientY + boundingClientRect.top,
null // no related element
// Dispatch the mousemove event on the iframe element
I recently was tasked with creating a generic preferences table that can be used to story any type of web site preference. This needed to be generic enough so that new types of preferences can be added without requiring a data model change. Using XML in the value column was the perfect solution for this.
This is how the table is defined
CREATE TABLE "USER_PREFERENCE"
"USER_PREFERENCE_ID" NUMBER(38,0) NOT NULL ENABLE,
"USER_ID" NUMBER(38,0) NOT NULL ENABLE,
"PREFERENCE" VARCHAR2(40 BYTE) NOT NULL ENABLE,
"VALUE" VARCHAR2(4000 BYTE) NOT NULL ENABLE
The first type of preference I needed to add was a URL link. I defined this in XML
I insert this xml into the value column and "CUSTOMLINK" into the preference column along with the USER_ID and primary key USER_PREFERENCE_ID sequence.
Here is the query I used to retrieve my custom url links. Notice that I'm not actually returning any column from the table. All of the columns returned are coming from the xml nodes in the value column. This query uses a feature of Oracle available since 10.2 (XMLTABLE). You can think of it as a table within a column that the row is being joined to. "url "is the alias for this table containing all of the xml elements as table columns.
FROM USER_PREFERENCE ,
-- XMLTable defines a join with contents of value column treating it like a table
label VARCHAR2(40) PATH 'label',
location VARCHAR2(1025) PATH 'location',
open VARCHAR2(40) PATH 'open',
sortorder VARCHAR2(4) PATH 'sortorder',
permission VARCHAR2(40) PATH 'permission'
) as url
WHERE PREFERENCE = 'CUSTOMLINK'
AND USER_ID = :UserIdBind
order by sortorder
I used a read only view object for this. I could have created a entity based view object and use expert mode to insert similar sql. For storing and committing data in the value column I would need to add custom code to the setters for the 4 xml based columns and there construct the xml containing the values from all of these columns and then set that xml into the value column.
This gives me great flexibility for adding additional columns to my query without making any changes to the data model. Querying XML will probably not perform well if you have a huge result sets but is a great solution for queries that return a small number of rows as this one does.
ADF Release 1 of jdeveloper has limited support for hot deploying java code. When running the integrated Weblogic server in debug mode, JSPX/JSFF files will hot deploy as soon as you save and reload the page. You are also allowed to make changes to java methods as long as you don't change the structure of the class. This means you can't add or remove methods, change method signatures or add or remove class properties or static members but you can change the code inside a method and instantly deploy the change while the server is running. To do this hit CTRL+SHFT+F9 key combination. This will compile and deploy the single java class that has been changed. If it is successful you will see the message "Redefined all recompiled classes that are loaded
in the debuggee process.”
For a long time I had been using CTRL+F9 which performs a full build and hot deploy of the application. Our application is very large and this would take over a minute to complete but CTRL+SHFT+F9 will hot deploy a single file in about 1 second. I don't know why this key combination is not front and center on the build menu (since CTRL+F9 is). It is listed in the context menu that displays when you right click on a Page. (see image) but I never noticed that the "Make" on the context menu was different than the "Make" on the Build menu so didn't pay attention to the hot keys listed. It is a huge time saver but the only way to learn that this is a "single file" make command is to browse the Tools Menu (Preferences/Shortcut Keys) to find it. CTRL+SHFT+F9 is now my most favorite keystroke.
The stragg database function is useful for converting a subquery returning multiple rows into a single column containing a comma separated list of values.
I often use this function to display one of the columns in a row of data. I recently had to format this so that each stragged item in the list displayed on it's own line.
is the technique I used
The example subquery below will return a comma separated list of labels for a customer. I'm only showing this one column selected for brevity but this would be one of many in the select clause.
The code in red was added to append a line feed character "chr(10)" to the beginning of each element in the list. The substr(val,2) removes it
from the 1st element so that it doesn’t begin with a line feed.
(SELECT substr(stragg(chr(10) || label ),2)
WHERE customer_label.account_id = account.account_id
Line feed characters are normally ignored in html but you
can force them to be honored by applying a style of “white-space: pre-line”
add a style of pre to your output text within your table column