PanelBinding.stopEditing()

Hi all,
I have the following scenario in my JClient application.
The user modifies a row in my DB. If the user just modifies one attribute and does not navigate out off this field, the transaction is not marked as dirty and therefore my question dialog whether to rollback or commit is not displayed. I thought that panelBinding.stopEditing() method would be the right one to stop editing and that this will mark my transaction as dirty. But it does not work as expected. How do I have to handle this case? My data is not modified in a table! I have JTextFields and other SwingComponents bound to my data. If I navigate manually out off my textfield it works as expected.
Cheers,
Axel

Frank, we have the same problem.
We could not call setAttribute on each keyboard event because of validation rules.
So i also would expect that stopEditing() would force a call of setAttribute to validate the input, modify the EO attribute, mark the transaction dirty.
Not sure that i understand you correctly, but your description sounds like stopEditing performs a kind of undo on the field.
Btw. In Oracle Forms, the first modification in a field lead to a lock in the database. in JClient i first have to navigate our of the field. I would prefer the Forms locking behaviour also in JClient.
Markus

Similar Messages

  • JClient: two error messages on commit

    Hi,
    I have a problem with multiple reports of error messages in OptionPanes using JClient (JDev 9.0.3 with and without Patch):
    You can reproduce this easily with wizard generated sources:
    1. Create a bc4j project for OnlineOrders (EOs, VOs, AM,...)
    2. Create a jclient form for the customerVo of the OnlineOrders project with TABLE! as view
    3. Start the form.
    4. Update the name of a customer with a lot of chararacters, so that you expect an error because the field can only take 20 (?) characters.
    5a. if you press return or leave the cell you get ONE OptionPane with the error. ok.
    5b. if you click the commit button, you get TWO message boxes !!!!
    This seems to be a jclient bug with focus handling of the editor component.... Any idea how to get around this?

    Logged bug 2784888 to track this.
    A workaround is to override navbar's commit action and perform end-edit on the table-cell in the application code and trap any errors and only if the end-edit is successful, let the default action go thru. Here's my code to override doAction in the navbar to solve this issue:
      private JUNavigationBar navBar = new JUNavigationBar()
         public void doAction(int action)
           if (action == JUNavigationBar.BUTTON_COMMIT)
             try
               panelBinding.stopEditing();
             catch (oracle.jbo.JboException e)
               //eat it up as it must have been displayed by now.
               return;
           super.doAction(action);

  • Tree nodes not updating when stopEditing called

    I am getting some unusual issues with trees and inline editing. I have added my own component, a JPanel with a text field, check box and combo box. When the user edits or adds a new item to the tree, the editor shows up fine. When they click off of the node, I have it set to ACCEPT the edit (not cancel it). When ESC is pressed, everything is fine. When they click off of a node while adding/editing, the item is saved properly to the node, but it's not until I click on another node that the node just edited gets redrawn. Also, I added my won keyPressed handler so that if they hit ENTER or any of the components for my custom editor, it calls tree.stopEditing() as if they clicked off of it, to accept it. Both cases, the node doesn't get redrawn.
    When I put a tree.updateUI() at the end of the stopEditing() or cancelEditing() method, I get a nice fast stack trace from the BasicUI@MouseListner:handleListSelection. So it appears calling tree.updateUI() while inside of a method being handled due to an evetn, causes problems. My guess is that firing off another event while inside of an event handler may not be allowed?
    When I try tree.repaint() and tree.invalidate(), it seems to work when I click off of the node, but when I press ENTER on my custom editor, which calls the same stopEditing() method as clicking off of a node does, it doesn't repaint.
    Any help would be appreciated? I update the panel the tree is in as well, so I am lost as to why it wont update properly.

    here is the stack trace I get. Man this bugs me, it doesn't seem to break anything, yet it keeps showing up:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2815)
         at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.java:2801)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:218)
         at java.awt.Component.processMouseEvent(Component.java:5131)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3162)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

  • How to release panelbinding correctly?

    Hi guys, i have a master-detail from linked to the main form through an item menu.
    When i close the master-detail form i perform the following operations:
    panelBinding.release(DCDataControl.REL_VIEW_REFS);
    panelBinding.getBindingContext().remove(panelBinding.getName());
    this.dispose();
    Is it correct?
    I'm asking this because if I open the master-detail form more then once i have the following error:
    oracle.jbo.JboException) 35001
    thank you,
    angelo

    When you close a multi-panel form be sure to release all bound panels.
    I do it this way:
    In all my forms I have:
    1) a method to create the bindings
    private DCBindingContainer createBindingContainer(String packageName, String panelModelName)
    2) a collection of all bound panels, to make it easier all my panels extends an Abtract class with at least following methods:
    public void setBindingContainer(DCBindingContainer ctr) throws Exception
    public void panelReleaseViews()
    3) when closing my form I loop through my collection, cast to my Abstract class and call the release method.
    Each sub component must implement the release panel method to release ALL its panels (there could more > 1)
    Details:
    in calling form:
    private DCBindingContainer createBindingContainer(String packageName, String panelModelName)
    StringBuffer sb = new StringBuffer(packageName);
    sb.append(".");
    sb.append(panelModelName);
    DCBindingContainerDef bcdef = DCBindingContainerDef.findDefObject(sb.toString()); //NOTE THE NAME.
    if (bcdef == null)
    throw new JboException("System error, "+getClass().getName()+".createBindingContainer, DCBindingContainerDef: "+sb.toString()+" not found");
    DCBindingContainer bc = bcdef.createBindingContainer(panelBinding.getBindingContext());
    bc.setName(panelModelName);
    panelBinding.getBindingContext().put(panelModelName, bc);
    return bc;
    In Abstract class:
    public void setBindingContainer(DCBindingContainer ctr) throws Exception
    panelBinding = (JUPanelBinding)ctr;
    if (panelBinding == null)
    throw new JboException("System error "+getClass().getName()+".setBindingContainer, Panel Binding is null");
    else
    if (ctr.getBindingContext() == null)
    throw new JboException("System error "+getClass().getName()+".setBindingContainer, Binding Context is null");
    setBindingContext(ctr.getBindingContext());
    // override this method if more panels to release in called panel
    public void panelReleaseViews()
    if (panelBinding != null)
    panelBinding.release(DCDataControl.REL_VIEW_REFS);
    System.out.println(getClass().getName()+".releaseBeforeClosing(), panelBinding.getName(): "+panelBinding.getName());
    panelBinding.getBindingContext().remove(panelBinding.getName());
    Example of call:
    PACKAGE_NAME = static String defined in class
    String panelModelName = "PanelFileTypeVO1UIModel";
    DCBindingContainer bc = this.createBindingContainer(PACKAGE_NAME,panelModelName);
    PanelFileTypeVO1 panelFileTypeVO1 = new PanelFileTypeVO1();
    panelFileTypeVO1.setBindingContainer(bc);
    // panelFileTypeVO1.setBindingContext(panelBinding.getBindingContext());
    panelFileTypeVO1.revalidate();
    add panel to collection
    To release:
    Iterate obver your collection, cast to Abstract class and call panelReleaseViews()
    Regards
    Fred

  • Unable to instantive live instance for panelBinding; using placeholder inst

    I have an ADF panel with an edit form on it.
    If I start JDev, it shows the following message in a "UI" log window:
    "Unable to instantive live instance for panelBinding; using placeholder instead."
    and there is no UI control displayed on the panel.
    However a run panel action fixes the problem.
    It is not a major issue.

    hi
    I also (sometimes) get the "Unable to instantiate live instance for panelBinding; using placeholder object instead." message in the UI Log panel.
    Is there documentation about this message, when I occurs? (I haven't been able to consistently reproduce this.)
    If I run JDeveloper (10.1.3.1.0.3984) using "jdev.exe" I don't see related messages on the console.
    We also have an issue with component bindings getting created in a new SomePanelPageDef.xml file while one existed and we end up with both SomePanelUIModel and SomePanelPageDef as pageDefinitionUsages in DataBindings.cpx and of course the panel doesn't work. I think these issues could be related.
    Any suggestions or documentation? (And yes "the compiled class is present in the classpath".)
    many thanks
    Jan Vervecken

  • PanelBinding: refresh control

    hi forum,
    I have a jFrame composed by a master-detail table.
    I added to the navigationbar 2 more buttons in order to perform the insert and delete records in the master table. I couldn't use the buttons of the navigationbar(JUNavigationBar) because i have to execute some tasks before inserting or deleting a record.
    My problem is that i don't see the record i have just inserted and i still see the record i have deleted unless i close the Jframe and i start it up again.
    I have tryed to use statements like
    panelBinding.refreshControl();
    but it doesn't seem to work.
    There is anybody that can give me the right statement?
    Thank you,
    Angelo

    Try the navBar.getModel() methods executeQuery() or executeQueryIfNecessary(). They should refresh the cache behind your ViewObject.

  • PanelBinding and JBO-35001

    Hello, we got a problem.
    We are using ADF with JClient-technologie and MDI Client-Server forms.
    We build a JPanel with the JDeveloper-Wizard and put that in an JInternalFrame which is invoked by a JDesktopPane. That works...
    But if we create the same JInternalFrame twice we get the exception JBO-35001. I read the workaround in the JDeveloper-Releasenotes but that does not fit to our problem.
    Has anybody a possible solution to that problem ???
    Here are some lines of the sourcecode...
    MasterMDI.java
    public static BindingContext ctx = new BindingContext();
    public DepartmentsPanel panel;
    public static void main(String args[])
    try
    // bootstrap application
    JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
    JUMetaObjectManager mgr = JUMetaObjectManager.getJUMom();
    mgr.setJClientDefFactory(null);
    //BindingContext ctx = new BindingContext();
    ctx.put(DataControlFactory.APP_PARAM_ENV_INFO, new JUEnvInfoProvider());
    ctx.setLocaleContext(new DefLocaleContext(null));
    HashMap map = new HashMap(4);
    map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, ctx);
    mgr.loadCpx("DataBindings.cpx", map);
    new MasterMDI();
    catch(Exception ex)
    JUMetaObjectManager.reportException(null, ex);
    System.exit(1);
    public void createDepartmentsPanel()
    panel = new DepartmentsPanel();
    panel.setBindingContext(ctx);
    panel.revalidate();
    // InternalFrame
    JInternalFrame iFrame = new JInternalFrame("Departments", true, true, true, true);
    // BorderLayout...
    iFrame.getContentPane().setLayout(new BorderLayout());
    // Center
    iFrame.getContentPane().add(panel, BorderLayout.CENTER);
    // show
    iFrame.pack();
    iFrame.setVisible(true);
    // JDesktopPane
    masterPane.add(iFrame);
    If we call the method createDepartmentsPanel for the first time it works... but not the second time...???
    I've also tried to call the release() - Method of the panel but this does not work...
    HAS ANYBODY A SOLUTION ???
    MM

    Hello, we got a problem.
    We are using ADF with JClient-technologie and MDI Client-Server forms.
    We build a JPanel with the JDeveloper-Wizard and put that in an JInternalFrame which is invoked by a JDesktopPane. That works...
    But if we create the same JInternalFrame twice we get the exception JBO-35001. I read the workaround in the JDeveloper-Releasenotes but that does not fit to our problem.
    Has anybody a possible solution to that problem ???
    Here are some lines of the sourcecode...
    MasterMDI.java
    public static BindingContext ctx = new BindingContext();
    public DepartmentsPanel panel;
    public static void main(String args[])
    try
    // bootstrap application
    JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
    JUMetaObjectManager mgr = JUMetaObjectManager.getJUMom();
    mgr.setJClientDefFactory(null);
    //BindingContext ctx = new BindingContext();
    ctx.put(DataControlFactory.APP_PARAM_ENV_INFO, new JUEnvInfoProvider());
    ctx.setLocaleContext(new DefLocaleContext(null));
    HashMap map = new HashMap(4);
    map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, ctx);
    mgr.loadCpx("DataBindings.cpx", map);
    new MasterMDI();
    catch(Exception ex)
    JUMetaObjectManager.reportException(null, ex);
    System.exit(1);
    public void createDepartmentsPanel()
    panel = new DepartmentsPanel();
    panel.setBindingContext(ctx);
    panel.revalidate();
    // InternalFrame
    JInternalFrame iFrame = new JInternalFrame("Departments", true, true, true, true);
    // BorderLayout...
    iFrame.getContentPane().setLayout(new BorderLayout());
    // Center
    iFrame.getContentPane().add(panel, BorderLayout.CENTER);
    // show
    iFrame.pack();
    iFrame.setVisible(true);
    // JDesktopPane
    masterPane.add(iFrame);
    If we call the method createDepartmentsPanel for the first time it works... but not the second time...???
    I've also tried to call the release() - Method of the panel but this does not work...
    HAS ANYBODY A SOLUTION ???
    MM

  • How to retrieve all the data from a BLOB using view-generated accessor

    I am using JDeveveloper 10g v. 10.1.3 and am storing an image in a database as a blob object and need to retrieve all of the data to get the entire image and store it in an ImageIcon. The code I have works partially in that it retrieves the correct data, but only gets a piece of it, leaving me with a partial image.
    AppModuleImpl am;
    ImageVwViewImpl vo;
    am = (AppModuleImpl)panelBinding.getDataControl().getDataProvider();
    vo = (ImageVwViewImpl)am.findViewObject("ImageVwView");
    ImageVwViewRowImpl ivo = (ImageVwViewRowImpl)vo.getCurrentRow();
    ImageIcon icon = new ImageIcon(ivo.getImage().getBytes(1, (int)ivo.getImage().getBufferSize()));
    jULabel1.setIcon(icon);I either need to know how to use a stream to get the data out (from BlobDomain method getBinaryStream()), or how to get the other chunks of data separately.
    edit: I know the problem is that getBufferSize() returns an int which is too small to hold all the data, but need to know what to use instead. Thanks!

    This is the code I'm using now. Same problem :(
    AppModuleImpl am;
            ImageVwViewImpl vo;
            am = (AppModuleImpl)panelBinding.getDataControl().getDataProvider();
            vo = (ImageVwViewImpl)am.findViewObject("ImageVwView");
            ImageVwViewRowImpl ivo = (ImageVwViewRowImpl)vo.getCurrentRow();  
            ImageIcon icon = new ImageIcon(ivo.getImage().toByteArray());
            jULabel1.setIcon(icon);

  • How to call a PL/SQL procedure from a Java class?

    Hi,
    I am new to the E-BusinessSuite and I want to develop a Portal with Java Portlets which display and write data from some E-Business databases (e.g. Customer Relationship Management or Human Resource). These data have been defined in the TCA (Trading Community Architecture) data model. I can access this data with PL/SQL API's. The next problem is how to get the data in the Java class. So, how do you call a PL/SQL procedure from a Java program?
    Can anyone let me know how to solve that problem?
    Thanks in advance,
    Chang Si Chou

    Have a look at this example:
    final ApplicationModule am = panelBinding.getApplicationModule();
    try
         final CallableStatement stmt = ((DBTransaction)am.getTransaction()).
                                                                                         createCallableStatement("{? = call some_pck.some_function(?, ?)}", 10);
         stmt.registerOutParameter(1, OracleTypes.VARCHAR);
         stmt.setInt(2, ((oracle.jbo.domain.Number)key.getAttribute(0)).intValue());
         stmt.setString(3, "Test");
         stmt.execute();
         stmt.close();
         return stmt.getString(1);
    catch (Exception ex)
         panelBinding.reportException(ex);
         return null;
    }Hope This Helps

  • How to open a JPanel

    Hi
    I have created a JPanel in JDeveloper 10.1.3. It has a main method with (see below) but when opened from my application I must use something else than JUTestFrame but what? How should the JPanel be opened the right way?
    public static void main(String [] args) {
    try {
    UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
    } catch (ClassNotFoundException cnfe) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception exemp) {
    exemp.printStackTrace();
    } catch (Exception exemp) {
    exemp.printStackTrace();
    CurrencyRateEdit panel = new CurrencyRateEdit();
    panel.setBindingContext(JUTestFrame.startTestFrame("mypackage.DataBindings.cpx", "null", panel, panel.getPanelBinding(), new Dimension(400,300)));
    panel.revalidate();
    }

    Thanks for the input, unfortunately using the JFrame provided by the JDev wizard is what we are trying to avoid. We do not want a JFrame of any kind.
    I have it working now with a JPanel as the top level container for the ADF plumbing. This allows me to place the ADF bindings virtually anywhere without any type of boarders. Here is how I did it. (by the way I am still testing out Erik's recommendation)
    1) create a default application with an empty runable panel. (the main() can be moved out later but makes it easy for testing) The code here assumes you are using all the default naming in the wizard. If not you will have to make the appropriate changes.
    2) Just under the class definition create an instance of a class named "appPanel". This class will be defined below and is a gutted/modified version of JUTestFrame which extends JPanel instead of JFrame. It should look something like this:
    public class Panel1 extends JPanel implements JUPanel {       
    public appPanel canvas = new appPanel();
    3) In the main() function change
    panel.setBindingContext(JUTestFrame.startTestFrame( ...
    to:
    panel.setBindingContext(panel.canvas.startTestFrame( ... //canvas is the name I chose in step 2.
    4) If, in this test app, you don't already have a container (JForm or other) for the ADF JPanel you can create one for testing like this:
    At the bottom of the main() function put :
    JFrame xx = new JFrame();
    xx.add(panel);
    xx.setVisible(true);
    5) Create the class file appPanel (menu: new >simple file > Java Class. and replace all of the contents with: (excuse the formatting. I don't know why they don't make developer forums more code friendly)
    package mypackage;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.GridLayout;
    import java.awt.event.KeyEvent;
    import java.beans.PropertyVetoException;
    import javax.swing.JPanel;
    import javax.swing.JInternalFrame;
    import javax.swing.JScrollPane;
    import java.util.HashMap;
    import oracle.jbo.uicli.UIMessageBundle;
    import oracle.jbo.uicli.jui.JUPanelBinding;
    import oracle.jbo.uicli.jui.JUEnvInfoProvider;
    import oracle.jbo.uicli.controls.JUErrorHandlerDlg;
    import oracle.jbo.uicli.controls.JClientPanel;
    import oracle.jbo.uicli.binding.JUApplication;
    import oracle.jbo.uicli.mom.JUMetaObjectManager;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.DataControlFactory;
    import oracle.adf.model.binding.DCDataControl;
    import oracle.jbo.uicli.controls.*;
    public class appPanel extends JPanel
    private JUPanelBinding panelBinding = null;
    private DCDataControl dataControl;
    private BindingContext mCtx;
    appPanel frame;
    public appPanel() {
    try {
    jbInit();
    } catch (Exception e) {
    e.printStackTrace();
    public BindingContext startTestFrame(String cpxName, String dcName, JPanel panel, JUPanelBinding panelBinding, Dimension size)
    if (!(panel instanceof JUPanel))
    System.err.println(UIMessageBundle.getResString(UIMessageBundle.STR_TUI_ERROR_JCLIENTPANEL));
    return null;
    frame = new appPanel(cpxName, dcName, panelBinding, panel);
    frame.adjustFrameSize(size);
    return frame.getBindingContext();
    public appPanel(JUPanelBinding designTimePanelBinding, JPanel panel)
    this.setLayout(new GridLayout());
    JScrollPane scPane = new JScrollPane(panel);
    this.add(scPane);
    JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
    //mom will pass properties in case it's null
    JUApplication app = JUMetaObjectManager.createApplicationObject(designTimePanelBinding.getApplicationName(), null, new JUEnvInfoProvider());
    panelBinding = new JUPanelBinding(designTimePanelBinding.getApplicationName(), panel);
    panelBinding.setApplication(app);
    ((JClientPanel)panel).setPanelBinding(panelBinding);
    panelBinding.execute();
    dataControl = app;
    public appPanel(String cpxName, String dcName, JUPanelBinding panelBinding, JPanel panel)
    this.setLayout(new GridLayout());
    JScrollPane scPane = new JScrollPane(panel);
    this.add(scPane);
    createBindingCtxAndSetUpMenu(cpxName, dcName, panelBinding);
    private void createBindingCtxAndSetUpMenu(String cpxName, String dcName, JUPanelBinding panelBinding)
    JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
    JUMetaObjectManager.getJUMom().setJClientDefFactory(null);
    mCtx = new BindingContext();
    HashMap map = new HashMap(4);
    map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, mCtx);
    JUMetaObjectManager.loadCpx(cpxName, map);
    DCDataControl app = (DCDataControl)mCtx.get(dcName);
    if (app != null)
    dataControl = app;
    app.setClientApp(DCDataControl.JCLIENT);
    else
    mCtx.setClientAppType(DCDataControl.JCLIENT);
    panelBinding = panelBinding.setup(mCtx, null);
    public DCDataControl getDataControl()
    return dataControl;
    public BindingContext getBindingContext()
    return mCtx;
    void adjustFrameSize(Dimension size)
    setSize(size);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    if (size.height > screenSize.height)
    size.height = screenSize.height;
    if (size.width > screenSize.width)
    size.width = screenSize.width;
    setLocation((screenSize.width - size.width) / 2, (screenSize.height - size.height) / 2);
    setVisible(true);
    private static final char MNEMONICINDICATOR = '&';
    public static final int MNEMONIC_INDEX_NONE = -1;
    * Returns the key code for the mnemonic in the string. Returns
    * VK_UNDEFINED if the string does not contain a mnemonic.
    public int getMnemonicKeyCode(String string)
    if (string == null)
    return KeyEvent.VK_UNDEFINED;
    // Minus one, because a trailing ampersand doesn't count
    int lengthMinusOne = string.length() - 1;
    int i = 0; // Index in the source sting
    while (i < lengthMinusOne)
    int index = string.indexOf(_MNEMONIC_INDICATOR, i);
    // Are we at the end of the string?
    if ((index == -1) || (index >= lengthMinusOne))
    break;
    char ch = string.charAt(index + 1);
    // if this isn't a double ampersand, return
    if (ch != MNEMONICINDICATOR)
    // VK_* constants are all for upper case characters
    return(int) Character.toUpperCase(ch);
    // Skip over the double ampersand
    i = index + 2;
    return KeyEvent.VK_UNDEFINED;
    * Removes non-displayable inline mnemonic characters.
    * In order to specify a mnemonic character in a translatable string
    * (eg. in a resource file), a special character is used to indicate which
    * character in the string should be treated as the mnemonic. This method
    * assumes that an ampersand ('&') character is used as the mnemonic
    * indicator, and removes (single) ampersands from the input string. A
    * double ampersand sequence is used to indicate that an ampersand should
    * actually appear in the output stream, in which case one of the ampersands
    * is removed.
    * Clients should call this method after calling
    * StringUtils.getMnemonicIndex() and before displaying the string. The
    * returned string should be used in place of the input string when
    * displaying the string to the end user. The returned string may be the
    * same as the input string if no mnemonic indicator characters are found,
    * but this is not guaranteed.
    * @see #getMnemonicIndex
    public String stripMnemonic(String string)
    if (string == null)
    return null;
    int length = string.length();
    // Single character (or empty) strings can't have a mnemonic
    if (length <= 1)
    return string;
    StringBuffer buffer = null;
    int i = 0;
    while (i < length)
    int index = string.indexOf(_MNEMONIC_INDICATOR, i);
    // We've reached the append. Append the rest of the
    // string to the buffer, if one exists, then exit
    if ((index < 0) || (index >= length - 1))
    if (buffer != null)
    buffer.append(string.substring(i));
    break;
    if (buffer == null)
    // If the string starts with an ampersand, but not a double
    // ampersand, then we just want to return
    // stripMnemonic(string.substring(1)). This is basically
    // what we do here, only I've optimized the tail recursion away.
    if ((index == 0) && (string.charAt(1) != MNEMONICINDICATOR))
    string = string.substring(1);
    length--;
    continue;
    else
    // Allocate the buffer. We can reserve only space
    // (length - 1), because, by now, we know there's at least
    // 1 ampersand
    buffer = new StringBuffer(length - 1);
    // Append the bits of the string before the ampersand
    buffer.append(string.substring(i, index));
    // And append the character after the ampersand
    buffer.append(string.charAt(index + 1));
    // And skip to after that character
    i = index + 2;
    // If we never allocated a buffer, then there's no mnemonic
    // at all, and we can just return the whole string
    if (buffer == null)
    return string;
    return new String(buffer);
    private void jbInit() throws Exception {
    And now you have an ADF implementation that exists purely in a JPanel to be placed anywhere.
    Again I am still testing Erik's recomendation which may prove to be a better implementation; but I wanted to share what I have working.
    I hope this helps someone out. Good luck.
    SMartel

  • How to get values from dynamic component?

    Hi:
    I am displaying dynamic components based on user selection, where InputText and OutputText display properly. But now i want to read that component value on
    button click. Can any body help me in that?
    Source code is as follow,
    text.xhtml
    *<code>*
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:ice="http://www.icesoft.com/icefaces/component"
         template="/WEB-INF/includes/templates/page-template.xhtml">
         <ui:define name="page-content">
              <div class="exampleBox splashContainer"
                   style="background: url('./xmlhttp/css/rime/css-images/contentContainer_bg.gif') top repeat-x">
              <table>
                   <tr>
                        <td colspan="2">
                        <h2>Set Request Process Flow</h2>
                        </td>
                   </tr>
                   <tr>
                        <td colspan="2"><ice:messages style="color:red;" /></td>
                   </tr>
                   <tr>
                        <td><ice:outputText value="Request Type*"></ice:outputText></td>
                        <td><ice:selectOneMenu value="#{offlinereq.requestno}"
                             valueChangeListener="#{offlinereq.requestChange}"
                             partialSubmit="true">
                             <f:selectItem itemValue="" itemLabel="--Select--" />
                             <f:selectItems value="#{offlinereq.requests}" />
                        </ice:selectOneMenu></td>
                   </tr>
                   <tr>
                        <td>*<h:panelGroup binding="#{offlinereq.panelBind}">*
    *                    </h:panelGroup>*</td>
                   </tr>
                   <tr>
                        <td colspan="4"><ice:commandButton value="Add"
                             actionListener="#{offlinereq.add}" /> <ice:commandButton
                             value="Update" actionListener="#{offlinereq.update}" /> <ice:commandButton
                             value="Delete" actionListener="#{offlinereq.delete}" /> <ice:commandButton
                             value="Reset" actionListener="#{offlinereq.reset}" /></td>
                   </tr>
              </table>
              </div>
         </ui:define>
    </ui:composition>
    *</code>*
    bean.java
    *<code>*
    //ValuechangeListener
         public void requestChange(ValueChangeEvent e){
              System.out.println("Select Value is::"+e.getNewValue()+"::"+userid);
              Connection conn=null;
              try {
                        if(!panelBind.getChildren().isEmpty())
                             panelBind.getChildren().clear();
                   Class.forName ("oracle.jdbc.OracleDriver");
                   conn = JdbcUtil.getConnection();
                   Statement stmt = conn.createStatement();
                   String sql="select * from IB_CUSTOMER_REQUEST_PARAMETERS where IB_REQMAST_SRNO='"+e.getNewValue()+"'";
                   ResultSet rs = stmt.executeQuery(sql);     
                   String out="out";
                   int i=1;
                   String ii;
                   while(rs.next()) {          
                        FacesContext facesContext = FacesContext.getCurrentInstance();
              Application application = facesContext.getApplication();
              HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE);
                   grid.setColumns(2);
              HtmlOutputText output = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
                   output.setValue(rs.getString("IB_CUSTREQSTPARA_NAME"));
                   ii=Integer.toString(i);
                   output.setId("a"+ii.toString());
                   System.out.println("id"+ii);
                   HtmlInputText input = (HtmlInputText)application.createComponent(HtmlInputText.COMPONENT_TYPE);
                   //input.setValue(rs.getString(1));
                   grid.getChildren().add(output);
                   grid.getChildren().add(input);
                   panelBind.getChildren().add(grid);
                   i++;
              catch(Exception e1)
                   System.out.println(e1);
         //Action listeners
         public void add(ActionEvent e)
              System.out.println("ADD");
    *</code>*
    Thank You,
    Anup

    Where are you stuck? find the component (UIComponent.findComponent) in the JSF component tree by its ID and get the value from it. This article might help:
    http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html
    Note: the code tag is \                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with application modules and switching from 2 tier to 3 tier mode

    Hello,
    I've got an application in 2 tier mode. Now I wanted to switch to 3 tier mode but get a class cast exception. It has turned out, that panelBinding.getApplication().getApplicationModule().findApplicationModule returns in 2 tier mode <ModuleName>Impl and in 3 tier mode oracle.jbo.client.remote.ApplicationModuleImpl. But searching for modul name with panelBinding.getApplication().getApplicationModule().getApplicationModuleNames() returns the right in names in 2 tier and in 3 tier mode. Does anybody know a way to access <ModulName>Impl in 3 tier mode?

    This is the reason that the BC4J project will create an <appmodulename>AM interface and a <appmodulename>AMClient Implementation that you include on the client side if you expose any methods in your app module. You should access them by casting it to the interface, NOT the appModuleImpl class. If you stick to using the interface, then you should be fine.
    So to keep your implementation flexible, you should do this on the client to access your custom methods on your app module:
    The BC4J project should generate the following classes:
    AppModule Name = MyCustomAM.xml
    AppModule Implementation = MyCustomAMImpl.java
    Custom AppModule Interface = /common/MyCustomAM.java
    Custom clientside AppModule Implementation = /client/MyCustomAMClient.java
    On the client, do the following:
    import my.bc4j.model.package.common.MyCustomAM;
    // Call custom method on App module
      MyCustomAM am = (MyCustomAM) panelBinding.getDataControl().getApplicationModule();
      am.myCustomMethod(someParams);Hope this helps.
    Erik

  • Open form - close form problem

    Hi. Using JDeveloper 10.1.3.3., ADF BC.
    Simple, yet not so simple problem: I have two forms, Main and Detail (JFrame). Main form has menu item which I use to open Detail form:
    try {
    FormDetail frmDetail = new FormDetail();
    frmDetail.setBindingContext(panelBinding.getBindingContext());
    // center jframe, visible = true
    showNewForm(frmDetail);
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    I want to create new instance every time I show Detail form. But I have problem closing detail form. Here is Detail constructor:
    public FormDetail() {
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    dispose();
    Here are actions:
    1) start Main form
    2) open Detail form
    3) close Detail form
    4) try to open Detail form - oracle.jbo.JboException 35001.
    I've read about this error, but I don't know how to avoid it.
    I cannot accept that I always have to use setVisible(true) and setVisible(false) on all my forms. There has to be a way to dispose of detail forms, and re-create them. Can someone please help?
    Also, read article on Re: ADF-JClient bug
    No solution there

    I have looked at it before. I am not working with MDI forms, so I cannot apply this.
    I found this article which could solve my problem, but I don't know how is "thedude" creating that Abstract class he was talking about...
    Link: Re: how to release panelbinding correctly?
    As I understood, I should release panel binding before I can release the form...
    Default behavior of detail form's window listener is Exit(0). I want to reinstantiate form every time I open it.

  • How to disappear the combobox

    I try the following code and i got some trouble.
    if I select the value in combobox (different value), the combobox will disappear.
    But when I select the default value, the combobox will not disappear.
    So, how can I disappear the combobox when user select the default value
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableComboBoxByRow extends JFrame
         ArrayList editors = new ArrayList(3);
         public TableComboBoxByRow()
              // Create the editors to be used for each row
              String[] items1 = { "Red", "Blue", "Green" };
              JComboBox comboBox1 = new JComboBox( items1 );
              DefaultCellEditor dce1 = new DefaultCellEditor( comboBox1 );
              editors.add( dce1 );
              String[] items2 = { "Circle", "Square", "Triangle" };
              JComboBox comboBox2 = new JComboBox( items2 );
              DefaultCellEditor dce2 = new DefaultCellEditor( comboBox2 );
              editors.add( dce2 );
              String[] items3 = { "Apple", "Orange", "Banana" };
              JComboBox comboBox3 = new JComboBox( items3 );
              DefaultCellEditor dce3 = new DefaultCellEditor( comboBox3 );
              editors.add( dce3 );
              //  Create the table with default data
              Object[][] data =
                   {"Color", "Red"},
                   {"Shape", "Square"},
                   {"Fruit", "Banana"},
                   {"Plain", "Text"}
              String[] columnNames = {"Type","Value"};
              DefaultTableModel model = new DefaultTableModel(data, columnNames);
              JTable table = new JTable(model)
                   //  Determine editor to be used by row
                   public TableCellEditor getCellEditor(int row, int column)
                        int modelColumn = convertColumnIndexToModel( column );
                        if (modelColumn == 1 && row < 3)
                             return (TableCellEditor)editors.get(row);
                        else
                             return super.getCellEditor(row, column);
              JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
         public static void main(String[] args)
              TableComboBoxByRow frame = new TableComboBoxByRow();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

    The following modification seems to work...
              final JTable table = new JTable(model)
              getContentPane().add( scrollPane );
              PopupMenuListener stopEditing = new PopupMenuListener() {
                   public void popupMenuWillBecomeVisible( PopupMenuEvent e ) {}
                   public void popupMenuWillBecomeInvisible( PopupMenuEvent e ) {
                        TableCellEditor editor = table.getCellEditor();
                        if ( editor != null )
                             editor.stopCellEditing();
                   public void popupMenuCanceled( PopupMenuEvent e ) {}
              comboBox1.addPopupMenuListener( stopEditing );
              comboBox2.addPopupMenuListener( stopEditing );
              comboBox3.addPopupMenuListener( stopEditing );          
         }

  • [Feature request] Runtime width of JTable columns based on attribute settings

    I'm wondering if it's possible to let 'JClient' dynamically resize the columns in a JTable. Eg: I have set the width of some attribute of some ViewObject to 3. But when I run the application all columns are equally sized. I tried changing the JTable's property autoResizeMode (figuring it might override settings by JClient), but that doesn't seem to have any effect.
    Also, 'grabbing' a column from the table through some manual coding and setting the width of that column doesn't seem to work either.
    I've posted something regarding JTable Re: for specifically RIZWAN from PAkistan or anyone, but I'm curious to know if this 'Specialised editor for Grid Control (JTable)' that Grant Ronald spoke of, will include some sort of applicable functionality.
    It's clear that we need some better (that is, 'any' ;)) way of manipulating columns in a JClient table.
    Any comments?
    Thanks.
    Arno

    We are currently looking into that.
    The column width should not be controlled from the model, it is a setting on JTable, We are considering providing a JClient control (JUTable ??), which is a JTable in a scrollpane and give you more power over column width, column headers etc....
    We are currently evaluating that.
    It would mean that you've got a table control with properties allowing you to set these things on the control itself.
    Currently you have to set the hints on the TableColumn.
    Here is an example :
    tableDeptView1.setModel(JUTableBinding.createAttributeListBinding(panelBinding, tableDeptView1, "DeptView1", null, "DeptView1Iter", new String[] {"Deptno", "Dname", "Loc"}));
    tableDeptView1.getColumn("Deptno").setMaxWidth(75);
    tableDeptView1.getColumn("Loc").setPreferredWidth(200);
    tableDeptView1.getColumn("Loc").setMinWidth(100);
    tableDeptView1.getColumn("Loc").setMaxWidth(450);

Maybe you are looking for