format och warning fixar

Change-Id: Ibbcf6e24f6b4b49830c1ca758c7bec91be940316
This commit is contained in:
joha-asc 2011-07-08 14:28:16 +02:00
parent 4252813c50
commit 1bb8c7e18a
2 changed files with 181 additions and 14 deletions
src/main/java/se/su/dsv/scipro/knol/resource/panels

@ -115,7 +115,6 @@ public class ResourceListPanel extends Panel {
private TextArea<String> infoEmbed;
private EditLinkResourceForm editLinkResourceForm;
private EditEmbedResourceForm editEmbedResourceForm;
private List<Resource> linkList;
private TextArea<String> embedTextArea;
private List<Resource> resourcesList;
private ResourceType resourceType;
@ -132,6 +131,9 @@ public class ResourceListPanel extends Panel {
listContainer.setOutputMarkupId(true);
listContainer.add(pagingNavigator = new CustomPagingNavigator(
"navigator", linkListView) {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return linkListView.size() > 0;
@ -182,6 +184,9 @@ public class ResourceListPanel extends Panel {
linkListView = new PageableListView<Resource>("link-item",
resourceList, 20) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Resource> item) {
final Resource resource = resourceDao.reLoad(item
@ -195,6 +200,11 @@ public class ResourceListPanel extends Panel {
if (resource.getHeading() == null) {
item.add(new ExternalLink("link", resource.getLink(),
resource.getLink()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return resource.getEmbedCode() == null;
@ -203,6 +213,11 @@ public class ResourceListPanel extends Panel {
} else {
item.add(new ExternalLink("link", resource.getLink(),
resource.getHeading()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return resource.getEmbedCode() == null;
@ -210,6 +225,11 @@ public class ResourceListPanel extends Panel {
});
}
item.add(new Label("heading", resource.getHeading()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return resource.getEmbedCode() != null;
@ -217,6 +237,11 @@ public class ResourceListPanel extends Panel {
});
item.add(new ExternalLink("linkAddress", resource.getLink(),
resource.getLink()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return resource.getEmbedCode() == null;
@ -259,6 +284,11 @@ public class ResourceListPanel extends Panel {
item.add(new ListView<Category>("category-item", resource.getCategoryList()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Category> item) {
final Category category = item.getModelObject();
@ -273,6 +303,11 @@ public class ResourceListPanel extends Panel {
});
item.add(new ListView<Tag>("tag-item", resource.getTagList()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Tag> item) {
final Tag tag = item.getModelObject();
@ -309,6 +344,10 @@ public class ResourceListPanel extends Panel {
item.add(new AjaxLink<String>("showComments",
new Model<String>("Show Comments")) {
/**
*
*/
private static final long serialVersionUID = 1L;
private boolean clicked = false;
@Override
@ -339,6 +378,10 @@ public class ResourceListPanel extends Panel {
}.add(comment));
item.add(new AjaxLink<Void>("deleteResource") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Resource link2 = resourceDao.reLoad(resource);
@ -390,6 +433,11 @@ public class ResourceListPanel extends Panel {
item.add(new AjaxLink<Recipient>("editResource") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editResource = resourceDao.reLoad(resource);
@ -435,6 +483,11 @@ public class ResourceListPanel extends Panel {
});
item.add(new HtmlWebMarkupContainer("embedCode", resource
.getEmbedCode()) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return resource.getEmbedCode() != null;
@ -454,6 +507,10 @@ public class ResourceListPanel extends Panel {
private class AddRateButton implements IClusterable {
/**
*
*/
private static final long serialVersionUID = 1L;
private AjaxLink<String> ajaxLinkUp, ajaxLinkDown;
public AddRateButton(ListItem<Resource> item) {
@ -529,6 +586,11 @@ public class ResourceListPanel extends Panel {
pointLabel.setOutputMarkupId(true);
ajaxLinkUp = new AjaxLink<String>("upLink", new Model<String>("Up")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Resource resourc = resourceDao.reLoad(resource);
@ -585,6 +647,11 @@ public class ResourceListPanel extends Panel {
ajaxLinkDown = new AjaxLink<String>("downLink", new Model<String>(
"Down")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Resource resourc = resourceDao.reLoad(resource);
@ -654,10 +721,13 @@ public class ResourceListPanel extends Panel {
private class EditLinkResourceForm extends Form<ResourceModel> {
/**
*
*/
private static final long serialVersionUID = 1L;
private ListView<Tag> tagListView;
private List<Tag> tagList;
private WebMarkupContainer tagListContainer;
private Collection<Category> selectedCategoryCollection = new ArrayList<Category>();
public EditLinkResourceForm(String name) {
super(name, new CompoundPropertyModel<ResourceModel>(
@ -691,6 +761,11 @@ public class ResourceListPanel extends Panel {
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
/**
*
*/
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -717,6 +792,11 @@ public class ResourceListPanel extends Panel {
add(new AjaxButton("submitButton", new Model<String>(
"Save Resource")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
editResource = resourceDao.reLoad(editResource);
@ -778,7 +858,7 @@ public class ResourceListPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -796,6 +876,11 @@ public class ResourceListPanel extends Panel {
tagListView = new ListView<Tag>("tag-item", tagList) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Tag> item) {
final Tag tag = item.getModelObject();
@ -810,6 +895,10 @@ public class ResourceListPanel extends Panel {
tagContainer
.add(deleteLink = new AjaxLink<Void>("deleteTag") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
tagList.remove(tag);
@ -844,10 +933,13 @@ public class ResourceListPanel extends Panel {
private class EditEmbedResourceForm extends Form<ResourceModel> {
/**
*
*/
private static final long serialVersionUID = 1L;
private ListView<Tag> tagListView;
private List<Tag> tagList;
private WebMarkupContainer tagListContainer;
private Collection<Category> selectedCategoryCollection = new ArrayList<Category>();
public EditEmbedResourceForm(String name) {
super(name, new CompoundPropertyModel<ResourceModel>(
@ -874,6 +966,11 @@ public class ResourceListPanel extends Panel {
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
/**
*
*/
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -903,6 +1000,11 @@ public class ResourceListPanel extends Panel {
add(new AjaxButton("submitButton", new Model<String>(
"Save Resource")) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
editResource = resourceDao.reLoad(editResource);
@ -965,7 +1067,7 @@ public class ResourceListPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -983,6 +1085,11 @@ public class ResourceListPanel extends Panel {
tagListView = new ListView<Tag>("tag-embed-item", tagList) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<Tag> item) {
final Tag tag = item.getModelObject();
@ -992,6 +1099,10 @@ public class ResourceListPanel extends Panel {
tagContainer.add(new Label("tagEmbed", tag.getTag()));
tagContainer.add(new AjaxLink<Void>("deleteTagEmbed") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
tagList.remove(tag);

@ -51,6 +51,8 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
*/
public class ResourcesPanel extends Panel {
private static final long serialVersionUID = 1L;
@SpringBean
private TagDao tagDao;
@ -107,6 +109,8 @@ public class ResourcesPanel extends Panel {
// editCategoriesDialog.setHeight(340);
editCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
private static final long serialVersionUID = 1L;
@Override
protected void execute(JsScopeContext scopeContext) {
scopeContext.append("window.location.reload()");
@ -128,6 +132,8 @@ public class ResourcesPanel extends Panel {
// addCategoriesDialog.setHeight(340);
addCategoriesDialog.setCloseEvent(new JsScopeUiEvent() {
private static final long serialVersionUID = 1L;
@Override
protected void execute(JsScopeContext scopeContext) {
scopeContext.append("window.location.reload()");
@ -142,6 +148,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxLink<String>("addLinkResource", new Model<String>(
"Add Link Resource")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.addComponent(linkDialog);
@ -152,6 +161,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxLink<String>("addEmbedResource", new Model<String>(
"Add Link Resource")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.addComponent(embedDialog);
@ -166,6 +178,8 @@ public class ResourcesPanel extends Panel {
AjaxLink<String> editCategories, addCategories;
add(editCategories = new AjaxLink<String>("adminCategories") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.addComponent(editCategoriesDialog);
@ -176,6 +190,8 @@ public class ResourcesPanel extends Panel {
add(addCategories = new AjaxLink<String>("addCategories") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.addComponent(addCategoriesDialog);
@ -187,6 +203,9 @@ public class ResourcesPanel extends Panel {
}
private class AddLinkResourceForm extends Form<ResourceModel> {
private static final long serialVersionUID = 1L;
public AddLinkResourceForm(String name) {
super(name, new CompoundPropertyModel<ResourceModel>(
new ResourceModel()));
@ -215,6 +234,8 @@ public class ResourcesPanel extends Panel {
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -244,6 +265,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("submitButton", new Model<String>(
"Save Resource")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
Resource link = new Resource();
@ -293,7 +317,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -302,12 +326,16 @@ public class ResourcesPanel extends Panel {
}
private class AddEmbedResourceForm extends Form<ResourceModel> {
private static final long serialVersionUID = 1L;
public AddEmbedResourceForm(String name) {
super(name, new CompoundPropertyModel<ResourceModel>(
new ResourceModel()));
final WebMarkupContainer feedbackContainer = new WebMarkupContainer(
"feedbackContainer");
feedbackContainer.setOutputMarkupId(true);
WebMarkupContainer feedbackPanel = new FormFeedbackPanel<ResourceModel>(
"feedbackPanel", this);
feedbackContainer.add(feedbackPanel);
@ -327,6 +355,8 @@ public class ResourcesPanel extends Panel {
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -354,6 +384,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("submitButton", new Model<String>(
"Save Resource")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
Resource link;
@ -408,7 +441,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -419,8 +452,8 @@ public class ResourcesPanel extends Panel {
private class EditCategoriesForm extends Form<CategoryModel> {
private static final long serialVersionUID = 1L;
private Category category;
private List<Category> categoryList;
public EditCategoriesForm(String name) {
super(name, new CompoundPropertyModel<CategoryModel>(
@ -439,6 +472,8 @@ public class ResourcesPanel extends Panel {
add(categoryName);
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -454,6 +489,9 @@ public class ResourcesPanel extends Panel {
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
"selectedCategory", new ListModel<Category>(
categoryDao.findAll()), choiceRenderer) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(Object selected) {
return "";
@ -482,6 +520,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("deleteCategory", new Model<String>(
"Delete Category")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (category != null) {
@ -530,7 +571,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -539,6 +580,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("editButton", new Model<String>("Save Edit")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (category == null) {
@ -565,7 +609,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
@ -573,6 +617,8 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("closeButton", new Model<String>("Close")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
editCategoriesDialog.close(target);
@ -581,7 +627,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
@ -591,7 +637,7 @@ public class ResourcesPanel extends Panel {
private class AddCategoriesForm extends Form<CategoryModel> {
private Category category;
private static final long serialVersionUID = 1L;
public AddCategoriesForm(String name) {
super(name, new CompoundPropertyModel<CategoryModel>(
@ -610,6 +656,8 @@ public class ResourcesPanel extends Panel {
add(categoryName);
IChoiceRenderer<Category> choiceRenderer = new IChoiceRenderer<Category>() {
private static final long serialVersionUID = 1L;
// Implement dispay here
public Object getDisplayValue(Category category) {
return category.getCategoryName();
@ -625,6 +673,9 @@ public class ResourcesPanel extends Panel {
final ListChoice<Category> categorySelectList = new ListChoice<Category>(
"selectedCategory", new ListModel<Category>(
categoryDao.findAll()), choiceRenderer) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(Object selected) {
return "";
@ -638,6 +689,9 @@ public class ResourcesPanel extends Panel {
add(new AjaxButton("addButton", new Model<String>("Add Category")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
CategoryModel categoryModel = (CategoryModel) form
@ -667,13 +721,15 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});
add(new AjaxButton("closeButton", new Model<String>("Close")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
addCategoriesDialog.close(target);
@ -682,7 +738,7 @@ public class ResourcesPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target,
final Form form) {
final Form<?> form) {
target.addComponent(feedbackContainer);
}
});