public class Voting extends AndroidNonvisibleComponent implements Component
The application should call the method RequestBallot
, usually
in the Initialize
event handler, in order to get the ballot
question and options from the Web service (specified by the
ServiceURL
property). Depending on the response from the
Web service, the system will raise one of the following three events:
GotBallot
, indicating that the ballot question and options
were retrieved and the properties BallotQuestion
and
BallotOptions
have been set.NoOpenPoll
, indicating that no ballot question is
available.WebServiceError
, indicating that the service did not
provide a legal response and providing an error messages.After getting the ballot, the application should allow the user to make
a choice from among BallotOptions
and set the property
UserChoice
to that choice. The application should also set
UserId
to specify which user is voting.
Once the application has set UserChoice
and
UserId
, the application can call SendBallot
to
send this information to the Web service. If the service successfully
receives the vote, the event GotBallotConfirmation
will be
raised. Otherwise, the event WebServiceError
will be raised
with the appropriate error message.
form
ACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF
Constructor and Description |
---|
Voting(ComponentContainer container) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
BallotOptions()
The list of choices to vote.
|
java.lang.String |
BallotQuestion()
The question to be voted on.
|
void |
GotBallot()
Event indicating that a ballot was received from the Web service.
|
void |
GotBallotConfirmation()
Event confirming that the Voting service received the ballot.
|
void |
NoOpenPoll()
Event indicating that the service has no open poll.
|
void |
RequestBallot()
Send a request ballot command to the Voting server.
|
void |
SendBallot()
Send a ballot to the Web Voting server.
|
java.lang.String |
ServiceURL()
The URL of the Voting Service
|
void |
ServiceURL(java.lang.String serviceURL)
Set the URL of the Voting Service
|
java.lang.String |
UserChoice()
The choice to select when sending the vote.
|
void |
UserChoice(java.lang.String userChoice)
Set the choice to select when sending the vote.
|
java.lang.String |
UserEmailAddress()
Returns the registered email address, as a string, for this
device's user.
|
java.lang.String |
UserId()
An Id that is sent to the Web server along with the vote.
|
void |
UserId(java.lang.String userId)
Set an Id to be sent to the Web server along with the vote.
|
void |
WebServiceError(java.lang.String message)
Event indicating that the communication with the Web service resulted in
an error.
|
getDispatchDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDispatchDelegate
public Voting(ComponentContainer container)
public java.lang.String ServiceURL()
public void ServiceURL(java.lang.String serviceURL)
serviceURL
- the URL (includes initial http:, but no trailing slash)public java.lang.String BallotQuestion()
public java.util.List<java.lang.String> BallotOptions()
public java.lang.String UserId()
public void UserId(java.lang.String userId)
userId
- the string to use as the Idpublic java.lang.String UserChoice()
public void UserChoice(java.lang.String userChoice)
userChoice
- the choice to select. Must be one of the BallotOptionspublic java.lang.String UserEmailAddress()
public void RequestBallot()
public void GotBallot()
public void NoOpenPoll()
public void SendBallot()
public void GotBallotConfirmation()
public void WebServiceError(java.lang.String message)
message
- the error message