final DisclosurePanel addDisclosurePanel = new DisclosurePanel();
addDisclosurePanel.setHeader(add);
final TextArea message = new TextArea();
message.setSize(GadgetNativeUtils.getGadgetWidth() / 2 + "px","200px");
final VerticalPanel priority = new VerticalPanel();
final RadioButton highPriority = new RadioButton("priorityFilter",
prefsUtils.getMsg("gadgetLabelHigh"));
final RadioButton medPriority = new RadioButton("priorityFilter",
prefsUtils.getMsg("gadgetLabelMedium"));
final RadioButton lowPriority = new RadioButton("priorityFilter",
prefsUtils.getMsg("gadgetLabelLow"));
lowPriority.setValue(true);
priority.add(highPriority);
priority.add(medPriority);
priority.add(lowPriority);
final Button saveButton = new Button(
prefsUtils.getMsg("gadgetLabelSave"));
final PrioritySelection selection = new PrioritySelection(
viewPersonalNotesQry, viewPersonalNotesRequest);
addItemPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
addItemPanel.add(message);
addItemPanel.add(new HTML(" "));
addItemPanel.add(priority);
addItemPanel.add(new HTML(" "));
addItemPanel.add(saveButton);
/** This code is designed to demonstrate a ("custom")request
* to a server side method that is defined on the Gadget level
* the name of the server side method is explicitly set "doDeleteAll"
* with the setContentActoinName() method.
* @ see com.gadglet.gadgets.personalNotesApps.server.RequestHandler.deleteAll()
to test enable both client and server-side code
*/
final Button deleteAllButton = new Button(prefsUtils.getMsg("gadgetLabelDelete")+ " " + prefsUtils.getMsg("gadgetLabelAll"));
addItemPanel.add(UIUtils.getSpace());
addItemPanel.add(deleteAllButton);
deleteAllButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
changePersonalNoteQry.setContentActoinName("doDeleteAll");
changePersonalNoteQry.clearParamList();
addDeletePersonalNoteRequest.makeRequest();
}
});
addDisclosurePanel.add(addItemPanel);
mainPanel.add(addDisclosurePanel);
mainPanel.add(selection.getPanel());
mainPanel.add(results);
RootPanel.get().add(mainPanel.getGadgetPanel());
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
changePersonalNoteQry.setRequestAction(ReqActionTypes.ADD);
changePersonalNoteQry.clearParamList();
String priority = "";
if (highPriority.getValue())
priority = "1";
else if (medPriority.getValue())
priority = "2";
else
priority = "3";
changePersonalNoteQry.addParam(Params.PRIORITY.getParamName(), priority);
changePersonalNoteQry.addParam(Params.MESSAGE.getParamName(),
message.getValue());
addDeletePersonalNoteRequest.makeRequest();
message.setValue("");
}
});
viewPersonalNotesQry.setRequestAction(ReqActionTypes.VIEW);