TableView: Customize the Menu Bar |
Data Source: Relational Information Map
This example includes the following customizations:
Please install the latest webAF template updates prior to building this example. For more information about the server-side example templates used by this example, see Web Application Example Templates and Built-in Web Application Templates and Options.
The following example is not meant to be a complete Web application, rather it is to show how to use a particular component(s). The example does not address the issue of immediately freeing up resources when the user navigates off the Web application or closes the Web browser. Any necessary resources created in the example will stay around until the associated HTTPSession times out. If this example is used in a multi-user environment, it is possible to exhaust the available resources until HTTPSessions time out and free up their associated resources.
The following assumptions are made for all SAS AppDev Studio examples that use an Information Map as a data source. Please refer to the SAS Intelligence Platform administration documentation for information about any of these topics.
TableView
.InfoMapDefaultExampleControllerServlet.java
file in the Files Tab of the
Project Navigator.
Replace ENTER_MAP_NAME_HERE
in the following code:
String mapName = ENTER_MAP_NAME_HERE;with URL string for your information map.
omr_password
) in the
sas_metadata_source_omr.properties file located in the web-inf\conf
directory.
This password is used when deploying Foundation Services.metadata-password
)
under the InfoMapOLAPTableViewExampleControllerServlet's initial parameters in the
web.xml
file located in the web-inf
directory.
This password is used to get a user and session context from the Foundation Services.Add the following imports to the InfoMapTableViewExampleViewer.jsp file:
<%@page import="com.sas.servlet.tbeans.dataselectors.html.ActionProviderMenuBar"%> <%@page import="com.sas.actionprovider.ActionOrderList"%> <%@page import="com.sas.actionprovider.BaseAction"%> <%@page import="com.sas.actionprovider.HttpAction"%> <%@page import="com.sas.actionprovider.HttpActionProvider"%> <%@page import="com.sas.actionprovider.support.ActionProviderSupportTypes"%> <%@page import="com.sas.actionprovider.support.dataselectors.RelationalMenuBarAreaInterface" %> <%@page import="com.sas.servlet.tbeans.tableview.html.TableViewComposite"%>
Add the following scriptlet code before the closing <sas:TableViewComposite> tag:
<% { TableViewComposite tvc = (TableViewComposite) session.getAttribute("sas_TableView1_InfoMapTableViewExample"); HttpActionProvider sas_actionProvider = (HttpActionProvider)session.getAttribute("sas_actionProvider_InfoMapTableViewExample"); ActionProviderMenuBar mb = (ActionProviderMenuBar)tvc.getComponent(TableViewComposite.TABLEVIEW_MENUBAR); ActionOrderList alist = sas_actionProvider.getActionOrderList( ActionProviderSupportTypes.RELATIONAL_MENUBAR_SUPPORT, mb, RelationalMenuBarAreaInterface.SELECTOR_AREA); ActionOrderList editlist = (ActionOrderList)(alist.get(0)); // Remove the query selector for (int i=0; i<editlist.size(); i++) { String actiontype = (String)(editlist.get(i)); if ( actiontype != null && actiontype.equals( "DATAITEM_SELECTOR_ACTION" ) ) { editlist.remove(i); break; } } } %>
Alternately, you can add the following scriptlet code before the closing <sas:TableViewComposite> tag:
<% { TableViewComposite tvc = (TableViewComposite) session.getAttribute("sas_TableView1_InfoMapTableViewExample"); HttpActionProvider sas_actionProvider = (HttpActionProvider)session.getAttribute("sas_actionProvider_InfoMapTableViewExample"); ActionProviderMenuBar mb = (ActionProviderMenuBar)tvc.getComponent(TableViewComposite.TABLEVIEW_MENUBAR); ActionOrderList alist = sas_actionProvider.getActionOrderList( ActionProviderSupportTypes.RELATIONAL_MENUBAR_SUPPORT, mb, RelationalMenuBarAreaInterface.SELECTOR_AREA); ActionOrderList editlist = (ActionOrderList)(alist.get(0)); ActionOrderList newMenuBarlist = new ActionOrderList(); BaseAction mbaction = null; String actiontype = null; for (int i=0; i<editlist.size(); i++) { actiontype = (String)(editlist.get(i)); mbaction = sas_actionProvider.getDefaultAction( ActionProviderSupportTypes.RELATIONAL_MENUBAR_SUPPORT, RelationalMenuBarAreaInterface.SELECTOR_AREA,actiontype); if ( actiontype != null ) { if ( actiontype.equals( "SORT_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "SortAlphaAscending.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "SortAlphaAscending.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "SIMPLE_CALCULATED_ITEM_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "AddCalculatedItem.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "AddCalculatedItem_rollover.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "ADVANCED_FILTER_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "Filters.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "Filters_rollover.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "RANKING_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "TopTen.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "TopTen_rollover.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "TOTALS_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "total.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "total_rollover.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "PERCENT_CALCULATIONS_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "PercentOfTotals.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "PercentOfTotals.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "EXCEPTION_HIGHLIGHTING_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "Pencil.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "Pencil.gif" ); mbaction.putValue( HttpAction.NAME, null); } else if ( actiontype.equals( "DATAITEM_SELECTOR_ACTION" ) ) { mbaction.putValue( HttpAction.SMALL_ICON_NAME, "DataSource.gif"); mbaction.putValue( HttpAction.ROLLOVER_ICON_NAME, "DataSource_rollover.gif" ); mbaction.putValue( HttpAction.NAME, null); } } newMenuBarlist.add(actiontype); } // for newMenuBarlist.add(alist.get(1)); sas_actionProvider.setActionOrderList(ActionProviderSupportTypes.RELATIONAL_MENUBAR_SUPPORT, newMenuBarlist,mb,RelationalMenuBarAreaInterface.SELECTOR_AREA); } %>