Menu

NavButton

Barry Goodsell

NavButton

Package [com.oaframework.toolkit.common.util]

The NavButton class implements the [UiEvent] interface, to provide an object that represents User Interface navigational push buttons. The class constructor is private; instances must be created by calling the static create method. This class effectively simplifies the means of identifying whether a button has been pressed or not. NavButton's can also be used as parameters to some of the methods in the [Navigation] class.

getName()

Returns the name of the NavButton.

create()

Static method to create a new NavButton instance.

isTriggered()

Returns true if the NavButton has been triggered (ie: pressed).

Usage

Suppose that you have defined three buttons in your User Interface: "Update", "Generate" and "Cancel". Update and Cancel are Standard buttons (defined below), whereas Generate will require us to declare a static instance of NavButton.

import com.oaframework.toolkit.util.NavButton;
import com.example.test.Navigation;

public class ExampleCO extends OAControllerImpl
{
  public static final NavButton GENERATE = NavButton.create("Generate");

  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    ....
  }

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    Navigation nav = new Navigation(pageContext, "test");

    // Navigate to TargetPagePG if the Cancel button has been pressed
    nav.conditionalForward(NavButton.CANCEL, "TargetPagePG");

    if (NavButton.UPDATE.isTriggered(pageContext))
    {
      // Handle Update button press
    }

    if (GENERATE.isTriggered(pageContext))
    {
      // Handle Generate button press
    }
  }
}

Standard Buttons

A number of standard buttons are defined in this class:

NavButton Name

CANCEL
Cancel

BACK
Back

NEXT
Next

SUBMIT
Submit

GO
Go

CLEAR
Clear

ACTION
Action

EDIT
Edit

APPLY
Apply

START
Start

SEARCH
Search

SELECT
Select

CONTINUE
Continue

CREATE
Create

UPDATE
Update

DELETE
Delete

DIALOG_OK
DialogOk

DIALOG_NO
DialogNo


Related

Wiki: Navigation
Wiki: UiEvent
Wiki: com.oaframework.toolkit.common.util

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.