user.setImmediate(true);
user.setSelectable(true);
ArrayList<Resource> userArray = null;
final ResourceDAO userDAO = df.getResourceDAO();
try {
userArray = userDAO.getWorkersByProject(p);
user.addContainerProperty("User ID", String.class, null);
user.addContainerProperty("User Name", String.class, null);
// list.setVisibleColumns(new Object[] { "Type Name" });
for (int i = 0; i < userArray.size(); i++) {
Resource resUser = userArray.get(i);
user.addItem(
new Object[] {
Integer.toString(resUser.getResourceID()),
resUser.getResourceName() }, i);
}
} catch (DAOException e) {
e.printStackTrace();
}
leader.setHeight("100px");
leader.setImmediate(true);
leader.setSelectable(true);
ArrayList<Resource> leaderArray = null;
final ResourceDAO leaderDAO = df.getResourceDAO();
try {
leaderArray = userDAO.getLeadersByProject(p);
leader.addContainerProperty("Leader ID", String.class, null);
leader.addContainerProperty("Leader Name", String.class, null);
// list.setVisibleColumns(new Object[] { "Type Name" });
for (int i = 0; i < leaderArray.size(); i++) {
Resource resLeader = leaderArray.get(i);
leader.addItem(
new Object[] {
Integer.toString(resLeader.getResourceID()),
resLeader.getResourceName() }, i);
}
} catch (DAOException e) {
e.printStackTrace();
}
add.addListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = 1200365843348797837L;
public void buttonClick(ClickEvent event) {
try {
userDAO.updateUserTask(
Integer.parseInt(user.getItem(user.getValue())
.getItemProperty("User ID").toString()),
p.getProjectID(), true);
// me.getApplication().getMainWindow().setContent(new
// ProjectOptionsPageUI(u, p));
leader.removeAllItems();
ArrayList<Resource> leaderArray2 = null;
try {
leaderArray2 = userDAO.getLeadersByProject(p);
leader.addContainerProperty("Leader ID", String.class,
null);
leader.addContainerProperty("Leader Name",
String.class, null);
// list.setVisibleColumns(new Object[] { "Type Name" });
for (int i = 0; i < leaderArray2.size(); i++) {
Resource resLeader = leaderArray2.get(i);
leader.addItem(
new Object[] {
Integer.toString(resLeader
.getResourceID()),
resLeader.getResourceName() }, i);
}
} catch (DAOException e) {
e.printStackTrace();
}
user.removeAllItems();
ArrayList<Resource> userArray2 = null;
try {
userArray2 = userDAO.getWorkersByProject(p);
user.addContainerProperty("User ID", String.class, null);
user.addContainerProperty("User Name", String.class,
null);
// list.setVisibleColumns(new Object[] { "Type Name" });
for (int i = 0; i < userArray2.size(); i++) {
Resource resUser = userArray2.get(i);
user.addItem(
new Object[] {
Integer.toString(resUser
.getResourceID()),
resUser.getResourceName() }, i);
}
} catch (DAOException e) {
e.printStackTrace();
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProjectNeedsActiveLeaderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
remove.addListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = -8636303013936005088L;
public void buttonClick(ClickEvent event) {
try {
leaderDAO.updateUserTask(
Integer.parseInt(leader.getItem(leader.getValue())
.getItemProperty("Leader ID").toString()),
p.getProjectID(), false);
leader.removeAllItems();