Adding a "revert to defaults" button

jpdk 1,3
I'd like to add a "revert to defaults" button
on my customize page. When I use PortletRendererUtil.renderCustomizeFormHeader(pr, out, null, "action", null, null) Only the 'apply' and 'ok' buttons are rendered. Do I have to do it manually or is there a utility I can use to do this?
thanks,
-sancho

You are right - the PDK article "Guidelines for Portlets in Edit Mode" describes such a button, which currently the JPDK doesn't support. Looking at some of the default portlets on a Portal home page, it would seem that the convention is now for this button to be called "Reset to Defaults". I have logged bug 1771249 against the JPDK and bug 1771238 against the articles to sort out these issues.

Similar Messages

  • JDialog Non Modal....Default button remains

    I've created a non modal JDialog
    By doing the following
    1. Creating an object of JOptionPane(message, JOptionPane.ERROR_MESSAGE)
    2. Adding the JOptionPane object to the ContentPane
    3. Creating a button
    4. Adding button("End Application") to ContentPane
    5. Adding listeners to window and button
    The result is a dialog
    Message
    ICON "OK" Button...............................NOT REQUIRED
    "End Application" Button
    I don't require the "OK" Button. Is there a way of removing this button. I need the dialog box to be modal so can't use showMessageDialog, rename "Ok" button to "End Application" etc.
    Should I be taking a different approach ie Not adding JOptionPane to JDialog??
    If the above isn't possible. Do you know where I can find the default error gif on error dialog boxes?
    Kind regards,
    Jean

    Get the error icon with UIMananger.getIcon("OptionPane.errorIcon"). It might throw exceptions while painting because it's expecting to be painting in a JOptionPane. Just catch and ignore the exceptions and it will paint alright.

  • Trying to re-add UPDATE and DELETE default buttons to a form

    I created a maintenance form by copying a form I use for inserting rows into a table. I deleted most of the form's default buttons.
    Now I'm trying to add the UPDATE and DELETE buttons to the cloned maintenance form, with no luck. When I look at the source
    for another maintenance form, the update button shows the following code:
    <INPUT TYPE="BUTTON" NAME="FORM_TEST1_MAINTENANCE.DEFAULT.UPDATE_TOP.01" VALUE="Update" onClick="if (validateWWVM281(this.form)) do_event(this.form,this.name,1,'ON_CLICK','');">
    The newly inserted UPDATE button's code is:
    <INPUT TYPE="BUTTON" NAME="FORM_TEST2_MAINTENANCE.DEFAULT.UPDATE_TOP.01" VALUE="Update" onClick=" do_event(this.form,this.name,1,'ON_CLICK','');">
    So...... I added the code "if (validateWWVM281(this.form))" (no quotes) to the button's ONCLICK area. The source code for the form now looks like this:
    <INPUT TYPE="BUTTON" NAME="FORM_TEST2_MAINTENANCE.DEFAULT.UPDATE_TOP.01" VALUE="Update" onClick="if (validateWWVM281(this.form)); do_event(this.form,this.name,1,'ON_CLICK','');">
    Note the semicolon after the IF statement.
    Bottom line.... if I wish to add a button to a form to replicate teh functions of a default button, how do I do this?

    In the PL/SQL Button Event Handler for UPDATE button select 'Update' and write the following code:
    doupdate;
    and for DELETE button select 'Delete' and write
    dodelete;
    You don't need any code in the OnClick for these buttons.
    Hope this helps.
    -Krishnamurthy

  • Default button being clicked multiple times when enter key is pressed

    Hello,
    There seems to be a strange difference in how the default button behaves in JRE 1.4.X versus 1.3.X.
    In 1.3.X, when the enter key was pressed, the default button would be "pressed down" when the key was pressed, but wouldn't be fully clicked until the enter key was released. This means that only one event would be fired, even if the enter key was held down for a long time.
    In 1.4.X however, if the enter key is pressed and held for more than a second, then the default button is clicked multiple times until the enter key is released.
    Consider the following code (which is just a dialog with a button on it):
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(jButton1);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    new SimpleDialog().show();
    When you compile and run this code under 1.3.1, and hold the enter key down for 10 seconds, you will only see one print line statement.
    However, if you compile and run this code under 1.4.1, and then hold the enter key down for 10 seconds, you will see about 100 print line statements.
    Is this a bug in 1.4.X or was this desired functionality (e.g. was it fixing some other bug)?
    Does anyone know how I can make it behave the "old way" (when the default button was only clicked once)?
    Thanks in advance if you have any advice.
    Dave

    Hello all,
    I think I have found a solution. The behaviour of the how the default button is triggered is contained withing the RootPaneUI. So, if I override the default RootPaneUI used by the UIDefaults with my own RootPaneUI, I can define that behaviour for myself.
    Here is my simple dialog with a button and a textfield (when the focus is NOT on the button, and the enter key is pressed, I don't want the actionPerformed method to be called until the enter key is released):
    package focustests;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(new JTextField("a text field"), BorderLayout.NORTH);
    this.getContentPane().add(jButton1, BorderLayout.SOUTH);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    javax.swing.UIManager.getDefaults().put("RootPaneUI", "focustests.MyRootPaneUI");
    new SimpleDialog().show();
    and the MyRootPaneUI class controls the behaviour for how the default button is handled:
    package focustests;
    import javax.swing.*;
    * Since we are using the Windows look and feel in our product, we should extend from the
    * Windows laf RootPaneUI
    public class MyRootPaneUI extends com.sun.java.swing.plaf.windows.WindowsRootPaneUI
    private final static MyRootPaneUI myRootPaneUI = new MyRootPaneUI();
    public static javax.swing.plaf.ComponentUI createUI(JComponent c) {
    return myRootPaneUI;
    protected void installKeyboardActions(JRootPane root) {
    super.installKeyboardActions(root);
    InputMap km = SwingUtilities.getUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    if (km == null) {
    km = new javax.swing.plaf.InputMapUIResource();
    SwingUtilities.replaceUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW, km);
    //when the Enter key is pressed (with no modifiers), trigger a "pressed" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, false), "pressed");
    //when the Enter key is released (with no modifiers), trigger a "release" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, true), "released");
    ActionMap am = SwingUtilities.getUIActionMap(root);
    if (am == null) {
    am = new javax.swing.plaf.ActionMapUIResource();
    SwingUtilities.replaceUIActionMap(root, am);
    am.put("press", new HoldDefaultButtonAction(root, true));
    am.put("release", new HoldDefaultButtonAction(root, false));
    * This is a copy of the static nested class DefaultAction which was
    * contained in the JRootPane class in Java 1.3.1. Since we are
    * using Java 1.4.1, and we don't like the way the new JRE handles
    * the default button, we will replace it with the old (1.3.1) way of
    * doing things.
    static class HoldDefaultButtonAction extends AbstractAction {
    JRootPane root;
    boolean press;
    HoldDefaultButtonAction(JRootPane root, boolean press) {
    this.root = root;
    this.press = press;
    public void actionPerformed(java.awt.event.ActionEvent e) {
    JButton owner = root.getDefaultButton();
    if (owner != null && SwingUtilities.getRootPane(owner) == root) {
    ButtonModel model = owner.getModel();
    if (press) {
    model.setArmed(true);
    model.setPressed(true);
    } else {
    model.setPressed(false);
    public boolean isEnabled() {
    JButton owner = root.getDefaultButton();
    return (owner != null && owner.getModel().isEnabled());
    This seems to work. Does anyone have any comments on this solution?
    Tjacobs, I still don't see how adding a key listeners or overriding the processKeyEvent method on my button would help. The button won't receive the key event unless the focus is on the button. There is no method "enableEvents(...)" in the AWTEventMulticaster. Perhaps you have some code examples? Thanks anyway for your help.
    Dave

  • Setting default button in JInternalFrame

    hi
    i had JInternalFrame screen which was added to an MDI Frame. when i am invoking my JInternalFrame screen from main menu, the default button is not working.
    i have coded like this in JInternalFrame screen:
    this.getRootPane().setDefaultButton(buttonOk);
    can anybody pls help me regarding this?
    thanx
    sarabh.

    try this
    getRootPane().setDefaultButton(btnOK);
          FocusAdapter resetDefaultButton = new FocusAdapter() {
          public void focusGained(FocusEvent e) {
             JButton button = (JButton) e.getSource();
             getRootPane().setDefaultButton(button);
          public void focusLost(FocusEvent e) {
             getRootPane().setDefaultButton(btnOK);
          };he default button can be set by using: getRootPane().setDefaultButton( button );
    However, the metal LAF and Windows LAF work differently once the default button has been set:
    a) Metal - the default button never changes, even when another button gains focus.
    b) Windows - when another button gains focus it becomes the default button. When you tab off this button, the original default button is never reset.
    Hope this helps
    Raheel

  • When I apply Stationary to an e mail the saved custom style reverts to default. What am I doing wrong?

    When I apply Stationary to an e mail the saved custom style reverts to default. What am I doing wrong?

    Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...

  • Reset to Defaults button in JSP portlet missing?

    Is there a reason why a customize page for a JSP portlet doesn't show a Reset to Defaults button? The PortletRendererUtil.renderCustomizeFormHeader() displays the Apply, OK, and Cancel buttons, but not Reset to Default. Is this just an oversight or is there some way that I haven't found to get it to display that button as well?
    Thanks!

    It's possible the default implementation does not include revert to default. You could subclass and include it.

  • How to Disable default button

    Hi all
    I am running on EP 6 SP 9
    I have a JSPDynPage with a HTMLB form which has a default button set using the defaultButton attribute of the form
    <hbj:button
         id="OKButton"
         text="<%= localString %>"
         width="70"
         design="EMPHASIZED"
         onClick="Search"
         onClientClick="dounload();disableControl(this)"
         >
         <%
          searchForm.setDefaultButton(OKButton);
         %>
    </hbj:button>
    now in the disableControl method I need to disable the button OKButton.
    the following js fuction does exactly that, the button is grayed out and cannot be clicked with the mouse
    function disableControl(control){
      control.setDisabled();
    however if I press Enter key the form apparently attempts to invoke the eventhandler for this button, this throws a js error: Object doesn't support this property or method
    the funny thing is that the line(18) this error occurs on does not contain any js code.
    Has anyone had this same problem or is there another way to change the forms default button using js?

    >>Uma
    I already tried this.
    serchForm is undefined in js
    adding the line as server side code in the js doesnt work either
    <%
      searchForm.setDefaultButton(null);
    %>
    I also tried to get the form from the control this way in disableControl js function
    function disableControl(control){
      control.setDisabled();
      var jsForm = control.form;
      jsForm.setDefaultButton(null);
    jsForm is undefined in the last line
    does anyone know how to get a reference to the HTMLB form of the page using javascript?

  • Default buttons not defaulting

    Hello. I am on the tail end of a DVD project and just begain encountering some unusual behavior with certain menus. This is a multiple-menu, multiple-video clips promotional DVD.
    Up to last week, the DVD has been working as expected in the simulator, in DVD Player (from the Video_TS folder and from a formatted disc), and in several set top players. Yesterday, though, in DVD Player from a formatted disc, the menus appear with no buttons visibly defaulted. The menu still behaves, though, as if the default button was selected (ie., if pressing "enter" activates the default button, and pressing an arrow button sends the selected state in the designated direction.) Each video asset returns to its menu with another default button, and these behave in the same way.
    I have already double-checked the connections between the buttons, menus, and videos, and they are set the way they have always been.
    - Can the preferences in DVDSP get corrupted (like they can in FCP)?
    - Can the DVDSP porject file become "bloated" or corrupted from going through too many revisions? If so, is there an easy way to put the current project into a new file?
    I expect that some people that view this disc will do so on a Mac, and I would like to clear this up if it is possible. Any ideas?
    Thank you!
    Listening,
    Aaron Kruse
    PowerMac G5, Dual 2GHz   Mac OS X (10.4.6)   3GB RAM, FCStudio 5.0 (DVDSP 4.0.3), Logic 7.2

    Aaron:
    I would try deleting all PAR and MPEG folders that DVDSP created during your authoring (inside the folders where your source files live) and make a clean build without reusing any of the previous VIDEO_TS folders. Probably some file is corrupted. If you want a FCP analogy, is like deleting your render files!
    Trashing preferences is a common preocedure . . . but like in FCP, ussually don't resolve problems. But it's like an aspirin, it will don't hurt your system. You can keep a copy of the pref file to restore in case you need.
    You could repair permissions and restart . . . just to be sure everything is cleaned in your system.
    I would try deleting all PAR and MPEG folders that DVDSP created during your authoring (inside the folders where your source files live) and make a clean build without reusing any of the previous VIDEO_TS folders.
    Probably with the specific experience in your problem psot something in the meantime!
    Hope it helps!
      Alberto

  • Snap mouse pointer to default button doesn't work

    Dear Community,
    I own a W520 with W7professional. My mouse is the ThinkPad bluetooth Laser Mouse.
    In the mouse properties window, I've activated the "Automatically move pointer to the default button in a dialog box" option but unfortunately it seems not working.
    Any idea?
    Best Regards,
    Marco

    hey calza_mc,
    try uninstalling the mouse drivers and reinstall it.
    also, do an update on your bluetooth drivers while you're at it
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    Have you checked out the Community Knowledgebase yet?!
    How to send a private message? --> Check out this article.

  • Pointer does not move to the default button in the dialog box

    example: when cleaning out trash the pointer does not go to the default button in the dialog box, you have to manually go there.
    This happens all the time.

    Hi Abhishek,
    In SAP this job shows completed till the 3rd step. and no error in the job log. but it does not execute the 4th and the 5th steps. And in Redwood, it shows completed for 1st and 2nd steps, 3rd step is in Error but has no error log. The 4th and 5th steps are in chained status. I have not amended the job chain after import. I have just scheduled it as it was running in the SAP system.
    Let me know if you need some further information on this.
    Regards
    madhu

  • Set default Button and provide a KeyEvent to a component with focus !!!

    What is to do ???
    I have following program:
    public class DefaultButton extends Frame implements ActionListener
         private Button close;
         public DefaultButton()
              super("Default-Button");
              setLayout(null);
              setSize(400, 200);
              setLocation(150, 100);
              setBackground(Color.lightGray);
              addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        setVisible(false);
                        dispose();
                        System.exit(0);
              // CloseButton
              close = new Button("Close");
              close.addActionListener(this);
              close.setVisible(true);
              close.setSize(100, 30);
              close.setLocation(290, 160);
              add(close);
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              String cmd = e.getActionCommand();
              if (cmd.equals("Close"))
                   setVisible(false);
                   dispose();
                   System.exit(0);
         public static void main(String [] args)
              DefaultButton wnd = new DefaultButton();
    }If I click on "Close"-button, the window will be closed. But, if the button "Close" has focus, it schold be possibile to close the window with a press on the Enter-Key? How to do it? How can I provide an KeyEvent to button "Close"?
    Tanks for any help.

    Hi pitalica!
    It is possible using KeyListener:
    public class DefaultButton extends Frame implements ActionListener, KeyListener {
    close.addKeyListener(this);
    public void keyPressed(KeyEvent e) {
    if ((e.getSource() instanceof Button)
    && (((Button) e.getSource()).getActionCommand == "Close")) {
    int kc = e.getKeyCode();
    if (kc == KeyEvent.VK_ENTER) {
    performs any action
    public void keyTyped(KeyEvent e) {}
    public void keyReleased(KeyEvent e) {}
    I hope it helps.

  • When I close CS6 changes in settings are not saved.  Reverts to default settings on reopen.  Why?

    When I close CS6 changes in settings are not saved.  Reverts to default settings on reopen.  Why?

    Sorry Photoshop --  Problems solved -- I read the details -- turns out you need to make changes with no files open for the preferences to apply to all files.
    Thanks,  Al

  • Default button in BOV should always be #1

    I have a number of Tracks with button overlay in a subtitle stream and Button Highlight activated (cyan/yellow marker).
    The buttons are used to change audio stream during playback.
    From a menu with 6 buttons I select a Track:
    Button 1 = Track 1
    Button 2 = Track 2
    and so on.
    What happens when I play the Track(s) is this:
    Track 1 > Button 1 selected
    Track 2 > Button 2 selected
    Track 3 > Button 3 selected
    etc.
    Is it possible to always select button #1 when starting to play a Track, no matter which menu button was used?
    As it is now, the user gets confused, since the Track is setup to play audio stream 1 in a pre-script (and this works fine).
    TIA
    Message was edited by: Niklas Wikman

    Problem solved. Double-click on the subtitle in the Track and set the Default button in the Button tab in the PI.

  • How to bring mouse cursor to the default button of a dialog, like in windows

    Anybody know how to achieve this in LV?
    Please see the attached screenshot.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Automatically move mouse pointer to the default button.PNG ‏34 KB

    Dear partha,
    1) You can be able to trace out the location of the button
    2) You can be able to move the cursor to that location
    3) You can be able to automatically generate a click on that button
    Use user32.dll to achieve all this. when u use it in CLN(Call Library Node), u can c functions 4 that.
    Try and ask if further help needed!!!!!
    Thanks,
    Mathan

Maybe you are looking for