on 11-22-2005 4:56 AM
Hi All,
I have few questions :
1. Is there any way that we can re start the application on click of a button(InterfaceView and Start up Plug or something like this??)
2. Can focus be shifted from one editable field to other on pressing enter button??
3. In my application the Date format is coming as "mm/dd/yyyy". I need to read this and display as "MMM YY". How do we go about this.
4. how to convert the java.sql.date to java.util.date and vice versa ???
Thanks in advance
Srikant
Hi Srikant,
1)Yes you can restart the application by firing a plug to itself based on some condition from the interface view. This is how the themes are chnaged based on application. Check the weblog Application based themes in WebDynpro.
2)Changing the focus can be done from wdModifyView so you can set some variable and based on that change the focus in the wdModifyView.
3)Format of the date can be changed by usinf the SimpleDateFormat.
SimpleDateFormat sdf=new SimpleDateFormat("<pattern>");
sdf.format(date);
please do check the syntax.
4)I don't know if it would work but give a try
Get the long value of java.util.date.eg. getTime() and create the java.sql.date with the constructor Date(long) constructor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim and Noufal,
Its been of great help the things you suggested.
1. I can restart the application on click of a button.
2. The date format also changed..
Thanks a lot for your replies
Now regarding the Input of focus. I have one editable table column where I have to insert inputs in many rows. under the same column. I want to shift the focus from one row to another on click of enter button.
I've used the following code and its not working to my requirements.
IWDAttributeInfo attrReqdVolume = wdContext.nodeTableDisplayNode().getNodeInfo().getAttribute(IPrivatePreBuyPricesStartView.ITableDisplayNodeElement.C_INPUT);
wdThis.wdGetAPI().requestFocus(wdContext.currentTableDisplayNodeElement(),attrReqdVolume);
where"attrReqdVolume" is the value attribute of table.
how do we approach this?
Thanks in advance
Srikant
Hello D.V. Srikant,
1) Create context attribute "indexWithFocus" with type integer.
2) In wdDoInit put
wdContext.currentContextElement().setIndexWithFocus(-1);
3) In button action handler put
int index = wdContext.currentContextElement().getIndexWithFocus();
final int size = wdContext.nodeResult().size();
final IWDNodeElement element = wdContext.nodeResult().getElementAt(++index >= size ? index=0 : index);
wdContext.currentContextElement().setIndexWithFocus(index);
IWDAttributeInfo attrReqdVolume = wdContext.nodeResult().getNodeInfo().getAttribute("CustomerNumber");
wdThis.wdGetAPI().requestFocus(element, attrReqdVolume);
Result is name of data source node. CustomerNumber is attribute wich is mapped to inputField table column editor.
Best regards, Maksim Rashchynski.
Hi Maksim
For taking the effort for the code, but its not working.
Let me be explain my requirement.
There is column name"Reqd" and whose TableCellEditor is input field whose Id "ReqdInput". So, when insert value in the input field, the cursor should move to the input field below it.
So, for this I have written the code as suggested in a method in following manner:
public void GetFocusInput( )
{
//@@begin GetFocusInput()
int index = wdContext.currentContextElement().getIndexFocus();
final int size = wdContext.nodeTableDisplayNode().size();
final IWDNodeElement element = wdContext.nodeTableDisplayNode().getElementAt(++index >= size ? index=0 : index);
wdContext.currentContextElement().setIndexFocus(index);
IWDAttributeInfo attrInfo = wdContext.nodeTableDisplayNode().getNodeInfo().getAttribute("ReqdInput");
wdThis.wdGetAPI().requestFocus(element,attrInfo);
//@@end
}
and I have called this method in the On Enter event handler. but its not working.
Can you suggest something.
Thanks in advance
Srikant
Hello D.V.Srikant,
Is "ReqdInput" attribute in data source node too?
You should call
IWDAttributeInfo attrInfo = wdContext.nodeTableDisplayNode().getNodeInfo().getAttribute("ReqdInput");
Not for input field Id but for name of attribute within datasource node which is bound to "value" property of TableCellEditor`s InputField.
Example is working fine for me. The only thing you have to add is to implement onleadSelect event from table to set IndexFocus attribute to current one:
final IWDNodeElement element =wdContext.nodeResult().currentResultElement();
wdContext.currentContextElement().setIndexWithFocus(element.index());
or just move leadSelection in onLeadSelect action handler. It is even simplier in your situation. Than you even don`t need index of element which is having focus because you would use leadselection.
Best regards, Maksim Rashchynski.
Hi Maksim
Thanks for taking the effort.
Well I have modified the code and included the value attribute instead of the Table cell editor..
But after that its not clear to me what you meant by
"<i>The only thing you have to add is to implement onleadSelect event from table to set IndexFocus attribute to current one:
final IWDNodeElement element =wdContext.nodeResult().currentResultElement();
wdContext.currentContextElement().setIndexWithFocus(element.index());
or just move leadSelection in onLeadSelect action handler. It is even simplier in your situation. Than you even don`t need index of element which is having focus because you would use leadselection.</i>"
Can you explain more on this???
Thanks in advance
Srikant
Well, it seems now really a little bit confusing.
The only thing you need in your case is
In onEnter action handler put something like this
final IPrivateNewComponentView.IResultNode dataSource = wdContext.nodeResult();
int index = dataSource.currentResultElement().index();
final int size = dataSource.size();
final IWDNodeElement element = dataSource.getElementAt( ++index < size ? index : 0);
final IWDAttributeInfo attrReqdVolume = dataSource.getNodeInfo().getAttribute("CustomerNumber");
wdThis.wdGetAPI().requestFocus(element, attrReqdVolume);
dataSource.setLeadSelection(element.index());
Hope this will help :-).
Best regards, Maksim Rashchynski.
Suppose say you need to focus on an InputField(say id="abc") then,
InputField ip=(InputField)view.getElement("abc");
ip.requestFocus();
Hope you could do it the same way too. Not sure if it works on tables
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello D.V. Srinkat,
1) Try this in your button action handler
try{ final String url = WDURLGenerator.getApplicationURL(wdComponentAPI.getApplication().getDeployableObjectPart(), null); WDClientUser.forceLogoffClientUser(url); }catch (final WDURLException ex){wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(ex), false);}
3) See above
4) To "convert" java.sql.Date to java.util.Date you dont need anything because java.util.date is super class for
java.sql.Date. See http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html
And to "convert" java.util.Date to java.sql.Date use constructor new java.util.Date( java.util.Date.getTime() ) as suggested.
BTW, could you review your thread
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.