Some BugFixing for the CategoryMoveForm

git-svn-id: https://svn.libreccm.org/ccm/trunk@2498 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-01-23 14:23:05 +00:00
parent d4ba58f0f8
commit 2cafab36d3
3 changed files with 10 additions and 6 deletions

View File

@ -120,6 +120,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
setIntroPane(new Label(gz("cms.ui.category.intro"))); setIntroPane(new Label(gz("cms.ui.category.intro")));
setItemPane(new CategoryItemPane(m_model, setItemPane(new CategoryItemPane(m_model,
m_contextModel,
m_category, m_category,
getAddLink(), getAddLink(),
getEditLink(), getEditLink(),

View File

@ -87,6 +87,7 @@ class CategoryItemPane extends BaseItemPane {
private final SimpleContainer m_detailPane; private final SimpleContainer m_detailPane;
public CategoryItemPane(final SingleSelectionModel model, public CategoryItemPane(final SingleSelectionModel model,
final SingleSelectionModel contextModel,
final CategoryRequestLocal category, final CategoryRequestLocal category,
final ActionLink addLink, final ActionLink addLink,
final ActionLink editLink, final ActionLink editLink,
@ -130,7 +131,7 @@ class CategoryItemPane extends BaseItemPane {
//Move link //Move link
final ActionLink moveLink = new MoveLink(new Label(gz("cms.ui.category.move"))); final ActionLink moveLink = new MoveLink(new Label(gz("cms.ui.category.move")));
final Form moveForm = new CategoryMoveForm(m_category); final Form moveForm = new CategoryMoveForm(m_category, contextModel);
add(moveForm); add(moveForm);
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz( ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz(

View File

@ -58,10 +58,11 @@ public class CategoryMoveForm extends CMSForm {
private final CategoryRequestLocal selectedCategory; private final CategoryRequestLocal selectedCategory;
private final SaveCancelSection saveCancelSection; private final SaveCancelSection saveCancelSection;
private final ChangeListener changeListener; private final ChangeListener changeListener;
private final SingleSelectionModel selectionModel; //private final SingleSelectionModel selectionModel;
private final Tree categoryTree; private final Tree categoryTree;
public CategoryMoveForm(final CategoryRequestLocal selectedCategory) { public CategoryMoveForm(final CategoryRequestLocal selectedCategory,
final SingleSelectionModel contextModel) {
super("MoveCategory"); super("MoveCategory");
setMethod(Form.POST); setMethod(Form.POST);
@ -85,8 +86,8 @@ public class CategoryMoveForm extends CMSForm {
add(header, ColumnPanel.FULL_WIDTH); add(header, ColumnPanel.FULL_WIDTH);
changeListener = new TreeChangeListener(); changeListener = new TreeChangeListener();
selectionModel = new ParameterSingleSelectionModel(new StringParameter("selectedCategory")); //selectionModel = new ParameterSingleSelectionModel(new StringParameter("selectedCategory"));
categoryTree = new BaseTree(new CategoryTreeModelBuilder(selectionModel)); categoryTree = new BaseTree(new CategoryTreeModelBuilder(contextModel));
categoryTree.addChangeListener(changeListener); categoryTree.addChangeListener(changeListener);
add(categoryTree); add(categoryTree);
@ -146,7 +147,8 @@ public class CategoryMoveForm extends CMSForm {
@Override @Override
public void process(final FormSectionEvent event) throws FormProcessException { public void process(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
if (saveCancelSection.getSaveButton().isSelected(state)) { if (saveCancelSection.getSaveButton().isSelected(state)
&& !(categoryTree.getSelectedKey(state).equals(selectedCategory.getCategory(state).getID().toString()))) {
final Category categoryToMove = selectedCategory.getCategory(state); final Category categoryToMove = selectedCategory.getCategory(state);
final String targetKey = (String) categoryTree.getSelectedKey(state); final String targetKey = (String) categoryTree.getSelectedKey(state);