See this image of Eclipse i have called EventController.java file from Events.zul file.
EventController.java-----------------------
package classes;
import java.util.List;
import org.zkoss.zul.*;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Listbox;
public class EventController extends GenericForwardComposer {
/*
*
*
*/
private static final long serialVersionUID = 1L;
EventDAO eventDAO = new EventDAO();
Event current = new Event();
Listbox box;
private Textbox name;
private Intbox priority;
public Event getCurrent() {
return current;
}
public void setCurrent(Event current) {
this.current = current;
}
public List
return eventDAO.findAll();
}
public void onClick$add() {
// insert into database
//System.out.println("CURRENT NAME : " + current.getName());
//System.out.println("CURRENT NAME : " + current.getPriority());
//Event newEvent = new Event(name.getText(), priority.getValue());
eventDAO.insert(current);
}
public void onClick$update() {
if (box.getSelectedItem() != null) {
// update database
eventDAO.update((Event) box.getSelectedItem().getValue());
}
}
public void onClick$delete() {
if (box.getSelectedItem() != null) {
eventDAO.delete((Event) box.getSelectedItem().getValue());
}
}
}
No comments:
Post a Comment