Merge branch 'keywordsWithSupervisorDetails' into develop
This commit is contained in:
commit
b91adacd6f
src/main/java/se/su/dsv/scipro
admin/panels/match
match/dao
@ -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"><span class="right" wicket:id="totalLabel"></span></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"> </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,68 @@
|
||||
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");
|
||||
Label totalNumberLabel = new Label("totalLabel", "Total: " + listOfSupervisors.size());
|
||||
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(totalNumberLabel);
|
||||
container.add(emptyLabel);
|
||||
AjaxPagingNavigator navigator = new AjaxPagingNavigator("navigator", listView);
|
||||
navigator.setVisible(!listOfSupervisors.isEmpty());
|
||||
add(navigator);
|
||||
add(container);
|
||||
Button closeButton = new Button("closeButton");
|
||||
|
||||
add(closeButton);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr wicket:id="keywordsDataView">
|
||||
<td wicket:id="name"></td>
|
||||
<td><a href="#" wicket:id="detailsLink"><span wicket:id="name"></span></a></td>
|
||||
<td wicket:id="type"></td>
|
||||
<td><a href="#" wicket:id="activeLink">
|
||||
<img wicket:id="activeIcon" /></a></td>
|
||||
|
@ -70,7 +70,7 @@ public class ManageKeywordPanel extends Panel {
|
||||
@Override
|
||||
protected void populateItem(final Item<Keyword> item) {
|
||||
item.setOutputMarkupId(true);
|
||||
Keyword keyword = item.getModelObject();
|
||||
final Keyword keyword = item.getModelObject();
|
||||
|
||||
final ImageObject editIcon = new ImageObject("editIcon", ImageObject.SIXTEEN + ImageObject.EDIT);
|
||||
|
||||
@ -85,6 +85,8 @@ public class ManageKeywordPanel extends Panel {
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
target.addComponent(dialog);
|
||||
dialog.setWidth(400);
|
||||
dialog.setHeight(225);
|
||||
dialog.setTitle("Edit keyword...");
|
||||
dialog.replace(new EditKeywordPanel("dialogContent", new Model<Keyword>(item.getModelObject())));
|
||||
dialog.open(target);
|
||||
@ -110,7 +112,23 @@ public class ManageKeywordPanel extends Panel {
|
||||
}
|
||||
};
|
||||
|
||||
item.add(new Label("name", new Model<String>(keyword.getKeyword())));
|
||||
final AjaxLink<Void> keywordDetailsLink = new AjaxLink<Void>("detailsLink") {
|
||||
|
||||
private static final long serialVersionUID = 1340379052190115333L;
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
target.addComponent(dialog);
|
||||
dialog.setWidth(500);
|
||||
dialog.setHeight(580);
|
||||
dialog.setTitle(keyword.getKeyword());
|
||||
dialog.replace(new KeywordDetailsPanel("dialogContent", keyword));
|
||||
dialog.open(target);
|
||||
}
|
||||
|
||||
};
|
||||
keywordDetailsLink.add(new Label("name", new Model<String>(keyword.getKeyword())));
|
||||
item.add(keywordDetailsLink);
|
||||
item.add(new Label("type", new Model<String>(keyword.getType().getName())));
|
||||
item.add(editLink);
|
||||
item.add(activeLink);
|
||||
|
@ -9,6 +9,7 @@ import se.su.dsv.scipro.data.dataobjects.Language;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dataobject.Availability;
|
||||
import se.su.dsv.scipro.match.dataobject.Keyword;
|
||||
|
||||
public interface SupervisorDao extends QueryableDao<Employee, SupervisorDaoParams>{
|
||||
|
||||
@ -19,6 +20,8 @@ public interface SupervisorDao extends QueryableDao<Employee, SupervisorDaoParam
|
||||
List<Employee> getCapableSupervisors(ProjectClass projectClass,
|
||||
Set<Language> languages);
|
||||
|
||||
List<Employee> getSupervisorsByKeyword(Keyword keyword);
|
||||
|
||||
List<Employee> getAutoCompleteCapableSupervisors(
|
||||
/*final ProjectClass projectClass, final Set<Language> languages,*/ final String searchString, int limit);
|
||||
|
||||
|
@ -95,6 +95,10 @@ SupervisorDao {
|
||||
new QuerySet().projectClass(projectClass).languages(languages)
|
||||
.fetchCallback());
|
||||
}
|
||||
|
||||
public List<Employee> getSupervisorsByKeyword(final Keyword keyword) {
|
||||
return getJpaTemplate().execute(new QuerySet().keyword(keyword).fetchCallback());
|
||||
}
|
||||
|
||||
public List<Employee> getAutoCompleteCapableSupervisors(
|
||||
/*final ProjectClass projectClass, final Set<Language> languages,*/
|
||||
@ -126,6 +130,15 @@ SupervisorDao {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public QuerySet keyword(Keyword keyword) {
|
||||
if (keyword != null) {
|
||||
getQuery().combine(
|
||||
new Query().join("_.keywords.keywords k").where("k = :keyword").parameter(
|
||||
"keyword", keyword)).distinct();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public QuerySet orderByUser() {
|
||||
getQuery().combine(RoleDaoJPAImp.orderByUserQuery());
|
||||
|
Loading…
x
Reference in New Issue
Block a user