Java Examples for org.zkoss.zk.ui.select.annotation.Listen
The following java examples will help you to understand the usage of org.zkoss.zk.ui.select.annotation.Listen. These source code samples are taken from different open source projects.
Example 1
Project: zk-master File: Selectors.java View source code |
public void onMethod(Class<?> clazz, Method method, Listen anno) {
// check method signature
if ((method.getModifiers() & Modifier.STATIC) != 0)
throw new UiException("Cannot add forward to static method: " + method.getName());
// method should have 0 or 1 parameter
if (method.getParameterTypes().length > 1)
throw new UiException("Event handler method should have " + "at most one parameter: " + method.getName());
for (String[] strs : splitListenAnnotationValues(anno.value())) {
String name = strs[0];
if (name == null)
name = "onClick";
// http://tracker.zkoss.org/browse/ZK-2582
int prio = 0;
int idx = name.indexOf('(');
if (idx > 0) {
int li = name.indexOf(')');
prio = Integer.parseInt(name.substring(idx + 1, li));
name = name.substring(0, idx);
}
Iterable<Component> iter = iterable(component, strs[1]);
// no forwarding, just add to event listener
Set<Component> rewired = rewire ? new HashSet<Component>() : null;
for (Component c : iter) {
if (rewired != null && !rewired.contains(c)) {
rewired.add(c);
c.removeAttribute(EVT_LIS);
Iterable<EventListener<? extends Event>> listeners = c.getEventListeners(name);
if (listeners != null) {
for (EventListener<? extends Event> listener : listeners) if (listener instanceof ComposerEventListener)
c.removeEventListener(name, listener);
}
}
Set<String> set = getEvtLisSet(c, EVT_LIS);
String mhash = name + "#" + method.toString();
if (set.contains(mhash))
continue;
c.addEventListener(prio, name, new ComposerEventListener(method, controller));
set.add(mhash);
}
}
}
Example 2
Project: java_learn-master File: TodoListController.java View source code |
//when user clicks on the button or enters on the textbox
@Listen("onClick = #addTodo; onOK = #todoSubject")
public void doTodoAdd() {
//get user input from view
String subject = todoSubject.getValue();
if (Strings.isBlank(subject)) {
Clients.showNotification("Nothing to do ?", todoSubject);
} else {
//save data
selectedTodo = todoListService.saveTodo(new Todo(subject));
//update the model of listbox
todoListModel.add(selectedTodo);
//set the new selection
todoListModel.addToSelection(selectedTodo);
//refresh detail view
refreshDetailView();
//reset value for fast typing.
todoSubject.setValue("");
}
}
Example 3
Project: ZKRowlayout-master File: TestComposer.java View source code |
@Listen("onClick = #add")
public void addChild() {
int colspan = _colspan.getValue();
int offset = _offset.getValue();
if (_avail < colspan + offset) {
_curRow = new Rowlayout();
_curRow.setParent(_win);
_avail = 12;
}
Rowchildren rc = new Rowchildren();
rc.setColspan(colspan);
rc.setOffset(offset);
Window win = new Window();
win.setBorder("normal");
win.setTitle("colspan=" + colspan);
win.setHflex("1");
win.setParent(rc);
rc.setParent(_curRow);
_avail -= colspan + offset;
String js = "jq('.z-window-embedded-cnt').attr('contentEditable', '').css('min-height', '30px')";
Clients.evalJavaScript(js);
}
Example 4
Project: zats-master File: SearchComposer.java View source code |
@Listen("onSelect = listbox")
public void onSelect() {
selected = (Item) items.get(itemListbox.getSelectedIndex());
//display item detail
detailBox.setVisible(true);
detailCaption.setLabel(selected.getName());
descriptionLabel.setValue(selected.getDescription());
priceLabel.setValue(ItemRenderer.priceFormatter.format(selected.getPrice()));
quantityLabel.setValue(Integer.toString(selected.getQuantity()));
quantityLabel.setSclass(selected.getQuantity() < 3 ? "red" : "");
totalPriceLabel.setValue(ItemRenderer.priceFormatter.format(selected.getTotalPrice()));
}
Example 5
Project: dbvim-master File: BuilderComposer.java View source code |
@Listen("onClick = #tbbNewForm")
public void tbbNewForm_onClick() {
TableTreeNode table = modelTree.getSelectedTable();
if (table == null) {
Messagebox.show("Select a table first.", "Error", Messagebox.OK, Messagebox.EXCLAMATION);
return;
}
if (currentForm != null) {
Messagebox.show("Close form before creating the new one.");
}
if (currentForm == null) {
currentForm = new Form();
currentForm.setDBConnection(table.getConnection());
currentForm.setName("New untitled form");
currentForm.setTitle("Untitled Form");
currentForm.setTableName(table.getTable().getName());
currentForm.setCatalog(table.getTable().getCatalog());
currentForm.setView("");
// regular form
currentForm.setJoin(false);
setDefaultResultList(currentForm);
checkStudioStates();
}
}
Example 6
Project: zkckeditor-master File: B_ZKCK_12_Composer.java View source code |
@Listen("onClick=#btn1")
public void click1() {
Window window2 = (Window) editor.getParent().getFellow("window2");
window2.setVisible(true);
window2.doOverlapped();
cKeditor3 = new CKeditor();
Window window3 = new Window();
window3.setParent(window2.getParent());
window3.appendChild(cKeditor3);
window3.setClosable(true);
window3.setPosition("center");
window3.setTitle("Message!!!");
window3.doOverlapped();
}
Example 7
Project: organigramme-master File: OrganigrammeViewModel.java View source code |
/**
* Evenement qui se déclenche lors d'un click sur une entité côté client
*
* @param event
* : l'évenement click qui contient dans getData() l'id du li
* selectionné
*/
@Listen("onClickEntite = #organigramme")
public void onClickEntite(Event event) {
EntiteDto entiteDto = mapIdLiEntiteDto.get(event.getData());
EntiteDto entiteDtoFromBdd = entiteDto;
if (entiteDto != null) {
entiteDtoFromBdd = adsWSConsumer.getEntiteWithChildren(entiteDto.getIdEntite());
}
setEntity(entiteDtoFromBdd);
notifyChange(LISTE_PROP_A_NOTIFIER_ENTITE);
}
Example 8
Project: opensearchserver-master File: LoginComposer.java View source code |
@Listen("onClick = #submit; onOK = #password; onOK= #login")
public void onSubmit() throws WrongValueException, SearchLibException, InterruptedException {
login();
}