Java 3D Sidebar
 All Classes Namespaces Functions Variables
Sidebar Class Reference

This class is used for basic manipulation with sidebar like showing/hiding the sidebar or adding/removing widgets to sidebar. More...

Classes

enum  NaviType
 Type of navigation where sidebar will be used. More...
 

Public Member Functions

void show (boolean show)
 Shows or hides the sidebar. More...
 
int setWidget (int position, Widget widget)
 Puts the widget to the sidebar. More...
 
void updateWidget (Widget widget)
 Pushes the latest state of widget to sidebar. More...
 
Widget findWidgetByTag (String tag)
 Finds the Widget in sidebar. More...
 
void addLogo (String path, int x, int y, int width, int height)
 Adds the logo image to the sidebar. More...
 
void removeLogos ()
 Removes all logos that were added to the sidebar with addLogo(String, int, int, int, int) method. More...
 

Static Public Attributes

static final int RESULT_OK = 0
 Result code - OK. More...
 
static final int RESULT_FAILED = -1
 Result code - Unknown error. More...
 
static final int RESULT_FAILED_SPACE_OCCUPIED = -2
 Result code - Failed to add widget because another widget already exists on given position. More...
 
static final int RESULT_FAILED_DUPLICATE_TAG = -3
 Result code - Failed to add widget because another widget with this tag already exists in sidebar. More...
 
static final int WIDGET1 = 0
 Widget slot 1 in sidebar. More...
 
static final int WIDGET2 = 1
 Widget slot 2 in sidebar. More...
 
static final int WIDGET3 = 2
 Widget slot 3 in sidebar. More...
 
static final int WIDGET4 = 3
 Widget slot 4 in sidebar. More...
 

Package Functions

 Sidebar (ISidebarService service, Widget[] widgets)
 Package private constructor. More...
 

Detailed Description

This class is used for basic manipulation with sidebar like showing/hiding the sidebar or adding/removing widgets to sidebar.

Constructor & Destructor Documentation

Sidebar ( ISidebarService  service,
Widget[]  widgets 
)
package

Package private constructor.

Use SidebarConnection#connect method to obtain instance of Sidebar. Once the connection is created successfully, instance of Sidebar is provided in SidebarConnectionListener#onSidebarConnected callback as parameter.

See also
SidebarConnection
SidebarConnectionListener

Member Function Documentation

void addLogo ( String  path,
int  x,
int  y,
int  width,
int  height 
)

Adds the logo image to the sidebar.

Parameters
pathfull path of the logo image
x
y
width
height
Widget findWidgetByTag ( String  tag)

Finds the Widget in sidebar.

Parameters
tagtag of the widget to be found
Returns
widget with tag, or null if no such a widget exists.
void removeLogos ( )

Removes all logos that were added to the sidebar with addLogo(String, int, int, int, int) method.

int setWidget ( int  position,
Widget  widget 
)

Puts the widget to the sidebar.

If widget parameter is null, any existing widget on the given position will be removed.

Parameters
positionposition where to place widget. Use constants WIDGET1 .. WIDGET4
widgetwidget to be added. If null, any widget on the given position will be removed.
Returns
RESULT_OK if success
RESULT_FAILED_SPACE_OCCUPIED if widget cannot be placed to sidebar because another widget already exists at this position
RESULT_FAILED_DUPLICATE_TAG if widget with the same tag already exists in sidebar
RESULT_FAILED if other error occurs

References Widget.getTag(), Sidebar.RESULT_FAILED, and Sidebar.RESULT_FAILED_DUPLICATE_TAG.

void show ( boolean  show)

Shows or hides the sidebar.

Parameters
showuse true to show, false to hide the sidebar.
void updateWidget ( Widget  widget)

Pushes the latest state of widget to sidebar.

Widgets are not updated otherwise.

Parameters
widgetwidget to update. Must not be null.

Example:

TextWidget textWidget;
...
textWidget.setText("New text");
// text widget is still not updated in navigation sidebar
sidebar.updateWidget(textWidget); 
// now it is updated

Member Data Documentation

final int RESULT_FAILED = -1
static

Result code - Unknown error.

Referenced by Sidebar.setWidget().

final int RESULT_FAILED_DUPLICATE_TAG = -3
static

Result code - Failed to add widget because another widget with this tag already exists in sidebar.

Referenced by Sidebar.setWidget().

final int RESULT_FAILED_SPACE_OCCUPIED = -2
static

Result code - Failed to add widget because another widget already exists on given position.

final int RESULT_OK = 0
static

Result code - OK.

final int WIDGET1 = 0
static

Widget slot 1 in sidebar.

final int WIDGET2 = 1
static

Widget slot 2 in sidebar.

final int WIDGET3 = 2
static

Widget slot 3 in sidebar.

final int WIDGET4 = 3
static

Widget slot 4 in sidebar.