diff --git a/ccm-cms-types-image/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Image.xml b/ccm-cms-types-image/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Image.xml index 2018aaa9a..cdc6f0ed6 100644 --- a/ccm-cms-types-image/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Image.xml +++ b/ccm-cms-types-image/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Image.xml @@ -13,25 +13,4 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml index 057b3a8a7..f44b951e9 100755 --- a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml +++ b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml @@ -85,6 +85,8 @@ + + + diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAddressPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAddressPropertiesStep.java index 5372fafe8..a5dc3d14a 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAddressPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAddressPropertiesStep.java @@ -17,6 +17,7 @@ import com.arsdigita.domain.DomainObject; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.SimpleComponent; import com.arsdigita.cms.contenttypes.GenericAddress; import com.arsdigita.cms.contenttypes.GenericContact; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; @@ -33,6 +34,8 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep { public static final String CHANGE_ADDRESS_SHEET_NAME = "changeAddress"; public static final String DELETE_ADDRESS_SHEET_NAME = "deleteAddress"; + private ItemSelectionModel itemModel; + /** Creates a new instance of GenericContactAddressPropertiesStep */ public GenericContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { this(itemModel, parent, ""); @@ -41,31 +44,20 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep { public GenericContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) { super(itemModel, parent, prefix); -// GenericContact contact = (GenericContact)itemModel.getSelectedObject(state); + this.itemModel = itemModel; -//XXX -// if(/*contact.getAddress() == null*/ true) { BasicPageForm attachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this); - add(ADD_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton()); - - /* Set the displayComponent for this step */ -// setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel)); - -// } else { - - // editAddress + BasicPageForm reattachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this); BasicPageForm editAddressSheet = new GenericContactEditAddressPropertyForm(itemModel, this); - add(EDIT_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_address").localize(), new WorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton()); - -// BasicPageForm attachAddressSheet = new GenericContactAttachAddressPropertyForm(itemModel, this); -// add(CHANGE_ADDRESS_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.reattach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton()); - BasicPageForm deleteAddressSheet = new GenericContactDeleteAddressForm(itemModel, this); - add(DELETE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address").localize(), new WorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton()); + + add(ADD_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_address").localize(), new AttachAddressWorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton()); + add(CHANGE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.reattach_address").localize(), new EditAddressWorkflowLockedComponentAccess(reattachAddressSheet, itemModel), reattachAddressSheet.getSaveCancelSection().getCancelButton()); + add(EDIT_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_address").localize(), new EditAddressWorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton()); + add(DELETE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address").localize(), new EditAddressWorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton()); /* Set the displayComponent for this step */ setDisplayComponent(getAddressPropertySheet(itemModel)); -// } } @@ -87,12 +79,13 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep { "address." + GenericAddress.ISO_COUNTRY_CODE, new DomainObjectPropertySheet.AttributeFormatter() { + @Override public String format(DomainObject item, String attribute, PageState state) { GenericAddress Address = ((GenericContact) item).getAddress(); if (Address != null && Address.getIsoCountryCode() != null) { - return Address.getCountryNameFromIsoCode(Address.getIsoCountryCode()); + return GenericAddress.getCountryNameFromIsoCode(Address.getIsoCountryCode()); } else { return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize(); } @@ -107,4 +100,32 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep { public static Component getEmptyBaseAddressPropertySheet(ItemSelectionModel itemModel) { return new Label(((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.emptyAddress").localize())); } + + private class EditAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess { + + public EditAddressWorkflowLockedComponentAccess(Component c, ItemSelectionModel i) { + super(c, i); + } + + @Override + public boolean isVisible(PageState state) { + GenericContact contact = (GenericContact) itemModel.getSelectedObject(state); + + return contact.hasAddress(); + } + } + + private class AttachAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess { + + public AttachAddressWorkflowLockedComponentAccess(Component c, ItemSelectionModel i) { + super(c, i); + } + + @Override + public boolean isVisible(PageState state) { + GenericContact contact = (GenericContact) itemModel.getSelectedObject(state); + + return !contact.hasAddress(); + } + } } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java index 1cc535fb9..d459f883f 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java @@ -83,6 +83,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple add(this.m_itemSearch); } + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); PageState state = fse.getPageState(); @@ -95,6 +96,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple } } + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); PageState state = fse.getPageState(); @@ -115,6 +117,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple try { getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() { + @Override public void prepare(PrintEvent e) { GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(e.getPageState()); Submit target = (Submit) e.getTarget(); @@ -138,6 +141,7 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm imple } } + @Override public void submitted(FormSectionEvent e) throws FormProcessException { if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) { init(e); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactEditAddressPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactEditAddressPropertyForm.java index 549967607..507160730 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactEditAddressPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactEditAddressPropertyForm.java @@ -78,7 +78,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme @Override public void addWidgets() { - add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize())); + add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.address").localize())); ParameterModel addressParam = new StringParameter(ADDRESS); addressParam.addParameterListener(new NotNullValidationListener()); addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); @@ -88,27 +88,27 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme add(address); if (!GenericContact.getConfig().getHideAddressPostalCode()) { - add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize())); + add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.postal_code").localize())); ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE); TextField postalCode = new TextField(postalCodeParam); /* XXX NumberListener ?*/ add(postalCode); } - add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize())); + add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.city").localize())); ParameterModel cityParam = new StringParameter(CITY); TextField city = new TextField(cityParam); add(city); if (!GenericContact.getConfig().getHideAddressState()) { - add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize())); + add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.state").localize())); ParameterModel stateParam = new StringParameter(STATE); TextField state = new TextField(stateParam); add(state); } if (!GenericContact.getConfig().getHideAddressCountry()) { - add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize())); + add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.iso_country_code").localize())); ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE); countryParam.addParameterListener(new StringInRangeValidationListener(0, 2)); @@ -125,6 +125,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme country.addValidationListener( new ParameterListener() { + @Override public void validate(ParameterEvent e) throws FormProcessException { ParameterData data = e.getParameterData(); String isoCode = (String) data.getValue(); @@ -139,6 +140,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme } + @Override public void init(FormSectionEvent fse) { FormData data = fse.getFormData(); PageState state = fse.getPageState(); @@ -155,6 +157,7 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme } } + @Override public void submitted(FormSectionEvent fse) { if (m_step != null && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) { @@ -162,18 +165,13 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme } } + @Override public void process(FormSectionEvent fse) { FormData data = fse.getFormData(); PageState state = fse.getPageState(); GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state); if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) { -// if (contact.getAddress() == null) { -// contact.setAddress(new GenericAddress()); -// contact.getAddress().setName("Address for " + contact.getName() + "(" + contact.getID() + ")"); -// contact.getAddress().setTitle("Address for " + contact.getName() + "(" + contact.getID() + ")"); -// } - contact.getAddress().setAddress((String) data.get(ADDRESS)); contact.getAddress().setPostalCode((String) data.get(POSTAL_CODE)); contact.getAddress().setCity((String) data.get(CITY)); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java index fa4d5621e..835f73cb1 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java @@ -140,6 +140,7 @@ public class ImageBrowser extends Table { public static abstract class LinkActionListener extends TableActionAdapter { + @Override public void cellSelected(TableActionEvent e) { int c = e.getColumn().intValue(); if (c == LINK) { @@ -157,6 +158,7 @@ public class ImageBrowser extends Table { // Renders a static image for the current asset private class ThumbnailCellRenderer implements TableCellRenderer { + @Override public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) { @@ -232,6 +234,7 @@ public class ImageBrowser extends Table { m_builder = b; } + @Override public TableModel makeModel(Table t, PageState s) { return new ImageModelAdapter( m_builder.makeModel((ImageBrowser) t, s)); @@ -253,14 +256,17 @@ public class ImageBrowser extends Table { m_model = m; } + @Override public int getColumnCount() { return ImageBrowser.NUM_COLUMNS; } + @Override public boolean nextRow() { return m_model.nextRow(); } + @Override public Object getElementAt(int columnIndex) { ImageAsset a = m_model.getImageAsset(); @@ -311,6 +317,7 @@ public class ImageBrowser extends Table { } } + @Override public Object getKeyAt(int columnIndex) { return m_model.getImageAsset().getID(); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java index 8444c6924..37949aeea 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java @@ -28,11 +28,9 @@ import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.ParameterEvent; import com.arsdigita.bebop.event.ParameterListener; -//import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.parameters.DateParameter; import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.bebop.parameters.ParameterModel; -//import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ItemSelectionModel; @@ -213,6 +211,7 @@ public abstract class BasicPageForm extends BasicItemForm { */ public class LaunchDateValidationListener implements ParameterListener { + @Override public void validate(final ParameterEvent e) { final ParameterData data = e.getParameterData(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/CategoryWidget.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/CategoryWidget.java index effb9d636..79c595795 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/CategoryWidget.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/CategoryWidget.java @@ -31,6 +31,7 @@ import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentSection; +import java.util.Arrays; import java.util.Set; import java.util.HashSet; import java.util.Map; @@ -54,13 +55,16 @@ public class CategoryWidget extends Widget { m_mode = mode; } + @Override protected String getType() { return "category"; } + @Override public boolean isCompound() { return false; } + @Override protected void generateWidget(PageState state, Element parent) { Element widget = parent.newChildElement("cms:categoryWidget", @@ -74,9 +78,7 @@ public class CategoryWidget extends Widget { BigDecimal[] values = (BigDecimal[])getValue(state); if (values != null) { - for (int i = 0 ; i < values.length ; i++) { - ids.add(values[i]); - } + ids.addAll(Arrays.asList(values)); } Category root = (Category)DomainObjectFactory.newInstance( @@ -132,8 +134,10 @@ public class CategoryWidget extends Widget { String fullname = path == null ? "/" : path + " > " + cat.getName(); el.addAttribute("fullname", fullname); - StringBuffer nodeID = new StringBuffer(parent.getAttribute("node-id")); - if (nodeID.length() > 0) nodeID.append("-"); + StringBuilder nodeID = new StringBuilder(parent.getAttribute("node-id")); + if (nodeID.length() > 0) { + nodeID.append("-"); + } nodeID.append(cat.getID()); el.addAttribute("node-id", nodeID.toString()); parent.addContent(el); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/CreationSelector.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/CreationSelector.java index 6ba194bd8..3d6202acb 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/CreationSelector.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/CreationSelector.java @@ -124,6 +124,7 @@ public class CreationSelector extends MetaForm { } + @Override public Form buildForm(PageState state) { BigDecimal typeID = (BigDecimal)m_typeSel.getSelectedKey(state); Component c = null; @@ -151,6 +152,7 @@ public class CreationSelector extends MetaForm { } // Add the item_id parameter + @Override public void register(Page p) { super.register(p); p.addComponentStateParam(this, m_itemId); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java index 3fa09ca8b..f0a4d2170 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.ActionEvent; @@ -120,6 +119,7 @@ public class SimpleEditStep extends SecurityPropertyEditor parent.getList().addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { PageState state = e.getPageState(); showDisplayPane(state); @@ -140,6 +140,7 @@ public class SimpleEditStep extends SecurityPropertyEditor * Registers globa state param for cancelling streamlined * creation */ + @Override public void register(Page p) { super.register(p); p.addGlobalStateParam(m_streamlinedCreationParam); @@ -200,6 +201,7 @@ public class SimpleEditStep extends SecurityPropertyEditor * * @param state the PageState */ + @Override public void pageRequested(RequestEvent e) { PageState state = e.getPageState(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java index 3c4414e23..23d46d34e 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java @@ -18,7 +18,6 @@ */ package com.arsdigita.cms.ui.category; - import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; @@ -46,84 +45,83 @@ import org.apache.log4j.Logger; * @version $Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $ */ public class CategoryLocalizationAddForm extends CategoryLocalizationForm { - - private static final Logger s_log = Logger.getLogger - (CategoryAddForm.class); - + + private static final Logger s_log = Logger.getLogger(CategoryAddForm.class); + /** Creates a new instance of CategoryLocalizationAddForm */ public CategoryLocalizationAddForm(final CategoryRequestLocal category) { - + super("AddCategoryLocalization", - gz("cms.ui.category.localization_add"), category); - + gz("cms.ui.category.localization_add"), category); + addInitListener(new InitListener()); addProcessListener(new ProcessListener()); - + } - + // Deaktivate this widget, if category is root // public boolean isVisible(PageState state) { // return !m_category.getCategory(state).isRoot(); // } - private class InitListener implements FormInitListener { + public final void init(final FormSectionEvent e) - throws FormProcessException { - + throws FormProcessException { + final PageState state = e.getPageState(); final Category category = m_category.getCategory(state); - + // Select one entry - m_locale.addOption(new Option("", + m_locale.addOption(new Option("", new Label((String) GlobalizationUtil.globalize( "cms.ui.select_one").localize())), state); - + // all supported languages (by registry entry) KernelConfig kernelConfig = Kernel.getConfig(); StringTokenizer strTok = kernelConfig.getSupportedLanguagesTokenizer(); - - while(strTok.hasMoreTokens()) { - + + while (strTok.hasMoreTokens()) { + String code = strTok.nextToken(); // If lanuage exists, remove it from the selection list - if(!category.getCategoryLocalizationCollection(). - localizationExists(code)) { + if (!category.getCategoryLocalizationCollection(). + localizationExists(code)) { m_locale.addOption(new Option(code, - new Locale(code).getDisplayLanguage()), state); - } + new Locale(code).getDisplayLanguage()), state); + } } } } - - + private final class ProcessListener implements FormProcessListener { + public final void process(final FormSectionEvent e) - throws FormProcessException { + throws FormProcessException { s_log.debug("Adding a categoryLocalization to category " + m_category); - + final PageState state = e.getPageState(); - + final Category category = m_category.getCategory(state); final String locale = (String) m_locale.getValue(state); final String name = (String) m_name.getValue(state); final String description = (String) m_description.getValue(state); final String url = (String) m_url.getValue(state); final String isEnabled = (String) m_isEnabled.getValue(state); - + // Was soll das?? //Assert.assertNotNull(parent, "Category parent"); - + if (s_log.isDebugEnabled()) { - s_log.debug("Adding localization for locale " + locale + - " to category " + category); + s_log.debug("Adding localization for locale " + locale + + " to category " + category); } - + if (category.canEdit()) { category.addLanguage(locale, name, description, url); category.setEnabled("yes".equals(isEnabled), locale); category.save(); - + } else { // XXX user a better exception here. // PermissionException doesn't work for this case. diff --git a/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderManipulator.java b/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderManipulator.java index cdfbea5fe..89074c3ee 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderManipulator.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderManipulator.java @@ -229,6 +229,7 @@ public class FolderManipulator extends SimpleContainer return m_itemView.getBrowser(); } + @Override public void process(FormSectionEvent e) { PageState s = e.getPageState(); if ( e.getSource() == m_itemView ) { @@ -249,6 +250,7 @@ public class FolderManipulator extends SimpleContainer } } + @Override public void validate(FormSectionEvent e) { ContentItem item; String name; @@ -308,6 +310,7 @@ public class FolderManipulator extends SimpleContainer } } + @Override public void submitted(FormSectionEvent e) throws FormProcessException { PageState s = e.getPageState(); @@ -317,6 +320,7 @@ public class FolderManipulator extends SimpleContainer } } + @Override public void reset(PageState s) { m_itemView.setVisible(s, true); m_itemView.reset(s); @@ -342,6 +346,7 @@ public class FolderManipulator extends SimpleContainer m_folderTree.setCellRenderer (new FolderTreeCellRenderer()); Label l = new Label(new PrintListener() { + @Override public void prepare(PrintEvent e) { PageState s = e.getPageState(); Label t = (Label) e.getTarget(); @@ -389,6 +394,7 @@ public class FolderManipulator extends SimpleContainer } } + @Override public void reset(PageState s) { m_folderTree.clearSelection(s); // FIXME: add a reset method to Tree and call that instead of this @@ -461,6 +467,7 @@ public class FolderManipulator extends SimpleContainer return m_browser; } + @Override public void reset(PageState s) { m_checkboxGroup.setValue(s, null); m_actionSel.setValue(s, null); @@ -469,6 +476,7 @@ public class FolderManipulator extends SimpleContainer // The renderer for the first column in the itemView table private class CheckboxRenderer implements TableCellRenderer { + @Override public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) { @@ -501,6 +509,7 @@ public class FolderManipulator extends SimpleContainer * are control links. Invalid folders are: the parent folder of the * sources, any of the sources, and any subfolders of the sources. */ + @Override public Component getComponent (Tree tree, PageState state, Object value, boolean isSelected, boolean isExpanded, boolean isLeaf, Object key) { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/workflow/WorkflowLockedComponentAccess.java b/ccm-cms/src/com/arsdigita/cms/ui/workflow/WorkflowLockedComponentAccess.java index e0072ebf5..6a90c248c 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/workflow/WorkflowLockedComponentAccess.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/workflow/WorkflowLockedComponentAccess.java @@ -38,9 +38,9 @@ import org.apache.log4j.Logger; public class WorkflowLockedComponentAccess extends ComponentAccess { private static final Logger s_log = - Logger.getLogger(WorkflowLockedComponentAccess.class); - + Logger.getLogger(WorkflowLockedComponentAccess.class); ItemSelectionModel m_itemModel; + /** * @param c The component */ @@ -54,7 +54,7 @@ public class WorkflowLockedComponentAccess extends ComponentAccess { * @param check An access check */ public WorkflowLockedComponentAccess(Component c, String check, ItemSelectionModel i) { - super(c,check); + super(c, check); m_itemModel = i; } @@ -68,22 +68,37 @@ public class WorkflowLockedComponentAccess extends ComponentAccess { * the access checks * @return true if all the access checks pass, false otherwise * */ - public boolean canAccess(PageState state, Security security) { - SecurityManager sm = Utilities.getSecurityManager(state); - ContentItem item = (ContentItem)m_itemModel.getSelectedObject(state); + @Override + public boolean canAccess(PageState state, Security security) { + SecurityManager sm = Utilities.getSecurityManager(state); + ContentItem item = (ContentItem) m_itemModel.getSelectedObject(state); - if (super.canAccess(state, security)) { - boolean smCheck = sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, - item); - if ( s_log.isDebugEnabled() ) { - s_log.debug("Superclass security check passed. SecurityManager check is " + - smCheck); - } - return smCheck; - } - s_log.warn("Returning false"); + if (isVisible(state) == true) { + if (super.canAccess(state, security)) { + boolean smCheck = sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, + item); + if (s_log.isDebugEnabled()) { + s_log.debug("Superclass security check passed. SecurityManager check is " + + smCheck); + } + return smCheck; + } + } - return false; - } + return false; + } + + /** + * Override this method to change visiblity of action link created by + * SecurityPropertyEditor add-method. If this method returns false, the + * link will be hidden, p.ex. to hide a delete link if the component is + * already empty. + * + * @param state The page state + * @return true for default behavior + */ + public boolean isVisible(PageState state) { + return true; + } } diff --git a/ccm-core/src/com/arsdigita/bebop/ActionLink.java b/ccm-core/src/com/arsdigita/bebop/ActionLink.java index 19071ea8f..b456fded0 100755 --- a/ccm-core/src/com/arsdigita/bebop/ActionLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ActionLink.java @@ -73,6 +73,7 @@ public class ActionLink extends ControlLink { * * @param s the current page state */ + @Override public void setControlEvent(PageState s) { s.setControlEvent(this); } diff --git a/ccm-core/src/com/arsdigita/bebop/ControlLink.java b/ccm-core/src/com/arsdigita/bebop/ControlLink.java index f4c4e8b37..2b171924d 100755 --- a/ccm-core/src/com/arsdigita/bebop/ControlLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ControlLink.java @@ -137,8 +137,9 @@ public class ControlLink extends BaseLink { */ protected void fireActionEvent(PageState state) { ActionEvent e = null; - if (m_actionListeners == null) + if (m_actionListeners == null) { return; + } for (int i=0; i < m_actionListeners.size(); i++ ) { if ( e == null ) { e = new ActionEvent(this, state); @@ -151,6 +152,7 @@ public class ControlLink extends BaseLink { * Responds to the incoming request. Fires the ActionEvent. * @param state the current page state */ + @Override public void respond(PageState state) { fireActionEvent(state); } @@ -162,12 +164,13 @@ public class ControlLink extends BaseLink { * @param state the current page state * @param parent the parent element */ + @Override protected void generateURL(PageState state, Element parent) { setControlEvent(state); try { parent.addAttribute("href", state.stateAsURL()); } catch (IOException e) { - e.printStackTrace(); +// e.printStackTrace(); parent.addAttribute("href", ""); } exportAttributes(parent); diff --git a/ccm-core/src/com/arsdigita/bebop/parameters/IncompleteDateParameter.java b/ccm-core/src/com/arsdigita/bebop/parameters/IncompleteDateParameter.java index 8b3d1abda..2a5fad7c3 100644 --- a/ccm-core/src/com/arsdigita/bebop/parameters/IncompleteDateParameter.java +++ b/ccm-core/src/com/arsdigita/bebop/parameters/IncompleteDateParameter.java @@ -127,7 +127,9 @@ public class IncompleteDateParameter extends DateParameter { c.set(Calendar.MONTH, Integer.parseInt(month)); } else { this.skippedMonth = true; - c.set(Calendar.MONTH, 1); + // BE AWARE: Java month counting is of by 1 because someone decided + // to start counting at 0, So january = 0 (not 1); + c.set(Calendar.MONTH, 0); } if (day != null && day.length() > 0) { this.skippedDay = false; diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java b/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java index 0bab46aac..7ed585084 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/SelectionPanel.java @@ -168,6 +168,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable { this(new Label(title), builder); } + @Override public void reset(final PageState state) { s_log.debug("Resetting to default initial state"); @@ -317,6 +318,7 @@ public class SelectionPanel extends LayoutPanel implements Resettable { } public class SelectionListener implements ChangeListener { + @Override public final void stateChanged(final ChangeEvent e) { s_log.debug("Selection state changed; I may change " + "the body's visible pane");