added new panel for keyword detail dialog with supervisor info

This commit is contained in:
Emil Siverhall 2012-02-27 16:00:41 +01:00
parent e48f16cdb7
commit 1b38a5e172
2 changed files with 97 additions and 0 deletions
src/main/java/se/su/dsv/scipro/admin/panels/match

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<body>
<wicket:panel>
<form wicket:id="keywordDetails">
<table wicket:id="table" class="rounded-corner">
<thead>
<tr>
<th class="rounded-left-top">Supervisors with selected keyword </th>
<th class="rounded-right-top">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr wicket:id="listView">
<td colspan="2" wicket:id="name"></td>
</tr>
<tr><td colspan="2" wicket:id="emptyLabel"></td></tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" class="rounded-foot">&nbsp;</td>
</tr>
</tfoot>
</table>
<div wicket:id="navigator"></div>
<div class="prepend-top"><input wicket:id="closeButton" type="submit" value="Close" /></div>
</form>
</wicket:panel>
</body>
</html>

@ -0,0 +1,66 @@
package se.su.dsv.scipro.admin.panels.match;
import java.util.List;
import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PageableListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.match.dao.interfaces.SupervisorDao;
import se.su.dsv.scipro.match.dataobject.Keyword;
public class KeywordDetailsPanel extends Panel {
private static final long serialVersionUID = 1L;
@SpringBean
private SupervisorDao supervisorDao;
public KeywordDetailsPanel(String str, Keyword keyword) {
super(str);
add(new KeywordDetailsForm("keywordDetails", keyword));
}
private class KeywordDetailsForm extends Form<Keyword>{
private static final long serialVersionUID = 1L;
public KeywordDetailsForm(String id, final Keyword keyword) {
super(id);
this.setOutputMarkupId(true);
List<Employee> listOfSupervisors = supervisorDao.getSupervisorsByKeyword(keyword);
Label emptyLabel = new Label("emptyLabel","No supervisors attached to the selected keyword");
emptyLabel.setVisible(listOfSupervisors.isEmpty());
WebMarkupContainer container = new WebMarkupContainer("table");
container.setOutputMarkupId(true);
PageableListView<Employee> listView = new PageableListView<Employee>("listView", listOfSupervisors, 12) {
private static final long serialVersionUID = 2191181676642843499L;
@Override
protected void populateItem(ListItem<Employee> item) {
Employee e = item.getModelObject();
item.add(new Label("name", e.getNameAsString()));
}
};
container.add(listView);
container.add(emptyLabel);
AjaxPagingNavigator navigator = new AjaxPagingNavigator("navigator", listView);
navigator.setVisible(!listOfSupervisors.isEmpty());
add(navigator);
add(container);
Button closeButton = new Button("closeButton");
add(closeButton);
}
}
}