- Inlinesite springt jetzt nach dem Anlegen des Items direkt zum bearbeiten der BasicProperties

- Insitesite leitet jetzt zum nächsten Schritt weiter 


git-svn-id: https://svn.libreccm.org/ccm/trunk@2201 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-06-10 09:37:27 +00:00
parent 20f5c173c7
commit a97ec7426b
3 changed files with 122 additions and 115 deletions

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type label="Inline Site"
description="Inline view of external site"

View File

@ -35,58 +35,53 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject;
import java.text.DateFormat;
/**
* Authoring step to edit the simple attributes of the InlineSite content
* type (and its subclasses).
* Authoring step to edit the simple attributes of the InlineSite content type (and its subclasses).
*/
public class InlineSitePropertiesStep
extends SimpleEditStep {
public class InlineSitePropertiesStep extends SimpleEditStep {
/** The name of the editing sheet added to this step */
/**
* The name of the editing sheet added to this step
*/
public static final String EDIT_SHEET_NAME = "edit";
public InlineSitePropertiesStep( ItemSelectionModel itemModel,
AuthoringKitWizard parent ) {
super( itemModel, parent );
public InlineSitePropertiesStep(final ItemSelectionModel itemModel,
final AuthoringKitWizard parent) {
super(itemModel, parent);
BasicPageForm editSheet;
editSheet = new InlineSitePropertyForm( itemModel );
add( EDIT_SHEET_NAME, "Edit",
final BasicPageForm editSheet = new InlineSitePropertyForm(itemModel, this);
add(EDIT_SHEET_NAME, "Edit",
new WorkflowLockedComponentAccess(editSheet, itemModel),
editSheet.getSaveCancelSection().getCancelButton() );
editSheet.getSaveCancelSection().getCancelButton());
setDefaultEditKey(EDIT_SHEET_NAME);
setDisplayComponent( getInlineSitePropertySheet( itemModel ) );
setDisplayComponent(getInlineSitePropertySheet(itemModel));
}
/**
* Returns a component that displays the properties of the
* InlineSite specified by the ItemSelectionModel passed in.
* Returns a component that displays the properties of the InlineSite specified by the ItemSelectionModel passed in.
*
* @param itemModel The ItemSelectionModel to use
* @pre itemModel != null
* @return A component to display the state of the basic properties
* of the release
* @return A component to display the state of the basic properties of the release
*/
public static Component getInlineSitePropertySheet( ItemSelectionModel
itemModel ) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
public static Component getInlineSitePropertySheet(final ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
InlineSite.TITLE);
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
InlineSite.NAME );
InlineSite.NAME);
if (!ContentSection.getConfig().getHideLaunchDate()) {
sheet.add(GlobalizationUtil
.globalize("cms.contenttypes.ui.launch_date"),
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
@Override
public String format(DomainObject item,
String attribute,
PageState state) {
public String format(final DomainObject item,
final String attribute,
final PageState state) {
ContentPage page = (ContentPage) item;
if (page.getLaunchDate() != null) {
return DateFormat
@ -100,13 +95,13 @@ public class InlineSitePropertiesStep
}
});
}
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
InlineSite.DESCRIPTION);
sheet.add( InlineSiteGlobalizationUtil
sheet.add(InlineSiteGlobalizationUtil
.globalize("cms.contenttypes.ui.inlinesite.url"),
InlineSite.URL );
InlineSite.URL);
return sheet;
}
}

View File

@ -38,25 +38,29 @@ import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
/**
* Form to edit the basic properties of an InlineSite. This form can be
* extended to create forms for InlineSite subclasses.
* Form to edit the basic properties of an InlineSite. This form can be extended to create forms for InlineSite
* subclasses.
*/
public class InlineSitePropertyForm extends BasicPageForm
implements FormProcessListener, FormInitListener {
private TextField m_url;
private TextArea m_description;
private InlineSitePropertiesStep m_step;
/**
* Creates a new form to edit the InlineSite object specified
* by the item selection model passed in.
* @param itemModel The ItemSelectionModel to use to obtain the
* InlineSite to work on
* Creates a new form to edit the InlineSite object specified by the item selection model passed in.
*
* @param itemModel The ItemSelectionModel to use to obtain the InlineSite to work on
*/
public InlineSitePropertyForm(ItemSelectionModel itemModel) {
public InlineSitePropertyForm(final ItemSelectionModel itemModel) {
this(itemModel, null);
}
public InlineSitePropertyForm(final ItemSelectionModel itemModel, final InlineSitePropertiesStep step) {
super("inlineSiteEdit", itemModel);
m_step = step;
}
/**
@ -70,7 +74,8 @@ public class InlineSitePropertyForm extends BasicPageForm
m_description.setRows(5);
if (ContentSection.getConfig().mandatoryDescriptions()) {
m_description.addValidationListener(
new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing")));
new NotEmptyValidationListener(GlobalizationUtil.
globalize("cms.contenttypes.ui.description_missing")));
}
m_description.addValidationListener(
new StringInRangeValidationListener(
@ -79,35 +84,40 @@ public class InlineSitePropertyForm extends BasicPageForm
add(m_description);
add(new Label("URL:"));
ParameterModel urlParam
= new StringParameter("url");
ParameterModel urlParam = new StringParameter("url");
m_url = new TextField(urlParam);
m_url.setSize(40);
add(m_url);
}
/** Form initialisation hook. Fills widgets with data. */
/**
* Form initialisation hook. Fills widgets with data.
*/
public void init(FormSectionEvent fse) {
InlineSite site
= (InlineSite) super.initBasicWidgets(fse);
InlineSite site = (InlineSite) super.initBasicWidgets(fse);
m_url.setValue(fse.getPageState(),
site.getURL());
m_description.setValue(fse.getPageState(), site.getDescription());
}
/** Form processing hook. Saves InlineSite object. */
/**
* Form processing hook. Saves InlineSite object.
*/
public void process(FormSectionEvent fse) {
InlineSite site
= (InlineSite) super.processBasicWidgets(fse);
InlineSite site = (InlineSite) super.processBasicWidgets(fse);
// save only if save button was pressed
if (site != null
&& getSaveCancelSection().getSaveButton()
.isSelected(fse.getPageState())) {
site.setURL((String)m_url.getValue(fse.getPageState()));
site.setDescription((String)m_description.getValue(fse.getPageState()));
site.setURL((String) m_url.getValue(fse.getPageState()));
site.setDescription((String) m_description.getValue(fse.getPageState()));
site.save();
}
if (m_step != null) {
m_step.maybeForwardToNextStep(fse.getPageState());
}
}
}