CCM NG: JavaDoc for the classes of the PageModel admin UI
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5132 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
5cecc134a4
commit
53a9d54ced
|
|
@ -26,12 +26,14 @@ import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
import org.librecms.pagemodel.ContentItemComponent;
|
import org.librecms.pagemodel.ContentItemComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Basic form for all subclasses of {@link ContentItemComponent}.
|
||||||
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -40,13 +42,19 @@ import org.librecms.pagemodel.ContentItemComponent;
|
||||||
public abstract class AbstractContentItemComponentForm<T extends ContentItemComponent>
|
public abstract class AbstractContentItemComponentForm<T extends ContentItemComponent>
|
||||||
extends AbstractComponentModelForm<T> {
|
extends AbstractComponentModelForm<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant for the name of the {@link #modeField}.
|
||||||
|
*/
|
||||||
private static final String ITEM_MODE = "itemMode";
|
private static final String ITEM_MODE = "itemMode";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text field for {@link ContentItemComponent#mode}.
|
||||||
|
*/
|
||||||
private TextField modeField;
|
private TextField modeField;
|
||||||
|
|
||||||
public AbstractContentItemComponentForm(
|
public AbstractContentItemComponentForm(
|
||||||
final String name,
|
final String name,
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,20 @@
|
||||||
package com.arsdigita.cms.ui.pagemodel;
|
package com.arsdigita.cms.ui.pagemodel;
|
||||||
|
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.librecms.pagemodel.CategorizedItemComponent;
|
import org.librecms.pagemodel.CategorizedItemComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for editing/creating a {@link CategorizedItemComponent}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class CategorizedItemComponentForm
|
public class CategorizedItemComponentForm
|
||||||
extends AbstractContentItemComponentForm<CategorizedItemComponent> {
|
extends AbstractContentItemComponentForm<CategorizedItemComponent> {
|
||||||
|
|
||||||
public CategorizedItemComponentForm(
|
public CategorizedItemComponentForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
import com.arsdigita.bebop.form.Option;
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
import org.librecms.pagemodel.CategoryTreeComponent;
|
import org.librecms.pagemodel.CategoryTreeComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for creating/editing a {@link CategoryTreeComponent}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class CategoryTreeComponentForm extends AbstractComponentModelForm<CategoryTreeComponent> {
|
public class CategoryTreeComponentForm extends AbstractComponentModelForm<CategoryTreeComponent> {
|
||||||
|
|
@ -45,7 +46,7 @@ public class CategoryTreeComponentForm extends AbstractComponentModelForm<Catego
|
||||||
private CheckboxGroup showFullTreeCheckbox;
|
private CheckboxGroup showFullTreeCheckbox;
|
||||||
|
|
||||||
public CategoryTreeComponentForm(
|
public CategoryTreeComponentForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.cms.ui.assets.ItemSearchWidget;
|
import com.arsdigita.cms.ui.assets.ItemSearchWidget;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
|
|
@ -34,7 +34,8 @@ import org.librecms.contentsection.ContentItemRepository;
|
||||||
import org.librecms.pagemodel.FixedContentItemComponent;
|
import org.librecms.pagemodel.FixedContentItemComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for creating/editing a {@link FixedContentItemComponent}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class FixedContentItemComponentForm
|
public class FixedContentItemComponentForm
|
||||||
|
|
@ -45,7 +46,7 @@ public class FixedContentItemComponentForm
|
||||||
private ItemSearchWidget itemSearchWidget;
|
private ItemSearchWidget itemSearchWidget;
|
||||||
|
|
||||||
public FixedContentItemComponentForm(
|
public FixedContentItemComponentForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,20 @@
|
||||||
package com.arsdigita.cms.ui.pagemodel;
|
package com.arsdigita.cms.ui.pagemodel;
|
||||||
|
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.librecms.pagemodel.GreetingItemComponent;
|
import org.librecms.pagemodel.GreetingItemComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for creating/editing a {@link GreetingItemComponent}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GreetingItemComponentForm
|
public class GreetingItemComponentForm
|
||||||
extends AbstractContentItemComponentForm<GreetingItemComponent> {
|
extends AbstractContentItemComponentForm<GreetingItemComponent> {
|
||||||
|
|
||||||
public GreetingItemComponentForm(
|
public GreetingItemComponentForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,18 @@ import com.arsdigita.bebop.form.TextArea;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
|
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
import org.librecms.pagemodel.ItemListComponent;
|
import org.librecms.pagemodel.ItemListComponent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for adding/editing a {@link ItemListComponent}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class ItemListComponentForm
|
public class ItemListComponentForm
|
||||||
|
|
@ -59,7 +59,7 @@ public class ItemListComponentForm
|
||||||
private TextArea listOrderArea;
|
private TextArea listOrderArea;
|
||||||
|
|
||||||
public ItemListComponentForm(
|
public ItemListComponentForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import com.arsdigita.ui.admin.applications.ApplicationsTab;
|
||||||
import com.arsdigita.ui.admin.categories.CategoriesTab;
|
import com.arsdigita.ui.admin.categories.CategoriesTab;
|
||||||
import com.arsdigita.ui.admin.configuration.ConfigurationTab;
|
import com.arsdigita.ui.admin.configuration.ConfigurationTab;
|
||||||
import com.arsdigita.ui.admin.importexport.ImportExportTab;
|
import com.arsdigita.ui.admin.importexport.ImportExportTab;
|
||||||
import com.arsdigita.ui.admin.pagemodels.PageModelTab;
|
import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
|
||||||
import com.arsdigita.ui.admin.sites.SitesTab;
|
import com.arsdigita.ui.admin.sites.SitesTab;
|
||||||
import com.arsdigita.web.BaseApplicationServlet;
|
import com.arsdigita.web.BaseApplicationServlet;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
|
|
@ -126,10 +126,9 @@ public class AdminServlet extends BaseApplicationServlet {
|
||||||
ADMIN_BUNDLE)),
|
ADMIN_BUNDLE)),
|
||||||
new SitesTab());
|
new SitesTab());
|
||||||
|
|
||||||
tabbedPane.addTab(
|
tabbedPane.addTab(new Label(new GlobalizedMessage("ui.admin.tab.pagemodels.title",
|
||||||
new Label(new GlobalizedMessage("ui.admin.tab.pagemodels.title",
|
|
||||||
ADMIN_BUNDLE)),
|
ADMIN_BUNDLE)),
|
||||||
new PageModelTab());
|
new PageModelsTab());
|
||||||
|
|
||||||
tabbedPane.addTab(
|
tabbedPane.addTab(
|
||||||
new Label(new GlobalizedMessage(
|
new Label(new GlobalizedMessage(
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,32 @@ import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.pagemodel.ComponentModel;
|
import org.libreccm.pagemodel.ComponentModel;
|
||||||
import org.libreccm.pagemodel.ComponentModelRepository;
|
import org.libreccm.pagemodel.ComponentModelRepository;
|
||||||
import org.libreccm.pagemodel.PageModel;
|
import org.libreccm.pagemodel.PageModel;
|
||||||
import org.libreccm.pagemodel.PageModelManager;
|
|
||||||
import org.libreccm.pagemodel.PageModelRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base form for creating forms for editing/creating components of a
|
* Base form for creating forms for editing/creating components of a
|
||||||
* {@link PageModel}.
|
* {@link PageModel}.
|
||||||
*
|
*
|
||||||
|
* Subclasses must provided a constructor with the following signature:
|
||||||
|
* {@code SomeComponentModelForm(PageModelTab, ParameterSingleSelectionModel, ParameterSingleSelectionModel)}.
|
||||||
|
*
|
||||||
|
* This constructor has to call
|
||||||
|
* {@link #AbstractComponentModelForm(java.lang.String, com.arsdigita.ui.admin.pagemodels.PageModelsTab, com.arsdigita.bebop.ParameterSingleSelectionModel, com.arsdigita.bebop.ParameterSingleSelectionModel)}
|
||||||
|
*
|
||||||
|
* with the provided parameters and a unique name for the form. Usually this be
|
||||||
|
* the name of the component model which is associated with the form and the
|
||||||
|
* suffix {@code Form}.
|
||||||
|
*
|
||||||
|
* The constructor is called is using reflection. The parameters passed to the
|
||||||
|
* constructor are:
|
||||||
|
* <ol>
|
||||||
|
* <li>The {@link PageModelsTab} in which the form is displayed.</li>
|
||||||
|
* <li>The {@link ParameterSingleSelectionModel} which holds the ID of the
|
||||||
|
* currently selected {@link PageModel}.</li>
|
||||||
|
* <li>The {@link ParameterSingleSelectionModel} which holds the ID of the
|
||||||
|
* currently selected {@link ComponentModel}. The selected key of the selection
|
||||||
|
* model might be null if a new component model is created.</li>
|
||||||
|
* </ol>
|
||||||
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -59,9 +78,9 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
private static final String COMPONENT_KEY = "componentKey";
|
private static final String COMPONENT_KEY = "componentKey";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link PageModelTab} in which the form is used
|
* The {@link PageModelsTab} in which the form is used
|
||||||
*/
|
*/
|
||||||
private final PageModelTab pageModelTab;
|
private final PageModelsTab pageModelTab;
|
||||||
/**
|
/**
|
||||||
* ID of the selected {@link PageModel}.
|
* ID of the selected {@link PageModel}.
|
||||||
*/
|
*/
|
||||||
|
|
@ -86,7 +105,7 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
|
|
||||||
public AbstractComponentModelForm(
|
public AbstractComponentModelForm(
|
||||||
final String name,
|
final String name,
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
@ -96,11 +115,6 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
this.selectedModelId = selectedModelId;
|
this.selectedModelId = selectedModelId;
|
||||||
this.selectedComponentId = selectedComponentId;
|
this.selectedComponentId = selectedComponentId;
|
||||||
|
|
||||||
// keyField = new TextField(COMPONENT_KEY);
|
|
||||||
// keyField.setLabel(new GlobalizedMessage(
|
|
||||||
// "ui.admin.pagemodels.components.key.label",
|
|
||||||
// AdminUiConstants.ADMIN_BUNDLE));
|
|
||||||
// super.add(keyField);
|
|
||||||
createWidgets();
|
createWidgets();
|
||||||
|
|
||||||
super.addInitListener(this);
|
super.addInitListener(this);
|
||||||
|
|
@ -108,6 +122,12 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
super.addProcessListener(this);
|
super.addProcessListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method called by the constructor to create the widgets of the
|
||||||
|
* form. The method also calls the {@link #addWidgets()} after the basic
|
||||||
|
* widgets have been created and adds the {@link SaveCancelSection} at the
|
||||||
|
* end.
|
||||||
|
*/
|
||||||
private void createWidgets() {
|
private void createWidgets() {
|
||||||
keyField = new TextField(COMPONENT_KEY);
|
keyField = new TextField(COMPONENT_KEY);
|
||||||
keyField.setLabel(new GlobalizedMessage(
|
keyField.setLabel(new GlobalizedMessage(
|
||||||
|
|
@ -121,22 +141,57 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
super.add(saveCancelSection);
|
super.add(saveCancelSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final PageModelTab getPageModelTab() {
|
/**
|
||||||
|
* Provides access to the {@link PageModelsTab}.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final PageModelsTab getPageModelTab() {
|
||||||
return pageModelTab;
|
return pageModelTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access the {@link ParameterSingleSelectionModel} holding the ID
|
||||||
|
* of the currently selected {@link ComponentModel}. The selected key of the
|
||||||
|
* selection model is {@code null} if a new {@link ComponentModel} is
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected final ParameterSingleSelectionModel<String> getSelectedComponentId() {
|
protected final ParameterSingleSelectionModel<String> getSelectedComponentId() {
|
||||||
return selectedComponentId;
|
return selectedComponentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to the {@link ParameterSingleSelectionModel} holding the
|
||||||
|
* ID of the currently selected {@link PageModel}.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected final ParameterSingleSelectionModel<String> getSelectedModelId() {
|
protected final ParameterSingleSelectionModel<String> getSelectedModelId() {
|
||||||
return selectedModelId;
|
return selectedModelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to the {@link SaveCancelSection} of the form allowing
|
||||||
|
* subclasses to check if the <em>Save</em> button of the
|
||||||
|
* {@link SaveCancelSection} has been pressed.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected final SaveCancelSection getSaveCancelSection() {
|
protected final SaveCancelSection getSaveCancelSection() {
|
||||||
return saveCancelSection;
|
return saveCancelSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to the currently selected {@link PageModel}. The
|
||||||
|
* implementation for the init and validation listeners
|
||||||
|
* ({@link #init(com.arsdigita.bebop.event.FormSectionEvent)} and
|
||||||
|
* {@link #validate(com.arsdigita.bebop.event.FormSectionEvent)} initialise
|
||||||
|
* this field.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected final T getComponentModel() {
|
protected final T getComponentModel() {
|
||||||
return componentModel;
|
return componentModel;
|
||||||
}
|
}
|
||||||
|
|
@ -168,6 +223,21 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
PageState state,
|
PageState state,
|
||||||
FormData data);
|
FormData data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init listener for the component form. Subclasses should override this
|
||||||
|
* method to initialise their fields. If this method is overridden the
|
||||||
|
* overriding method <strong>must</strong> call {@code super.init(event)}.
|
||||||
|
* Otherwise the {@link #keyField} will not be initialised properly. Also
|
||||||
|
* the method loads the selected current component model from the database
|
||||||
|
* and stores it in the {@link #componentModel} field. Overriding methods
|
||||||
|
* can access the field using the {@link #getComponentModel()} method. If
|
||||||
|
* {@link super.init(event)} is not called the {@link #componentModel} field
|
||||||
|
* will not be initialised.
|
||||||
|
*
|
||||||
|
* @param event The event which caused the listener to be invoked.
|
||||||
|
*
|
||||||
|
* @throws FormProcessException
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
|
@ -192,6 +262,17 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validation listener for the component form. Subclasses should override
|
||||||
|
* this method to validate their fields if necessary.. If this method is
|
||||||
|
* overridden the overriding method <strong>must</strong> call
|
||||||
|
* {@code super.validate(event)}. Otherwise the {@link #keyField} will not
|
||||||
|
* be validated properly.
|
||||||
|
*
|
||||||
|
* @param event The event which caused the listener to be invoked.
|
||||||
|
*
|
||||||
|
* @throws FormProcessException
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void validate(final FormSectionEvent event)
|
public void validate(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
@ -215,8 +296,19 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process listener for the component form. This method can't be overridden.
|
||||||
|
* Instead subclasses have to implement
|
||||||
|
* {@link #updateComponentModel(org.libreccm.pagemodel.ComponentModel, com.arsdigita.bebop.PageState, com.arsdigita.bebop.FormData)}
|
||||||
|
* to set their specific values on the current component model. The
|
||||||
|
* implementation of that method is called by the this method.
|
||||||
|
*
|
||||||
|
* @param event The event which caused the listener to be invoked.
|
||||||
|
*
|
||||||
|
* @throws FormProcessException
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event)
|
public final void process(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
@ -263,6 +355,13 @@ public abstract class AbstractComponentModelForm<T extends ComponentModel>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for retrieving the component model from the database.
|
||||||
|
*
|
||||||
|
* @param componentModelId The ID of the component model to retrieve.
|
||||||
|
*
|
||||||
|
* @return The component model.
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private T retrieveComponentModel(final String componentModelId) {
|
private T retrieveComponentModel(final String componentModelId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,9 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Table used in the {@link PageModelDetails} component to list the components
|
||||||
|
* assigned to a {@link PageModel}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class ComponentsTable extends Table {
|
class ComponentsTable extends Table {
|
||||||
|
|
@ -54,7 +56,7 @@ class ComponentsTable extends Table {
|
||||||
protected static final int COL_DELETE = 3;
|
protected static final int COL_DELETE = 3;
|
||||||
|
|
||||||
public ComponentsTable(
|
public ComponentsTable(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,15 @@ import java.util.List;
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Shows the details about a {@link PageModel} including the
|
||||||
|
* {@link ComponentModel}s assigned to the {@link PageModel}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class PageModelDetails extends BoxPanel {
|
class PageModelDetails extends BoxPanel {
|
||||||
|
|
||||||
public PageModelDetails(
|
public PageModelDetails(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId,
|
final ParameterSingleSelectionModel<String> selectedModelId,
|
||||||
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
final ParameterSingleSelectionModel<String> selectedComponentId) {
|
||||||
|
|
||||||
|
|
@ -110,14 +112,18 @@ class PageModelDetails extends BoxPanel {
|
||||||
super.add(componentsTable);
|
super.add(componentsTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form for selecting the type of {@link ComponentModel} to add to the
|
||||||
|
* {@link PageModel}.
|
||||||
|
*/
|
||||||
private class AddComponentForm
|
private class AddComponentForm
|
||||||
extends Form
|
extends Form
|
||||||
implements FormProcessListener {
|
implements FormProcessListener {
|
||||||
|
|
||||||
private final PageModelTab pageModelTab;
|
private final PageModelsTab pageModelTab;
|
||||||
private final SingleSelect selectType;
|
private final SingleSelect selectType;
|
||||||
|
|
||||||
public AddComponentForm(final PageModelTab pageModelTab) {
|
public AddComponentForm(final PageModelsTab pageModelTab) {
|
||||||
|
|
||||||
super("pagemodel_add_component_form",
|
super("pagemodel_add_component_form",
|
||||||
new BoxPanel(BoxPanel.HORIZONTAL));
|
new BoxPanel(BoxPanel.HORIZONTAL));
|
||||||
|
|
@ -145,7 +151,7 @@ class PageModelDetails extends BoxPanel {
|
||||||
"ui.admin.pagemodels.add_new_component.submit",
|
"ui.admin.pagemodels.add_new_component.submit",
|
||||||
AdminUiConstants.ADMIN_BUNDLE));
|
AdminUiConstants.ADMIN_BUNDLE));
|
||||||
super.add(submit);
|
super.add(submit);
|
||||||
|
|
||||||
super.addProcessListener(this);
|
super.addProcessListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,6 +177,10 @@ class PageModelDetails extends BoxPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link PrintListener} implementation for the select box in the
|
||||||
|
* {@link AddComponentForm}.
|
||||||
|
*/
|
||||||
private class ComponentModelSelectPrintListener implements PrintListener {
|
private class ComponentModelSelectPrintListener implements PrintListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ import java.util.Optional;
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Form for creating a new {@link PageModel}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class PageModelForm extends Form {
|
class PageModelForm extends Form {
|
||||||
|
|
@ -63,7 +64,7 @@ class PageModelForm extends Form {
|
||||||
private static final String MODEL_TITLE = "model_title";
|
private static final String MODEL_TITLE = "model_title";
|
||||||
private static final String MODEL_DESC = "model_desc";
|
private static final String MODEL_DESC = "model_desc";
|
||||||
|
|
||||||
private final PageModelTab pageModelTab;
|
private final PageModelsTab pageModelTab;
|
||||||
private final ParameterSingleSelectionModel<String> selectedModelId;
|
private final ParameterSingleSelectionModel<String> selectedModelId;
|
||||||
|
|
||||||
private final TextField nameField;
|
private final TextField nameField;
|
||||||
|
|
@ -73,7 +74,7 @@ class PageModelForm extends Form {
|
||||||
private final SaveCancelSection saveCancelSection;
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
public PageModelForm(
|
public PageModelForm(
|
||||||
final PageModelTab pageModelTab,
|
final PageModelsTab pageModelTab,
|
||||||
final ParameterSingleSelectionModel<String> selectedModelId) {
|
final ParameterSingleSelectionModel<String> selectedModelId) {
|
||||||
|
|
||||||
super("pagemodelsform");
|
super("pagemodelsform");
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@ import java.util.Iterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Implementation of {@link PropertySheetModel} for the the property sheet used
|
||||||
|
* in {@link PageModelDetails} for displaying the basic properties of a
|
||||||
|
* {@link PageModel}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.bebop.PropertySheet;
|
import com.arsdigita.bebop.PropertySheet;
|
||||||
import com.arsdigita.bebop.PropertySheetModel;
|
import com.arsdigita.bebop.PropertySheetModel;
|
||||||
|
import com.arsdigita.bebop.PropertySheetModelBuilder;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
@ -29,6 +30,9 @@ import org.libreccm.pagemodel.PageModel;
|
||||||
import org.libreccm.pagemodel.PageModelRepository;
|
import org.libreccm.pagemodel.PageModelRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Implementation of {@link PropertySheetModelBuilder} for the the property
|
||||||
|
* sheet used in {@link PageModelDetails} for displaying the basic properties of
|
||||||
|
* a {@link PageModel}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* CDI bean encapsulating some actions for the components of the
|
||||||
|
* {@link PageModelTab}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -128,12 +130,12 @@ class PageModelsController implements Serializable {
|
||||||
final Class<? extends ComponentModel> clazz) {
|
final Class<? extends ComponentModel> clazz) {
|
||||||
|
|
||||||
final Optional<PageModelComponentModel> info = componentModels
|
final Optional<PageModelComponentModel> info = componentModels
|
||||||
.getComponentModelInfo(clazz);
|
.getComponentModelInfo(clazz);
|
||||||
|
|
||||||
if (info.isPresent()) {
|
if (info.isPresent()) {
|
||||||
final ResourceBundle bundle = ResourceBundle
|
final ResourceBundle bundle = ResourceBundle
|
||||||
.getBundle(info.get().descBundle());
|
.getBundle(info.get().descBundle());
|
||||||
|
|
||||||
return bundle.getString(info.get().titleKey());
|
return bundle.getString(info.get().titleKey());
|
||||||
} else {
|
} else {
|
||||||
return clazz.getName();
|
return clazz.getName();
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,11 @@ import org.libreccm.pagemodel.ComponentModel;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Tab for {@code /ccm/admin} for managing {@link PageModel}s.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class PageModelTab extends LayoutPanel {
|
public class PageModelsTab extends LayoutPanel {
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedModelId;
|
private final ParameterSingleSelectionModel<String> selectedModelId;
|
||||||
private final ParameterSingleSelectionModel<String> selectedComponentId;
|
private final ParameterSingleSelectionModel<String> selectedComponentId;
|
||||||
|
|
@ -52,7 +53,7 @@ public class PageModelTab extends LayoutPanel {
|
||||||
|
|
||||||
private Class<? extends ComponentModel> componentModelClass;
|
private Class<? extends ComponentModel> componentModelClass;
|
||||||
|
|
||||||
public PageModelTab() {
|
public PageModelsTab() {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
@ -101,11 +102,10 @@ public class PageModelTab extends LayoutPanel {
|
||||||
.getSelectedKey(state)));
|
.getSelectedKey(state)));
|
||||||
}
|
}
|
||||||
return formClass
|
return formClass
|
||||||
.getDeclaredConstructor(
|
.getDeclaredConstructor(PageModelsTab.class,
|
||||||
PageModelTab.class,
|
|
||||||
ParameterSingleSelectionModel.class,
|
ParameterSingleSelectionModel.class,
|
||||||
ParameterSingleSelectionModel.class)
|
ParameterSingleSelectionModel.class)
|
||||||
.newInstance(PageModelTab.this,
|
.newInstance(PageModelsTab.this,
|
||||||
selectedModelId,
|
selectedModelId,
|
||||||
selectedComponentId);
|
selectedComponentId);
|
||||||
} catch (InstantiationException
|
} catch (InstantiationException
|
||||||
|
|
@ -43,7 +43,8 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Table showing all available {@link PageModels}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class PageModelsTable extends Table {
|
class PageModelsTable extends Table {
|
||||||
|
|
@ -55,7 +56,7 @@ class PageModelsTable extends Table {
|
||||||
public static final int COL_REMOVE = 4;
|
public static final int COL_REMOVE = 4;
|
||||||
|
|
||||||
public PageModelsTable(
|
public PageModelsTable(
|
||||||
final PageModelTab parent,
|
final PageModelsTab parent,
|
||||||
final ParameterSingleSelectionModel<String> selectedPageModelId) {
|
final ParameterSingleSelectionModel<String> selectedPageModelId) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ package com.arsdigita.ui.admin.pagemodels;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Data for one row of the {@link PageModelsTable}.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class PageModelsTableRow implements Comparable<PageModelsTableRow>,
|
class PageModelsTableRow implements Comparable<PageModelsTableRow>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue