Swing Dynamics Table binding
I'm having problems to create a dynamic array binding.What I'm trying to do is actually a table with columns that are dynamic, based on a ViewObject created dynamically (created during execution).
The method below belongs to the AppModuleImpl class.
/* Of course hardcoded strings will be removed */
public ViewObject createViewObj() {
String voInstanceNm = "VOInstanceName";
String sql = "SELECT ROWNUM, GRU_CD_GRP, GRU_NM_GRP FROM ADM_GRUPOS";
String[][] props = {{"ROWNUM", "LABEL", "Name1Label"},
{"GRU_CD_GRP", "LABEL", "Name1Labe2"},
{"GRU_NM_GRP", "LABEL", "Name1Labe3"}};
ViewObject vo = createViewObjectFromQueryStmt(voInstanceNm,sql);
for (int i = 0; i < props.length; i++) {
String attNm = props[0];
String propNm = props[i][1];
String propVal = props[i][2];
AttributeDefImpl attDef = (AttributeDefImpl)vo.findAttributeDef(attNm);
attDef.setProperty(propNm, propVal);
}
return vo;
}
This is working, I can iterate through fetched rows after a executeQuery() call.
The exception (NPE) occurs in the fragment below, when I try to create a JUTableBinding:
/* this fragment is in the jbinit() method */
DynaVOImpl am = (DynaVOImpl)Configuration.createRootApplicationModule("pack.DynaVO", "DynaVOLocal");
ViewObject vo = am.createViewObj();
RowSetIterator rsi = vo.createRowSetIterator("RowSetIter");
DCDataControl dc = panelBinding.findDataControl("DynaVODataControl"); //I didn't know how to get a reference to the DynaVODataControl, so I've dragged a rollback operation from the DynaVODataControl
JUIteratorBinding juib = new JUIteratorBinding(dc, rsi);
String[] attribs = {"GRU_CD_GRP","GRU_NM_GRP"};
JUTableBinding tb = new JUTableBinding(dynaTable, juib, attribs); //<<<<the exception is thrown
dynaTable.setModel(tb.getModel());
The exception StackTrace:
java.lang.NullPointerException
at oracle.jbo.uicli.jui.JUTableBinding.getModelImpl(JUTableBinding.java:529)
at oracle.jbo.uicli.jui.JUTableBinding.setControl(JUTableBinding.java:395)
to oracle.jbo.uicli.jui.JUTableBinding. < init > (JUTableBinding.java:381)
to oracle.jbo.uicli.jui.JUTableBinding. < init > (JUTableBinding.java:373)
to the view. Form.jbInit (Form.java:103)
to the view. Form.setBindingContext (Form.java:191)
to the view. Form.main (Form.Java:244)
The columns are created with the right label, but the exception is thrown and it shows no line...
Any suggestion?
Kind regards
Gustavo
Discover the static methods of the JUTableBinding.createAttributeListBinding ().
The binding needs a JUPanelBinding, you do not provide one. This is whence the NPE.
The iterator binding is also created by the static method.
Sascha
Tags: Java
Similar Questions
-
Table binding error ORA-01485 when I try to get in an associative array
Hello
I test to pass in an array associative odp.net
So I created a simple testpackage:
CREATE TABLE jwetesttab (CLIENTNR NUMBER (10) NOT NULL);
CREATE OR REPLACE PACKAGE IN THE JWETEST_PK
TYPE t_CLIENTNRS IS TABLE OF NUMBER INDEX OF PLS_INTEGER;
PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted OUT NUMBER);
END JWETEST_PK;
/
CREATE OR REPLACE PACKAGE BODY JWETEST_PK AS
PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted ON the NUMBER)
IS
BEGIN
FORALL i IN p_CLIENTNRS.first... p_CLIENTNRS. Last
INSERT INTO jwetesttab (CLIENTNR) VALUES (p_CLIENTNRS (i));
p_NbOfRowsInserted: = SQL % ROWCOUNT;
COMMIT;
END TestArrayIn;
end JWETEST_PK;
/
Then I did as simple testapp as follows:
Protected Int As Integer = 0
Dim arrNums() As Integer = {1, 2, 3}
Dim cmd As New OracleCommand
Dim cnn as new OracleConnection (s_conn)
Try
With cmd
. ArrayBindCount = 3
. Connection = cnn
. CommandText = "JWETEST_PK. TestArrayIn ".
. CommandType = CommandType.StoredProcedure
Var p_Clientnrs As OracleParameter = New OracleParameter
With p_Clientnrs
. ParameterName = "p_CLIENTNRS."
. DbType = DbType.Int32
. CollectionType = OracleCollectionType.PLSQLAssociativeArray
. Value = arrNums
. Size = 3
Ends with
. Parameters.Add (p_Clientnrs)
. Parameters.Add (New OracleParameter ("p_NbOfRowsInserted", OracleDbType.Int32, ParameterDirection.Output))
CNN. Open()
cmd ExecuteNonQuery()).
Int = CInt (.) Parameters ("p_NbOfRowsInserted"). Value)
Ends with
Catch ex As Exception
MsgBox (ex.) Message)
Finally
If (cnn IsNot Nothing) = False Then
CNN. Close()
CNN. Dispose()
End If
End Try
When I run my testapp, the lines are inseterd in the database, but it gives me an error: link table error: ORA-01485 Liaison of the table and the associative arrays are two different functions and tend to confuse because they both have the word Array in them.
The table binding is for "run this procedure and statement number X times, all the data here is at the front. ''
Associative array is to "perform this procedure once, here is the table I want to that you pass in.
Start by removing ArrayBindCount = 3and see if that helps
If you still have problems, see the example of associative array on your hard disk to %OH%\ODP.NET\samples\2.x\AssocArray
It will be useful,
Greg
-
For Timo: Dynamically create pivot table binding
Hi Timo,
Long time ago you have this announcement on a thread:
"The solution for your use a 2013 DOAG case, I presented was to create binding table pivot out user defined attributes in the table."
For the defined attributes, VO is created dynamically and the pivot link.
The pivot link is exchanged during execution as well as the activation of the adequate VO Dynamics to get only the
necessary data for the pivot table in particular.
......
I can't give you a working example because it is too complex. I can make available slides, but they are in German. "
We have the same problem.
Can you please send me this presentation on: email address removed by the moderator - there is no private through this public forum consultation >
I can't find this Presentation on the Internet.
Maybe, if you have some examples of simple work, too.
Kind regards
Diana
Diana, you can get the DOAG2013_DynamicPivotTable_virtual7 blades | JDev & ADF Goodies
The sample is too complex to be made available through my blog.
Timo
-
Table binding Row UI component
Hi all
Jdev Version: 11.1.1.7.1
I have a requirement where in on a table, I have a selectOneChoice as the first column and an inputText as the second. The inputText must reset the basis of the selection on the first column.
The "Advanced" section properties inspector, I added a link to my bean. I have a selectionListener where I get this link and call resetValue() to reset. But this only works for the first row.
Is there a way by which we can get to the UI on the SelectionListener inputText component?
Thank you
If the value of the ID of the table to single selection, you should get enter text through the link layer.
If you have not already available binding you can drag the attribute of the vo on the page that will create the binding. Then switch to source mode and remove the inject that will be created with the binding. The link is not removed in this way.
Once you have the link you can get the selection listener binding and reset the value.
Timo
-
bind an outputFormatter a table binding
I have a page with a table that is bound to a data control. I would like to display a value of a particular column when the row is selected in an outputformatter under the table component.
< table >
< id col = "1" / >
< id col = "2" / >
< table >
< outputformatter bind = column with the id of 1 >
Is it achievable?
Please excuse the pseudocode fast but I hope you get the idea. Hello
Once after you set the value to outputFormatted, you must refresh the component by setting the property partialTriggers to the id of the table.
It can also be done without programming, if you have defined the simple rowSelection property and selectionListener with the default (selectionListener = "#{bindings..") collectionModel.makeCurrent}').
Try this:
-Make sure that you set the single rowSelection property and selectionListener to "#{bindings..» collectionModel.makeCurrent}
-Drag and drop the attribute you want to display in the outputFormatter of the data control palette
-Set the af partialTriggers: outputFormatted tag to the id of the table
Example Code:
{code}
..
{code}
Jean Lou
-
jDeveloper 10.1.3. I have a webservice that returns a username and a view ADF object that queries the user returned by the Web service ID results. I want to see the results and build a session to create a dynamic menu item. I dropped the binding of data control in the page login.jspx and then deleted the code for the jspx manually page (to keep the links). How can I now use these links in support bean and PrintOut the table with just System.out.println results so that I can check the values?
Hello
depends on the link you have. If its a link attribute in which the value of WS is written for then
FacesContext fctx = FacesContext.getCurrentInstance();
Application app = fctx.getApplication();
DCBindingContainer bindings = (DCBindingContainer ) app.createValueBinding("#{bindings}").getValue(fctx);
JUCtrlAttrsBinding attribute = (JUCtrlAttrsBinding ) bindings.get("attribute_binding_name");
String user = attribute.getInputValue();
Note that this code assumes that the WS is already running
Frank
-
Hi, Philip
I am trying to use the piece of code you provide earlier for this topic 'it' collection means for properties comes empty. Any thoughts?
Sincerely
Alek
Hi, Philip
I realized what was wrong. Entity and Table have own independent series of dynamic properties. I don't know if this was the intended behavior, however. However, in this edition script works fine for me:
---------------------------
DDL = "-generate the output file for"+ table.getLongName ();.
ddlStatementsList.add (new java.lang.String (ddl));
path = model.getDesign () .designPath;
outFile = new java.io.FileWriter (path + "/ exit /" + table.getLongName () + ".txt");
out = new java.io.PrintWriter (outFile);
out. Print (DDL);
out.println ();
It = table.getPropertyNames ();
{while (IT.hasNext ())}
PName = it.next ();
property = table.getProperty (pname);
out. Print (pname + "=" + property);
out.println ();
}
out. Close();
---------------------------
Thank you and sorry for the confusion.
Alek
-
Results of the dynamics - table 2 columns?
I have a dynamic table:
< table width = '500' border = "1" cellpadding = "10" cellspacing = "10" >
<? PHP {? >}
< b >
< td > < p > <? PHP echo $row_babiesrs ['name'];? > < / p > < table >
< /tr >
<? PHP} while ($row_babiesrs = mysql_fetch_assoc ($babiesrs));? >
< /table >
The display results to the bottom of the page in a table column that is
1
2
3
4
5
6
Can someone tell me if there is a way to get results using dreamweaver to display in the form of a table with 2 columns, i.e.
1 2
3 4
4 W
TIA
No, nothing in DW to handle this. It is easy to fix by adding another loop. Or search using the horizontal extension of the Looper.
-
ADF <; Dynamics: table >; component
Information / guide on how to use the dynamic jsf component: table adf? Research in the developer's guide provides no info at all.
See you soon Some blogs:
http://jdeveloperandadf.blogspot.com/2011/01/ADF-faces-dynamic-tags-for-form-that.html
and http://blogs.oracle.com/shay/2010/10/adf_faces_dynamic_tags_-for a.html
Timo
-
How to migrate to JUTableBinding of BC4J 9.0.4.3 to 10.1.2?
Hello
I'm BC4J (and JClient) migration of JDev - 9.0.4.3 to JDev - 10.1.3.1 ~ (as an interim step...) ~.
I < tt > JUTableBinding < /tt > instantiated in < tt > bindRowSetIterator() < /tt > method of my implementation of < tt > JULovPanelInterface < /tt > encounters a NullPointerException to < tt > oracle.jbo.uicli.jui.JUTableBinding.getModelImpl(JUTableBinding.java:499) < /tt >.
I tried to swap the < tt > JUIteratorBinding < /tt > with the new DCIteratorBinding < /tt > introduced < tt > but this class is not instantiable.
How can I replace or properly instantiate < tt > JUTableBinding < /tt >?
Good bye
DPT chk this
Swing Dynamics Table binding
-
Created by af:table program does not properly
I have this JSF page:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html>
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="myFirstPage.jsf" id="d1">
<af:form id="f1">
<af:table binding="#{createAdfComponents.table}"/>
</af:form>
</af:document>
</f:view>
Here's the bean "createAdfComponents":
@ManagedBean(name = "createAdfComponents")
@SessionScoped
public class CreateAdfComponents {
public String[] columns = new String[]{"customerID", "firstName", "lastName", "address", "dob"};
private RichTable richTable = null;
public RichTable getTable() {
return richTable==null ? richTable=createTable() : richTable;
}
private RichTable createTable() {
RichTable table = new RichTable();
List<Customer> data = getCustomerList();
table.setValue(data);
table.setVar("c");
table.setRowBandingInterval(0);
table.setId("t1");
int i =1;
for (String column : columns) {
RichColumn richColumn = new RichColumn();
richColumn.setSortable(false);
richColumn.setHeaderText(column);
richColumn.setId("c"+ i);
RichOutputText columnValue = new RichOutputText();
columnValue.setValueExpression("value", createValueExpression("#{c."+column+"}", getClassType(column)));
columnValue.setId("ot" + i);
richColumn.getChildren().add(columnValue);
table.getChildren().add(richColumn);
i++;
}
return table;
}
private ValueExpression createValueExpression(String valueExpression, Class<?> valueType) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), valueExpression, valueType);
}
}
And, for completeness, here's the Customer.java class:
public class Customer {
private long customerID;
public String firstName;
public String lastName;
public String address;
public Date dob;
public long getCustomerID() {
return customerID;
}
public void setCustomerID(long customerID) {
this.customerID = customerID;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Date getDob() {
return dob;
}
public void setDob(Date dob) {
this.dob = dob;
}
}
Now, when I run the above on IntegratedWebLogicServer JSF page in JDeveloper 12.2.1... The columns in the table, but instead to display all the data, the page keeps refreshing repeatedly.
And in doing so... I see the following exception in JDeveloper console output:
javax.el.PropertyNotWritableException: //D:/JDeveloper/system12.2.1.0.42.151011.0031/o.j2ee/drs/Application1/ViewControllerWebApp.war/index3.jsf @8,59 binding="#{createAdfComponents.table}": The class 'CreateAdfComponents' does not have a writable property 'table'.
at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:136)
at javax.faces.component.UIComponent.processEvent(UIComponent.java:2419)
at org.apache.myfaces.trinidad.component.UIXCollection.processEvent(UIXCollection.java:918)
This exception keeps showing up over and over again... Presumable for every time the page refreshes, it does so constantly with little or no break.
Now, when he has none of the elements of input text and only items of output text, so why would he try a set operation? Not must not only be fulfilling get operations?
PS I'm new JSF, and ADF.
Many thanks to all.
The error message tells you that your bean class holding the table needs a Set accessor method for the table. The Set accessor is called by the framework when the page was created.
Add a setTable (RichTable t) viod your beans and it should display the table.
As you initialize it the table the first time that call you the Get accessor, you need not store the table through the Set accessor.
Timo
-
Updating of the ADF Table strangely after delete line
Hello
I use ADF Table with ArrayList to the model of the collection. I do not use View object
< af:table var = value ' row' = "#{pageFlowScope.dataBean.collectionModel}"... "
I have a SelectOnceChoice in each row of the table and bind their values to a property of the line
< af:selectOneChoice value = "#{row.label}"... "
I have a command link to remove each line and the delete method:
collectionModel.remove (idx);
The model is correctly updated, but the table of the ADF is not. Somehow, the value of the selection of the next line is set to the value of the deleted row.
For example: If there two select with values respectively: Foo, Bar. If I remove the line with Foo, the remaining line (initially Bar) is set to Foo.
If I refresh (F5) the page, it appears correctly. I also tried to use addPartialTarget and partialTriggers but no help.
Can someone help me? Thanks in advance.
Post edited by: 2925664
Hello
Previously I use table binding, that's why it has that name.
BTW, I don't know what's causing the problem. It is related to the life cycle ADF. I put the immediate = "true" for the select box and it is working fine now.
Concerning
-
How do I update the table in Jdev
Hello
I use Jdev 11.1.1.7.1.
The control of data, I added that ADF only read the table. When I click on the button create and return to the report screen, highlight lines are added.
Highlighted those who is not inserted into the DB table but he showed in the report. How to remove it. How can I update the table?
Kindly advice me.
Thank you
Swathi
That's what I got:
-You have a table read-only, and a link to create.
-When you press the link create a popup will be launched with a new record (may be a form in the same table iterator).
-When you press save to save the changes validation triggers, stop you to insert the record.
-After the fire of validation you will close the pop-up window (by pressing icon or by pressing Cancel).
-After closure of the pop-up window, you will find that reading one table has some blank lines.
If it is your problem if you have 2 choices:
1. in the AppModule you can make a new instance on the view object (to which redirect the table) If your view object called 'EmployeesView', so, in AppModule, you should have EmployeeView1 and EmployeeView2 and your table may point to EmployeeView1, and when you create new line create in EmployeeView2 and after completing the creation you can run the query and then refresh the table (as shown in the following code).
2 - the second option in the popup cancelListener link at the rear bean method then you can update the table by program as:
DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("TableIteratorName"); // from pageDef.
iter.getViewObject().executeQuery();
RequestContext.getCurrentInstance().addPartialTarget(getTableComponent());// from table Binding property bind it to object in back bean
-
Linked table filling out parameter is slow (2nd attempt)
I have exactly the same problem as described in this thread archived: https://forums.oracle.com/thread/1096352.
Can anyone tell why adding an OUT with the table binding parameter has such a negative effect on performance? We use Oracle.DataAccess v4.112.3.0.
If I have to call the exactly the same stored procedure using OracleDataAdapter.Update (DataSet), it is 10 x faster than the use of the table binding. And if I have to delete OUT parameter, then the binding table method is at least 5 times faster than OracleDataAdapter.Update (DataSet) in our case.
Turns out that Oracle does not provide a way to set "fetch size" for the ExecuteNonQuery method with the table binding. So when a stored procedure contains an OUT parameter (or function is the RETURN parameter), Oracle returns results of execution of each appellant separately. This translates into a large number of General networks and slows down the process considerably.
When you use Update() OracleDataAdapter with DataSet, the results of execution are sent in batches, resulting in fresh low networking overhead.
Without THE params, there is no problem since nothing is sent to the appellant and to ExecuteNonQuery with table binding works faster than OracleDataAdapter.Update (DataSet).
-
By using the impl class for functions on a table
I'm looking for a bit of advice on best practices.
I have an app with 35 paintings. I need to have a button "reset comes out" on each table.
Each resetSort method should specify the table and the specific iterator.
I tried to not having all the functions of 35 in the bean to support (1 for each table).
Can I bind each table has associated feature class impl and each resetSort button call a method in this class?
I use jdev 11.1.1.6.
Any advice would be appreciated.
Ray
Then your real mission is to find the table for which the use wants to put sorting by pressing a button?
This should be doable with the bean and a function that you bind to each of the reset buttons that you use for your tables.
If your presentation is for the tables and the button to reset sorting, you can use an actionListener to the button. In the event of action, with the knowledge of the layout, it is easy to get to the table and once you have the table that you get the iterator from the table.
Assuming that your tables are always surrounded by a panelCollection, who owns a toolbar now your reset button
emptyText = "#{bindings." EmployeesView.viewable? "{'No data to display.': 'Access Denied.'}".
fetchSize = "#{bindings." EmployeesView.rangeSize}' rowBandingInterval = '0 '.
selectedRowKeys = ' #{bindings. " EmployeesView.collectionModel.selectedRow}.
selectionListener = "#{bindings." RowSelection EmployeesView.collectionModel.makeCurrent}"="single"id ="t1">
You can use this code actionListener
{} public void resetSort (ActionEvent actionEvent)
get the link container
BindingContainer links is BindingContext.getCurrent () .getCurrentBindingsEntry ();.
DCBindingContainer dcBindings = (DCBindingContainer) links;
UIComponent toolbar (UIComponent) = actionEvent.getSource ();
Try to get the source of the event table
assuming that the button is in a toolbar of a panelCollection we get using parent.parent.children
List of children of = toolbar.getParent () .getParent () .getChildren ();
Table richeTableau = null;
for (UIComponent uic: children) {}
If (uic instanceof richeTableau) {}
table = uic (richeTableau);
break;
}
}
If (table! = null) {}
the model in the Collection is the object that provides the
structured data
for the table to render
CollectionModel tableModel = (CollectionModel) table.getValue ();
the purpose of the ADF that implements the CollectionModel is
JUCtrlHierBinding. It is surrounded by the CollectionModel API
JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding) tableModel.getWrappedData ();
Acess the ADF, which is used with iterator
ADF table binding
DCIteratorBinding iterBind = adfTableBinding.getDCIteratorBinding ();
table.queueEvent (new SortEvent (table, new ArrayList()));
CurrentRow key = null;
Line = iterBind.getCurrentRow ();
If (line! = null)
currentRow = row.getKey ();
SC SortCriteria [] = new SortCriteria [0];
iterBind.applySortCriteria (sc); iterBind is that the table iterator use
iterBind.executeQuery ();
If (currentRow! = null)
iterBind.setCurrentRowWithKey (currentRow.toStringFormat (true));
}
}
This code looks for the table of the source of the action, which is the button in the toolbar, get the tabel. Once you have the table you get the iterator from the table and reset the sort. This works as long as we find the source of the action table. If you always use the same layout for tables (for example. panelCollection > table), which is a practice of good uix, you have need of a bean to reset all tables. Simply link the toolbar button actionListner to the listener in the bean.
Timo
Maybe you are looking for
-
PORECTOL in MS Dynamics GP 2010 - accounting units returned and replaced?
In GP, if we order 10 units on a purchase order, we receive 10 units (or 12 if we have a tolerance of 20%). If we go back 5 and select 'replace returned products' option, then GP represents the units 'replaced' defaults to '5' on the next shipment tr
-
HP3545: How to scan document of several pages in a SINGLE PDF file
HelloI recently bought HP3545 AIO printer. I am not able to scan document of several pages in a SINGLE PDF file.Help, please.... Reddij
-
Svchost.exe takes the largest part of the allocation of bandwidth per month
I have nine copies of svchost.exe running on my computer and one of them seems to be still using 10-20% CPU. Looking at using my BTsoftware, the active svchost.exe is listening on multiple ports, including 1900 several times and often transmits the d
-
different first page header xml publisher reports
Dear all,I have a RTF model I need to print deparaments first page header and another page remaining heading, I tried using the first page different from the characteristic word, but it is not working properly, in my rtf after first page I used for e
-
I want to know how to disable the automatic download of the documents in my player. I used to get a dialog that ask me if I wanted to view or download. I click an option that says always perform this action to download and now they still download. I