Unfortunately, a rather complex update:

* new class DescriptiveComponent, provides setLabel and setHint
* classes Label, BaseLink and Widgets inherit from DescriptiveComponent and are ready to use setLabel and setHint
* classes TextStylable and Blockstylable removed, both provide direct html which the responsibility of the theme
* created Interface bebop/util/Panelcontraints to provide positional information for blocks fpr backwards compatibility. We have to decide whether to discard/replace or retain them.
* created cass Embedded as a kind of spinn-off from Label to handle arbitrary String data, specifically JavaScript. It's part of a strategy to remove Strings from Label to prevent developers just to hack fixed strings and make a mess of the User Interface.
* various reformatting and documentation added.


git-svn-id: https://svn.libreccm.org/ccm/trunk@2728 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2014-06-29 14:01:10 +00:00
parent 477b2a4946
commit 701f905998
98 changed files with 1611 additions and 765 deletions

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
*
* The contents of this file are subject to the CCM Public
* License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of
* the License at http://www.redhat.com/licenses/ccmpl.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
*/
package com.arsdigita.auth.http;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* <p>
* .
* Contains methods to simplify globalizing keys
* </p>
*
* @author <a href="mailto:sarnold@redhat.com">sarnold@redhat.com</a>
* @version $Revision: #1 $ $Date: 2003/07/28 $
*/
public class GlobalizationUtil implements Globalized {
private static final String BUNDLE_NAME = "com.arsdigita.auth.http.HTTPAuthResources";
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);
}
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
}

View File

@ -0,0 +1,12 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
auth.http.users_file=Users file
auth.http.users_processed=Users processed: <br />
auth.http.users_invalid=Invalid users: <br />
auth.http.users_failed=<br />Failed Users:&nbsp;
auth.http.value_dummy={0}
auth.http.user_domain=Domain
auth.http.user_name=&nbsp; Username
auth.http.ui.add_edit_user=Add/Edit User

View File

@ -0,0 +1,12 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
auth.http.users_file=Users file
auth.http.users_processed=Users processed: <br />
auth.http.users_invalid=Invalid users: <br />
auth.http.users_failed=<br />Failed Users:&nbsp;
auth.http.value_dummy={0}
auth.http.user_domain=Domain
auth.http.user_name=&nbsp; Username
auth.http.ui.add_edit_user=Benutzer hinzuf\u00fcgen / bearbeiten

View File

@ -0,0 +1,12 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
auth.http.users_file=Users file
auth.http.users_processed=Users processed: <br />
auth.http.users_invalid=Invalid users: <br />
auth.http.users_failed=<br />Failed Users:&nbsp;
auth.http.value_dummy={0}
auth.http.user_domain=Domain
auth.http.user_name=&nbsp; Username
auth.http.ui.add_edit_user=Add/Edit User

View File

@ -0,0 +1,12 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
auth.http.users_file=Users file
auth.http.users_processed=Users processed: <br />
auth.http.users_invalid=Invalid users: <br />
auth.http.users_failed=<br />Failed Users:&nbsp;
auth.http.value_dummy={0}
auth.http.user_domain=Domain
auth.http.user_name=&nbsp; Username
auth.http.ui.add_edit_user=Add/Edit User

View File

@ -32,6 +32,7 @@ import com.arsdigita.bebop.list.ListCellRenderer;
import com.arsdigita.bebop.list.ListModel; import com.arsdigita.bebop.list.ListModel;
import com.arsdigita.bebop.list.ListModelBuilder; import com.arsdigita.bebop.list.ListModelBuilder;
import com.arsdigita.dispatcher.MultipartHttpServletRequest; import com.arsdigita.dispatcher.MultipartHttpServletRequest;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.io.File; import java.io.File;
@ -60,13 +61,17 @@ public class UpdateUsersForm extends Form
private List m_invalidUserList; private List m_invalidUserList;
private List m_failedUserList; private List m_failedUserList;
/**
*
*/
public UpdateUsersForm() { public UpdateUsersForm() {
super( "updateUsers" ); super( "updateUsers" );
setMethod( Form.POST ); setMethod( Form.POST );
setEncType("multipart/form-data"); setEncType("multipart/form-data");
m_uploadForm.add( new Label( "Users file" ) ); m_uploadForm.add( new Label(GlobalizationUtil
.globalize("auth.http.users_file")));
m_uploadForm.add( m_uploadFile ); m_uploadForm.add( m_uploadFile );
m_uploadForm.add( m_uploadSubmit ); m_uploadForm.add( m_uploadSubmit );
@ -77,12 +82,20 @@ public class UpdateUsersForm extends Form
m_invalidUserList.setCellRenderer( this ); m_invalidUserList.setCellRenderer( this );
m_failedUserList.setCellRenderer( this ); m_failedUserList.setCellRenderer( this );
m_displayAction.add( new Label( "Users processed:" ) ); m_displayAction.add( new Label(GlobalizationUtil
m_displayAction.add( new Label( "<p>", false)); .globalize("auth.http.users_processed"),
m_displayAction.add( new Label( "Invalid users:" ) ); false));
// m_displayAction.add( new Label( "<p>", false));
// m_displayAction.add( new Label( "Invalid users:" ) );
m_displayAction.add( new Label(GlobalizationUtil
.globalize("auth.http.users_invalid"),
false));
m_displayAction.add( m_invalidUserList ); m_displayAction.add( m_invalidUserList );
m_displayAction.add( new Label( "<p>", false ) ); // m_displayAction.add( new Label( "<p>", false ) );
m_displayAction.add( new Label( "Failed users:" ) ); // m_displayAction.add( new Label( "Failed users:" ) );
m_displayAction.add( new Label(GlobalizationUtil
.globalize("auth.http.users_failed"),
false));
m_displayAction.add( m_failedUserList ); m_displayAction.add( m_failedUserList );
add( m_displayAction ); add( m_displayAction );
@ -90,9 +103,13 @@ public class UpdateUsersForm extends Form
addProcessListener( this ); addProcessListener( this );
} }
@Override
public Component getComponent( List list, PageState state, Object value, public Component getComponent( List list, PageState state, Object value,
String key, int index, boolean isSelected ) { String key, int index, boolean isSelected ) {
return new Label( value.toString() ); String[] values = new String[1];
values[0] = value.toString();
return new Label( GlobalizationUtil
.globalize("auth.http.value_dummy", values) );
} }
private class UserCSVListModel implements ListModelBuilder { private class UserCSVListModel implements ListModelBuilder {

View File

@ -17,6 +17,7 @@ package com.arsdigita.auth.http.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -28,6 +29,7 @@ import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.ui.admin.GlobalizationUtil;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import java.util.TooManyListenersException; import java.util.TooManyListenersException;
@ -40,7 +42,8 @@ public class UserManageForm extends Form {
private SingleSelect m_domainSelect = new SingleSelect( DOMAIN_SELECT ); private SingleSelect m_domainSelect = new SingleSelect( DOMAIN_SELECT );
private TextField m_domainField = new TextField( DOMAIN_FIELD ); private TextField m_domainField = new TextField( DOMAIN_FIELD );
private TextField m_username = new TextField( USERNAME ); private TextField m_username = new TextField( USERNAME );
private Submit m_submit = new Submit( "Add/Edit User" ); private Submit m_submit = new Submit(GlobalizationUtil
.globalize("auth.http.ui.add_edit_user"));
private ColumnPanel m_editForm = new ColumnPanel( 2 ); private ColumnPanel m_editForm = new ColumnPanel( 2 );
@ -57,7 +60,14 @@ public class UserManageForm extends Form {
( "com.arsdigita.auth.ntlm.GetDomains" ); ( "com.arsdigita.auth.ntlm.GetDomains" );
while ( q.next() ) { while ( q.next() ) {
String domain = q.getParameter( "domain" ).toString(); String domain = q.getParameter( "domain" ).toString();
m_domainSelect.addOption( new Option( domain ), ps ); String[] doms = new String[1];
doms[0] = domain;
m_domainSelect
.addOption( new Option( domain,
(Component)GlobalizationUtil
.globalize("auth.http.value_dummy"
,doms))
, ps );
} }
} }
} ); } );
@ -73,10 +83,14 @@ public class UserManageForm extends Form {
BoxPanel userSearch = new BoxPanel( BoxPanel.HORIZONTAL ); BoxPanel userSearch = new BoxPanel( BoxPanel.HORIZONTAL );
userSearch.add( new Label( "Domain" ) ); //userSearch.add( new Label( "Domain" ) );
userSearch.add( new Label( GlobalizationUtil
.globalize("auth.http.user_domain")) );
userSearch.add( domainEntry ); userSearch.add( domainEntry );
userSearch.add( new Label( "&nbsp", false ) ); // userSearch.add( new Label( "&nbsp", false ) );
userSearch.add( new Label( "Username" ) ); // userSearch.add( new Label( "Username" ) );
userSearch.add( new Label( GlobalizationUtil
.globalize("auth.http.user_name"), false ) );
userSearch.add( m_username ); userSearch.add( m_username );
userSearch.add( m_submit ); userSearch.add( m_submit );

View File

@ -252,8 +252,7 @@ public class BookmarkEditPane extends DynamicListWizard {
public Component getComponent(List list, PageState state, public Component getComponent(List list, PageState state,
Object value, String key, int index, boolean isSelected) { Object value, String key, int index, boolean isSelected) {
Bookmarks app = (Bookmarks) Web.getWebContext() Bookmarks app = (Bookmarks) Web.getWebContext().getApplication();
.getApplication();
BookmarkCollection bColl = app.getBookmarks(); BookmarkCollection bColl = app.getBookmarks();
final long size = bColl.size(); final long size = bColl.size();
bColl.close(); bColl.close();

View File

@ -241,6 +241,7 @@ public class SectionTable extends Table {
/** /**
* Return the data element for the given column and the current row. * Return the data element for the given column and the current row.
*/ */
@Override
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
if (m_colModel == null) { if (m_colModel == null) {

View File

@ -1080,3 +1080,8 @@ cms.ui.authoring.parameter_should_be_a_valid_filename=This parameter should be a
cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods
cms.ui.cse.none=No soon expired items were found. cms.ui.cse.none=No soon expired items were found.
cms.ui.contentcenter.task_panel_control=Experimental. Try to use it. cms.ui.contentcenter.task_panel_control=Experimental. Try to use it.
cms.ui.contentcenter.sectiontable.nosections=There are currently no content sections installed.
cms.ui.contentcenter.section_hint=All content items are organized in one or more contect sections. Each of them may have its own system of permissions and its own administrators, independent from each other. Select the section where you will edit a document or create a new one.
cms.ui.contentcenter.location=Location
cms.ui.contentcenter.location_hint=In Legacy mode links to public pages.
cms.ui.contentcenter.action_hint=If activated displays a form for each content section to create an object of a given type (configurable) in the root of the given content section. The list of available types retrieved for each content section. Administrators will disable this option in order to prevent disorganizing the root directory.

View File

@ -1074,3 +1074,8 @@ cms.ui.authoring.parameter_should_be_a_valid_filename=Dieser Parameter muss eine
cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods
cms.ui.cse.none=Es wurde keine bald abgelaufenen Dokumente gefunden. cms.ui.cse.none=Es wurde keine bald abgelaufenen Dokumente gefunden.
cms.ui.contentcenter.task_panel_control=Experimental. Try to use it. cms.ui.contentcenter.task_panel_control=Experimental. Try to use it.
cms.ui.contentcenter.sectiontable.nosections=Es sind keine Sektionen installiert.
cms.ui.contentcenter.section_hint=All documents are organized in one or more contect sections. Each content section may have its own system of permission and its own administrators, independent from each other. Select a section where you will edit a document or create a new one.
cms.ui.contentcenter.location=Ort
cms.ui.contentcenter.location_hint=In Legacy mode links to public pages.
cms.ui.contentcenter.action_hint=Falls aktiv wird ein Formular angezeigt, um im ROOT Verzeichnis der entsprechenden Sektion ein neues Dokument anzulegen. Administratoren deaktivieren diese Option, um das ROOT Verzeichnis nicht zu \u00fcberfrachten.

View File

@ -128,3 +128,8 @@ cms.ui.authoring.parameter_should_be_a_valid_filename=This parameter should be a
cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods
cms.ui.cse.none= cms.ui.cse.none=
cms.ui.contentcenter.task_panel_control=Experimental. Try to use it. cms.ui.contentcenter.task_panel_control=Experimental. Try to use it.
cms.ui.contentcenter.sectiontable.nosections=There are currently no content sections installed.
cms.ui.contentcenter.section_hint=All content items are organized in one or more contect sections. Each of them may have its own system of permissions and its own administrators, independent from each other. Select a section where you will edit a document or create a new one.
cms.ui.contentcenter.location=Location
cms.ui.contentcenter.location_hint=In Legacy mode links to public pages.
cms.ui.contentcenter.action_hint=If activated displays a form for each content section to create an object of a given type (configurable) in the root of the given content section. The list of available types retrieved for each content section. Administrators will disable this option in order to prevent disorganizing the root directory.

View File

@ -602,3 +602,8 @@ cms.ui.authoring.parameter_should_be_a_valid_filename=This parameter should be a
cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods cms.ui.authoring.parameter_may_not_contain_periods=This parameter may not contain periods
cms.ui.cse.none= cms.ui.cse.none=
cms.ui.contentcenter.task_panel_control=Experimental. Try to use it. cms.ui.contentcenter.task_panel_control=Experimental. Try to use it.
cms.ui.contentcenter.sectiontable.nosections=Translate: There are currently no content sections installed.
cms.ui.contentcenter.section_hint=All documents are organized in one or more contect sections. Each content section may have its own system of permission and its own administrators, independent from each other. Select a section where you will edit a document or create a new one.
cms.ui.contentcenter.location=TRANSLATE: Location
cms.ui.contentcenter.location_hint=In Legacy mode links to public pages.
cms.ui.contentcenter.action_hint=If activated displays a form for each content section to create an object of a given type (configurable) in the root of the given content section. The list of available types retrieved for each content section. Administrators will disable this option in order to prevent disorganizing the root directory.

View File

@ -26,6 +26,17 @@ import org.apache.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
// /////////////////////////////////////////////////////////////////////////////
//
// Refactored, excluded from class hierarchy, functionality moded to ???
// Retained here for easy reference until all modules are adopted.
// e.g. ccm-ldn-types-concillor and other contributions by West Sussex!!
//
// /////////////////////////////////////////////////////////////////////////////
/** /**
* This class extends a content page with an additional text attribute. * This class extends a content page with an additional text attribute.
* *

View File

@ -19,13 +19,13 @@
package com.arsdigita.cms.contenttypes.ui; package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Embedded;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormInitListener;
@ -153,7 +153,8 @@ public class LinkPropertyForm extends FormSection
"cms.contenttypes.ui.description"))); "cms.contenttypes.ui.description")));
add(m_description); add(m_description);
add(new Label( //add(new Label(
add(new Embedded(
"<script language=\"javascript\">\n" "<script language=\"javascript\">\n"
+ "<!-- \n" + "<!-- \n"
+ "function toggle_link_fields(status) { \n" + "function toggle_link_fields(status) { \n"
@ -248,7 +249,7 @@ public class LinkPropertyForm extends FormSection
add(internalFieldset); add(internalFieldset);
// TODO: // TODO:
// Move this option to contentasset related link for bacvkwards compatibility // Move this option to contentasset related link for backwards compatibility
// because this option is no longer compatible with current HTML // because this option is no longer compatible with current HTML
// Requires database modification (move field target_window from // Requires database modification (move field target_window from
// cms_links to cms_related_links which shoud become ca_related_links // cms_links to cms_related_links which shoud become ca_related_links
@ -262,7 +263,8 @@ public class LinkPropertyForm extends FormSection
m_URIOption.addOption(m_selectWindow); m_URIOption.addOption(m_selectWindow);
add(m_URIOption, ColumnPanel.FULL_WIDTH); add(m_URIOption, ColumnPanel.FULL_WIDTH);
add(new Label( //add(new Label(
add(new Embedded(
"<script language=\"javascript\">\n" "<script language=\"javascript\">\n"
+ "<!-- \n" + "<!-- \n"
+ "if (document.forms['linkEditForm'].linkType[0].checked) { \n" + "if (document.forms['linkEditForm'].linkType[0].checked) { \n"
@ -286,6 +288,7 @@ public class LinkPropertyForm extends FormSection
m_saveCancelSection.getCancelButton().addPrintListener( m_saveCancelSection.getCancelButton().addPrintListener(
new PrintListener() { new PrintListener() {
@Override
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (m_linkModel.isSelected(e.getPageState())) { if (m_linkModel.isSelected(e.getPageState())) {
@ -300,6 +303,7 @@ public class LinkPropertyForm extends FormSection
m_saveCancelSection.getSaveButton().addPrintListener( m_saveCancelSection.getSaveButton().addPrintListener(
new PrintListener() { new PrintListener() {
@Override
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (m_linkModel.isSelected(e.getPageState())) { if (m_linkModel.isSelected(e.getPageState())) {
@ -318,7 +322,8 @@ public class LinkPropertyForm extends FormSection
} }
/** /**
* Retrieves the saveCancelSection * Retrieves the saveCancelSection.
* @return Save/Cencel section
*/ */
public SaveCancelSection getSaveCancelSection() { public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection; return m_saveCancelSection;
@ -335,7 +340,9 @@ public class LinkPropertyForm extends FormSection
* Submission listener. Handles cancel events. * Submission listener. Handles cancel events.
* *
* @param e the FormSectionEvent * @param e the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/ */
@Override
public void submitted(FormSectionEvent e) public void submitted(FormSectionEvent e)
throws FormProcessException { throws FormProcessException {
if (m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) { if (m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
@ -515,7 +522,9 @@ public class LinkPropertyForm extends FormSection
* Process listener. Saves/creates the new or modified Link * Process listener. Saves/creates the new or modified Link
* *
* @param fse the FormSectionEvent * @param fse the FormSectionEvent
* @throws com.arsdigita.bebop.FormProcessException
*/ */
@Override
public void process(FormSectionEvent fse) throws FormProcessException { public void process(FormSectionEvent fse) throws FormProcessException {
PageState state = fse.getPageState(); PageState state = fse.getPageState();
Link link; Link link;
@ -550,6 +559,8 @@ public class LinkPropertyForm extends FormSection
/** /**
* Set various properties of the Link.Child clases can over-ride this method * Set various properties of the Link.Child clases can over-ride this method
* to add additional properties to Link. * to add additional properties to Link.
* @param link
* @param fse
*/ */
protected void setLinkProperties(Link link, FormSectionEvent fse) { protected void setLinkProperties(Link link, FormSectionEvent fse) {
PageState state = fse.getPageState(); PageState state = fse.getPageState();

View File

@ -37,8 +37,11 @@ import org.apache.log4j.Logger;
public abstract class BaseAdminPane extends SelectionPanel public abstract class BaseAdminPane extends SelectionPanel
implements SecurityConstants { implements SecurityConstants {
private static final Logger s_log = Logger.getLogger /** Internal logger instance to faciliate debugging. Enable logging output
(BaseAdminPane.class); * by editing /WEB-INF/conf/log4j.properties int the runtime environment
* and set com.arsdigita.cms.ui.BaseAdminPane=DEBUG
* by uncommenting or adding the line. */
private static final Logger s_log = Logger.getLogger(BaseAdminPane.class);
protected BaseAdminPane() { protected BaseAdminPane() {
super(); super();

View File

@ -144,7 +144,8 @@ public class BrowsePane extends LayoutPanel implements Resettable {
User user = Web.getWebContext().getUser(); User user = Web.getWebContext().getUser();
if ( user != null ) { if ( user != null ) {
Folder homeFolder = Folder.getUserHomeFolder(user,CMS.getContext().getContentSection()); Folder homeFolder = Folder.getUserHomeFolder(
user,CMS.getContext().getContentSection());
if ( homeFolder != null ) { if ( homeFolder != null ) {
folderID = homeFolder.getID(); folderID = homeFolder.getID();
} }

View File

@ -29,7 +29,7 @@ import com.arsdigita.bebop.parameters.BooleanParameter;
import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.*; import com.arsdigita.cms.*;
import com.arsdigita.cms.dispatcher.CMSPage; //import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;

View File

@ -32,6 +32,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -45,12 +46,17 @@ import org.apache.log4j.Logger;
*/ */
public class CMSSearchResultRedirector extends CMSApplicationPage { public class CMSSearchResultRedirector extends CMSApplicationPage {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
* and set com.arsdigita.cms.ui.CMSSearchResultRedirector=DEBUG
* by uncommenting or adding the line. */
private static final Logger s_log = Logger.getLogger(CMSSearchResultRedirector.class);
/** /**
* Names of required parameters passed in the request * Names of required parameters passed in the request
*/ */
public static final String ITEM_ID = "item_id"; public static final String ITEM_ID = "item_id";
public static final String CONTEXT = "context"; public static final String CONTEXT = "context";
private static final Logger s_log = Logger.getLogger(CMSSearchResultRedirector.class);
/** /**
* Construct a new SearchResultRedirector * Construct a new SearchResultRedirector
@ -62,6 +68,9 @@ public class CMSSearchResultRedirector extends CMSApplicationPage {
/*** /***
* override dispatcher to do redirect to page displaying item. * override dispatcher to do redirect to page displaying item.
* @param req
* @param resp
* @param actx
***/ ***/
public void dispatch(HttpServletRequest req, public void dispatch(HttpServletRequest req,
HttpServletResponse resp, RequestContext actx) { HttpServletResponse resp, RequestContext actx) {
@ -100,7 +109,8 @@ public class CMSSearchResultRedirector extends CMSApplicationPage {
try { try {
DispatcherHelper.sendRedirect(req, resp, url); DispatcherHelper.sendRedirect(req, resp, url);
} catch (IOException e) { } catch (IOException e) {
UncheckedWrapperException.throwLoggedException(getClass(), "Could not redirect: " + e.getMessage(), e ); UncheckedWrapperException.throwLoggedException(getClass(),
"Could not redirect: " + e.getMessage(), e );
} }
} }

View File

@ -21,6 +21,7 @@ package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.Embedded;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
@ -79,9 +80,11 @@ import java.util.TreeMap;
public abstract class CategoryForm extends Form public abstract class CategoryForm extends Form
implements FormProcessListener, FormValidationListener { implements FormProcessListener, FormValidationListener {
private RequestLocal m_assigned; /** Internal logger instance to faciliate debugging. Enable logging output
private Submit m_assign, m_remove; * by editing /WEB-INF/conf/log4j.properties int the runtime environment
Label m_freeLabel, m_assignedLabel; * and set com.arsdigita.cms.ui.CategoryForm=DEBUG
* by uncommenting or adding the line. */
private static final Logger s_log = Logger.getLogger(CategoryForm.class);
private static final String SEPARATOR = ">"; private static final String SEPARATOR = ">";
public static final String FREE = "free"; public static final String FREE = "free";
public static final String ASSIGNED = "assigned"; public static final String ASSIGNED = "assigned";
@ -90,7 +93,11 @@ public abstract class CategoryForm extends Form
public static final int SELECT_WIDTH = 30; public static final int SELECT_WIDTH = 30;
public static final int SELECT_HEIGHT = 10; public static final int SELECT_HEIGHT = 10;
public static final String FILLER_OPTION = StringUtils.repeat("_", SELECT_WIDTH); public static final String FILLER_OPTION = StringUtils.repeat("_", SELECT_WIDTH);
private static final Logger s_log = Logger.getLogger(CategoryForm.class);
private final RequestLocal m_assigned;
private Submit m_assign, m_remove;
private final Label m_freeLabel;
private final Label m_assignedLabel;
/** /**
* Construct a new CategoryForm component * Construct a new CategoryForm component
@ -125,7 +132,8 @@ public abstract class CategoryForm extends Form
m_freeLabel.setFontWeight(Label.BOLD); m_freeLabel.setFontWeight(Label.BOLD);
add(m_freeLabel, ColumnPanel.LEFT); add(m_freeLabel, ColumnPanel.LEFT);
add(new Label("&nbsp;", false)); //add(new Label("&nbsp;", false));
add(new Embedded("&nbsp;", false));
m_assignedLabel = new Label(GlobalizationUtil.globalize("cms.ui.item.categories.assigned"), false); m_assignedLabel = new Label(GlobalizationUtil.globalize("cms.ui.item.categories.assigned"), false);
m_assignedLabel.setFontWeight(Label.BOLD); m_assignedLabel.setFontWeight(Label.BOLD);

View File

@ -51,6 +51,7 @@ class ContentItemContextBar extends ContentSectionContextBar {
m_item = item; m_item = item;
} }
@Override
protected final List entries(final PageState state) { protected final List entries(final PageState state) {
final List entries = super.entries(state); final List entries = super.entries(state);
final ContentItem item = (ContentItem) m_item.getSelectedObject(state); final ContentItem item = (ContentItem) m_item.getSelectedObject(state);

View File

@ -40,11 +40,13 @@ public class ContentItemDatesData extends SimpleComponent {
} }
/** /**
* Generate the XML for the selected content item's last modified date. This will appear as a "launchDate" tag. * Generate the XML for the selected content item's last modified date.
* This will appear as a "launchDate" tag.
* *
* @param state The page state * @param state The page state
* @param parent Parent DOM element * @param parent Parent DOM element
**/ **/
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if (isVisible(state)) { if (isVisible(state)) {

View File

@ -347,6 +347,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* *
* <p>Developers can override this method to add only the tabs they want, or * <p>Developers can override this method to add only the tabs they want, or
* to add additional tabs after the default CMS tabs are added.</p> * to add additional tabs after the default CMS tabs are added.</p>
* @return
*/ */
protected TabbedPane createTabbedPane() { protected TabbedPane createTabbedPane() {
final TabbedPane pane = new TabbedPane(); final TabbedPane pane = new TabbedPane();
@ -360,6 +361,8 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane()); tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane());
tab(pane, "cms.ui.categories", getCategoryAdminPane()); tab(pane, "cms.ui.categories", getCategoryAdminPane());
tab(pane, "cms.ui.content_types", getContentTypeAdminPane()); tab(pane, "cms.ui.content_types", getContentTypeAdminPane());
// user admin tab removed from tab bar and the only one widget there
// (reset home folder) moved to folder browser
// tab(pane, "cms.ui.user_admin", getUserAdminPane()); // tab(pane, "cms.ui.user_admin", getUserAdminPane());
tab(pane, "cms.ui.cse", getCSEPane()); tab(pane, "cms.ui.cse", getCSEPane());
tab(pane, "cms.ui.reports", getReportPane()); tab(pane, "cms.ui.reports", getReportPane());
@ -442,9 +445,21 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
* Getting the GlobalizedMessage using a CMS Class targetBundle. * Getting the GlobalizedMessage using a CMS Class targetBundle.
* *
* @param key The resource key * @param key The resource key
* @return
* @pre key != null * @pre key != null
*/ */
public static GlobalizedMessage globalize(final String key) { public static GlobalizedMessage globalize(final String key) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE); return new GlobalizedMessage(key, RESOURCE_BUNDLE);
} }
/**
*
* @param key
* @param args
* @return
*/
public static GlobalizedMessage globalize(final String key,
final Object[] args) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE, args);
}
} }

View File

@ -93,42 +93,44 @@ public class FlatItemList extends SegmentedPanel
private static final String PRIVILEGE = "privilege"; private static final String PRIVILEGE = "privilege";
private static final String PRIVILEGE_NAME = "prettyName"; private static final String PRIVILEGE_NAME = "prettyName";
// The folder selectors // The folder selectors
private FolderSelectionModel m_folderSel; private final FolderSelectionModel m_folderSel;
private FolderRequestLocal m_folder; private FolderRequestLocal m_folder;
private NewItemForm m_newItem; private final NewItemForm m_newItem;
private SingleSelectionModel m_typeSel; private final SingleSelectionModel m_typeSel;
private CreationSelector m_selector; private final CreationSelector m_selector;
private FolderManipulator m_folderManip; private final FolderManipulator m_folderManip;
private FolderCreator m_folderCreator; private final FolderCreator m_folderCreator;
private ActionLink m_setHomeFolderAction; private final ActionLink m_setHomeFolderAction;
private ActionLink m_removeHomeFolderAction; private final ActionLink m_removeHomeFolderAction;
private ActionLink m_createFolderAction; private final ActionLink m_createFolderAction;
private ActionLink m_togglePrivateAction; private final ActionLink m_togglePrivateAction;
private Label m_homeFolderLabel; private final Label m_homeFolderLabel;
private Segment m_browseSeg; private final Segment m_browseSeg;
private Segment m_newItemSeg; private final Segment m_newItemSeg;
private Segment m_newFolderSeg; private final Segment m_newFolderSeg;
private Segment m_editFolderSeg; private final Segment m_editFolderSeg;
private Segment m_permissionsSeg; private final Segment m_permissionsSeg;
private CMSPermissionsPane m_permPane; private final CMSPermissionsPane m_permPane;
// Folder edit/rename functionality. // Folder edit/rename functionality.
private ActionLink m_editFolderAction; private final ActionLink m_editFolderAction;
private FolderEditor m_folderEditor; private final FolderEditor m_folderEditor;
private Label m_contentLabel; private final Label m_contentLabel;
private ItemPath m_itemPath; private final ItemPath m_itemPath;
private Label m_chooseLabel; private final Label m_chooseLabel;
/** /**
* Construct a new item listing pane. The provided folder selection model * Construct a new item listing pane. The provided folder selection model
* is used to keep track of the currently displayed folder. * is used to keep track of the currently displayed folder.
* *
* @param folderSel maintains the currently displayed folder. * @param folder
* @param model maintains the currently displayed folder.
*/ */
public FlatItemList(final FolderRequestLocal folder, public FlatItemList(final FolderRequestLocal folder,
final FolderSelectionModel model) { final FolderSelectionModel model) {
m_folder = folder; m_folder = folder;
m_folderSel = model; m_folderSel = model;
m_folderSel.addChangeListener(new ChangeListener() { m_folderSel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
PageState s = e.getPageState(); PageState s = e.getPageState();
reset(s); reset(s);
@ -189,6 +191,7 @@ public class FlatItemList extends SegmentedPanel
browseActions.addAction(m_setHomeFolderAction); browseActions.addAction(m_setHomeFolderAction);
m_homeFolderLabel = new Label(new PrintListener() { m_homeFolderLabel = new Label(new PrintListener() {
@Override
public final void prepare(final PrintEvent e) { public final void prepare(final PrintEvent e) {
Label label = (Label) e.getTarget(); Label label = (Label) e.getTarget();
User user = Web.getWebContext().getUser(); User user = Web.getWebContext().getUser();
@ -198,14 +201,23 @@ public class FlatItemList extends SegmentedPanel
String url = folder.getContentSection().getURL() + PageLocations.SECTION_PAGE + "?" String url = folder.getContentSection().getURL() + PageLocations.SECTION_PAGE + "?"
+ ContentSectionPage.SET_FOLDER + "=" + folder.getID(); + ContentSectionPage.SET_FOLDER + "=" + folder.getID();
//label.setLabel("Go to home folder: <a href=\"" + url + "\">" + folder.getLabel() + "</a>"); //label.setLabel("Go to home folder: <a href=\"" + url + "\">" + folder.getLabel() + "</a>");
label.setLabel(String.format("%s: <a href=\"%s\">%s</a>", String[] parts = new String[3];
(String) globalize("cms.ui.go_to_home_folder").localize(), parts[0] = "";
url, parts[1] = url;
folder.getLabel())); parts[2] = folder.getLabel();
// label.setLabel(String.format("%s: <a href=\"%s\">%s</a>",
// (String) globalize("cms.ui.go_to_home_folder").localize(),
// url,
// folder.getLabel()));
label.setLabel( globalize("cms.ui.go_to_home_folder",parts) );
} else { } else {
//label.setLabel("<font color=\"red\">No home folder selected</font>"); //label.setLabel("<font color=\"red\">No home folder selected</font>");
label.setLabel(String.format("<span style=\"color: red\">%s</span>", String[] parts = new String[3];
(String)globalize("cms.ui.no_home_folder_selected").localize())); parts[0] = "";
parts[1] = "";
//label.setLabel(String.format("<span style=\"color: red\">%s</span>",
// (String)globalize("cms.ui.no_home_folder_selected").localize()));
label.setLabel( globalize("cms.ui.no_home_folder_selected",parts) );
} }
label.setOutputEscaping(false); label.setOutputEscaping(false);
} }
@ -259,8 +271,7 @@ public class FlatItemList extends SegmentedPanel
// ACSObject parent = currentFolder.getParent(); // ACSObject parent = currentFolder.getParent();
DataObject context = PermissionService.getContext(currentFolder); DataObject context = PermissionService.getContext(currentFolder);
if (context == null) { if (context == null) {
target.setLabel((String) GlobalizationUtil.globalize("cms.ui.restore_default_permissions"). target.setLabel(GlobalizationUtil.globalize("cms.ui.restore_default_permissions"));
localize());
} else { } else {
target.setLabel((String) GlobalizationUtil.globalize("cms.ui.use_custom_permissions").localize()); target.setLabel((String) GlobalizationUtil.globalize("cms.ui.use_custom_permissions").localize());
} }
@ -312,6 +323,7 @@ public class FlatItemList extends SegmentedPanel
p.addComponentStateParam(this, m_typeSel.getStateParameter()); p.addComponentStateParam(this, m_typeSel.getStateParameter());
p.addActionListener(new ActionListener() { p.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final PageState state = e.getPageState(); final PageState state = e.getPageState();
@ -389,6 +401,7 @@ public class FlatItemList extends SegmentedPanel
m_newFolderSeg.setVisible(s, true); m_newFolderSeg.setVisible(s, true);
} }
@Override
public void submitted(FormSectionEvent e) public void submitted(FormSectionEvent e)
throws FormProcessException { throws FormProcessException {
PageState s = e.getPageState(); PageState s = e.getPageState();
@ -408,6 +421,7 @@ public class FlatItemList extends SegmentedPanel
} }
} }
@Override
public void process(FormSectionEvent e) { public void process(FormSectionEvent e) {
PageState s = e.getPageState(); PageState s = e.getPageState();
final Object source = e.getSource(); final Object source = e.getSource();
@ -428,6 +442,7 @@ public class FlatItemList extends SegmentedPanel
} }
} }
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
PageState s = e.getPageState(); PageState s = e.getPageState();
if (e.getSource().equals(m_typeSel)) { if (e.getSource().equals(m_typeSel)) {
@ -437,6 +452,7 @@ public class FlatItemList extends SegmentedPanel
} }
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PageState s = e.getPageState(); PageState s = e.getPageState();
Object source = e.getSource(); Object source = e.getSource();
@ -532,6 +548,7 @@ public class FlatItemList extends SegmentedPanel
m_permPane.reset(state); m_permPane.reset(state);
} }
@Override
public void reset(PageState s) { public void reset(PageState s) {
browseMode(s); browseMode(s);
m_folderManip.reset(s); m_folderManip.reset(s);
@ -562,6 +579,7 @@ public class FlatItemList extends SegmentedPanel
super(name); super(name);
} }
@Override
public ContentSection getContentSection(PageState s) { public ContentSection getContentSection(PageState s) {
return CMS.getContext().getContentSection(); return CMS.getContext().getContentSection();
} }
@ -578,4 +596,9 @@ public class FlatItemList extends SegmentedPanel
return ContentSectionPage.globalize(key); return ContentSectionPage.globalize(key);
} }
private static GlobalizedMessage globalize(final String key,
final Object[] args) {
return ContentSectionPage.globalize(key, args);
}
} }

View File

@ -70,6 +70,9 @@ public class FolderContent extends SimpleComponent {
private static final String CONTENTITEM_CLASS_NAME = ContentItem.class.getName(); private static final String CONTENTITEM_CLASS_NAME = ContentItem.class.getName();
/**
*
*/
public FolderContent() { public FolderContent() {
super(); super();
} }
@ -79,6 +82,11 @@ public class FolderContent extends SimpleComponent {
public String getContentSection() { public String getContentSection() {
return contentSection; return contentSection;
} }
/**
*
* @param name
*/
public void setContentSection(String name) { public void setContentSection(String name) {
contentSection = name; contentSection = name;
} }
@ -124,8 +132,9 @@ public class FolderContent extends SimpleComponent {
* Generates the XML. * Generates the XML.
* *
* @param state The page state * @param state The page state
* @param parent The parent DOM element * @param p
*/ */
@Override
public void generateXML(PageState state, Element p) { public void generateXML(PageState state, Element p) {
// put the two attributes on the tag, can be useful for XSL // put the two attributes on the tag, can be useful for XSL
@ -198,6 +207,11 @@ public class FolderContent extends SimpleComponent {
} }
/**
*
* @param item
* @param parent
*/
public static void renderItem(ContentItem item, Element parent) { public static void renderItem(ContentItem item, Element parent) {
log.debug("Rendering item '"+item.getName()+"'."); log.debug("Rendering item '"+item.getName()+"'.");

View File

@ -19,6 +19,7 @@
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
@ -174,8 +175,9 @@ class ItemSearchCreateItemPane extends CMSContainer
add(m_segPanel); add(m_segPanel);
m_fallBackLink = new Link( m_fallBackLink = new Link(
(String) GlobalizationUtil.globalize("cms.ui.search.create.fallback").localize(), new Label(GlobalizationUtil.globalize("cms.ui.search.create.fallback")),
new PrintListener() { new PrintListener() {
@Override
public void prepare(final PrintEvent event) { public void prepare(final PrintEvent event) {
final Link target = (Link) event.getTarget(); final Link target = (Link) event.getTarget();
final PageState state = event.getPageState(); final PageState state = event.getPageState();
@ -196,8 +198,8 @@ class ItemSearchCreateItemPane extends CMSContainer
final String scriptAction; final String scriptAction;
if (editAfterCreate) { if (editAfterCreate) {
((Label) target.getChild()).setLabel((String) GlobalizationUtil.globalize( ((Label) target.getChild()).setLabel((GlobalizationUtil.globalize(
"cms.ui.search.create.select_edit").localize()); "cms.ui.search.create.select_edit")));
final ContentSection section = item.getContentSection(); final ContentSection section = item.getContentSection();
final String nodeURL = section.getPath() + "/"; final String nodeURL = section.getPath() + "/";
@ -207,8 +209,8 @@ class ItemSearchCreateItemPane extends CMSContainer
target.setTarget(linkTarget); target.setTarget(linkTarget);
scriptAction = ""; scriptAction = "";
} else { } else {
((Label) target.getChild()).setLabel((String) GlobalizationUtil.globalize( ((Label) target.getChild()).setLabel(GlobalizationUtil.globalize(
"cms.ui.search.create.select_close").localize()); "cms.ui.search.create.select_close"));
scriptAction = "self.close();\n" scriptAction = "self.close();\n"
+ "return false;"; + "return false;";
} }
@ -230,6 +232,7 @@ class ItemSearchCreateItemPane extends CMSContainer
final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL); final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL);
final Label jsLabel = new Label("", false); final Label jsLabel = new Label("", false);
jsLabel.addPrintListener(new PrintListener() { jsLabel.addPrintListener(new PrintListener() {
@Override
public void prepare(final PrintEvent event) { public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget(); final Label target = (Label) event.getTarget();
final PageState state = event.getPageState(); final PageState state = event.getPageState();

View File

@ -1,3 +1,21 @@
/*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
@ -174,8 +192,9 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
PaginationModelBuilder { PaginationModelBuilder {
//private DataCollection collection; //private DataCollection collection;
private RequestLocal collection = new RequestLocal(); private final RequestLocal collection = new RequestLocal();
@Override
public TableModel makeModel(final Table table, final PageState state) { public TableModel makeModel(final Table table, final PageState state) {
if (collection.get(state) == null) { if (collection.get(state) == null) {

View File

@ -164,6 +164,7 @@ class BaseCategoryForm extends BaseForm {
m_type = type; m_type = type;
} }
@Override
public final void validate(final ParameterEvent e) public final void validate(final ParameterEvent e)
throws FormProcessException { throws FormProcessException {
final PageState state = e.getPageState(); final PageState state = e.getPageState();

View File

@ -151,6 +151,7 @@ public class CategoryItemsBrowser extends Grid {
private class ItemSummaryCellRenderer private class ItemSummaryCellRenderer
implements TableCellRenderer { implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {

View File

@ -18,6 +18,7 @@
*/ */
package com.arsdigita.cms.ui.category; package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.Embedded;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -60,7 +61,7 @@ public class CategoryLocalizationForm extends BaseForm {
final TextArea m_description; final TextArea m_description;
final TextField m_url; final TextField m_url;
final RadioGroup m_isEnabled; final RadioGroup m_isEnabled;
private Label m_script = new Label(String.format( private Embedded m_script = new Embedded(String.format(
"<script language=\"javascript\" src=\"%s/javascript/manipulate-input.js\">" + "</script>", "<script language=\"javascript\" src=\"%s/javascript/manipulate-input.js\">" + "</script>",
Web.getWebappContextPath()), Web.getWebappContextPath()),
false); false);
@ -74,6 +75,9 @@ public class CategoryLocalizationForm extends BaseForm {
/** /**
* Creates a new instance of CategoryLocalizationForm. * Creates a new instance of CategoryLocalizationForm.
* *
* @param key
* @param heading
* @param category
*/ */
public CategoryLocalizationForm(final String key, public CategoryLocalizationForm(final String key,
final GlobalizedMessage heading, final GlobalizedMessage heading,
@ -90,6 +94,7 @@ public class CategoryLocalizationForm extends BaseForm {
m_locale = new SingleSelect(localeParam); m_locale = new SingleSelect(localeParam);
m_locale.addValidationListener(new ParameterListener() { m_locale.addValidationListener(new ParameterListener() {
@Override
public void validate(ParameterEvent e) throws FormProcessException { public void validate(ParameterEvent e) throws FormProcessException {
// the --select one-- option is not allowed // the --select one-- option is not allowed
@ -97,8 +102,8 @@ public class CategoryLocalizationForm extends BaseForm {
String code = (String) data.getValue(); String code = (String) data.getValue();
if (code == null || code.length() == 0) { if (code == null || code.length() == 0) {
data.addError( data.addError(
(String) GlobalizationUtil.globalize( GlobalizationUtil.globalize(
"cms.ui.category.localization_error_locale").localize()); "cms.ui.category.localization_error_locale"));
} }
} }
@ -157,6 +162,7 @@ public class CategoryLocalizationForm extends BaseForm {
} }
@Override
public void generateXML(PageState ps, Element parent) { public void generateXML(PageState ps, Element parent) {
m_script.generateXML(ps, parent); m_script.generateXML(ps, parent);
super.generateXML(ps, parent); super.generateXML(ps, parent);
@ -196,6 +202,7 @@ public class CategoryLocalizationForm extends BaseForm {
* *
* @throws com.arsdigita.bebop.FormProcessException * @throws com.arsdigita.bebop.FormProcessException
*/ */
@Override
public final void validate(final ParameterEvent e) public final void validate(final ParameterEvent e)
throws FormProcessException { throws FormProcessException {
final PageState state = e.getPageState(); final PageState state = e.getPageState();

View File

@ -21,6 +21,7 @@ package com.arsdigita.cms.ui.contentcenter;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Embedded;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link; import com.arsdigita.bebop.Link;
@ -33,7 +34,6 @@ import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.Hidden; import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
@ -57,18 +57,18 @@ import com.arsdigita.util.LockableImpl;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
/** /**
* Displays all the content sections in table, with links to the admin * Displays all the content sections in table, with links to the admin (and in
* (and in legacy mode to legacy public pages as well). Also displays a form for * legacy mode to legacy public pages as well). Also displays a form for each
* each content section to create an object of a given type. The list of * content section to create an object of a given type (configurable). The list
* available types retrieved for each content section. * of available types retrieved for each content section.
* *
* <p> * <p>
* This class is a container for two other components: a form and a * This class is a container for two other components: a form and a table. The
* table. The form represents the drop down list of the content types * form represents the drop down list of the content types available in a
* available in a particular content section. It is an extension of * particular content section. It is an extension of the
* the {@link com.arsdigita.cms.ui.authoring.NewItemForm}. The table * {@link com.arsdigita.cms.ui.authoring.NewItemForm}. The table displays each
* displays each content section in one row, along with the specified * content section in one row, along with the specified form. The same form is
* form. The same form is reused in every row of the table. * reused in every row of the table.
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
* @version $Id: ContentSectionContainer.java 287 2005-02-22 00:29:02Z sskracic$ * @version $Id: ContentSectionContainer.java 287 2005-02-22 00:29:02Z sskracic$
@ -77,10 +77,10 @@ public class ContentSectionContainer extends CMSContainer {
private static final String CONTENT_SECTION_CLASS = "contentSections"; private static final String CONTENT_SECTION_CLASS = "contentSections";
private ContentSectionTable m_table; private final ContentSectionTable m_table;
private FormContainer m_formContainer; private final FormContainer m_formContainer;
private SingleSelectionModel m_typeSel; private final SingleSelectionModel m_typeSel;
private SingleSelectionModel m_sectionSel; private final SingleSelectionModel m_sectionSel;
/** /**
* Constructs a new ContentSectionContainer which containts: * Constructs a new ContentSectionContainer which containts:
@ -95,7 +95,7 @@ public class ContentSectionContainer extends CMSContainer {
* *
* @param typeSel passthrough to {@link NewItemForm} * @param typeSel passthrough to {@link NewItemForm}
* @param sectionSel passthrough to {@link NewItemForm} * @param sectionSel passthrough to {@link NewItemForm}
**/ */
public ContentSectionContainer(SingleSelectionModel typeSel, public ContentSectionContainer(SingleSelectionModel typeSel,
SingleSelectionModel sectionSel) { SingleSelectionModel sectionSel) {
super(); super();
@ -110,6 +110,10 @@ public class ContentSectionContainer extends CMSContainer {
add(m_table); add(m_table);
} }
/**
*
* @param p
*/
@Override @Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
@ -121,18 +125,24 @@ public class ContentSectionContainer extends CMSContainer {
*/ */
private class FormContainer extends CMSContainer { private class FormContainer extends CMSContainer {
private StaticNewItemForm m_form; private final StaticNewItemForm m_form;
private BigDecimalParameter m_sectionIdParam; private final BigDecimalParameter m_sectionIdParam;
/**
* Constructor
*/
private FormContainer() { private FormContainer() {
super(); super();
m_sectionIdParam = new BigDecimalParameter("sectionId"); m_sectionIdParam = new BigDecimalParameter("sectionId");
m_form = new StaticNewItemForm(m_sectionIdParam); m_form = new StaticNewItemForm(m_sectionIdParam);
m_form.addSubmissionListener(new FormSubmissionListener() { m_form.addSubmissionListener(new FormSubmissionListener() {
/** /**
* Cancels the form if the user lacks the "create new items" privilege. * Cancels the form if the user lacks the "create new items"
* privilege.
*/ */
@Override
public void submitted(FormSectionEvent event) public void submitted(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
PageState state = event.getPageState(); PageState state = event.getPageState();
@ -152,8 +162,8 @@ public class ContentSectionContainer extends CMSContainer {
if (!sm.canAccess(state.getRequest(), if (!sm.canAccess(state.getRequest(),
SecurityManager.NEW_ITEM, folder)) { SecurityManager.NEW_ITEM, folder)) {
throw new FormProcessException( throw new FormProcessException(
(String) GlobalizationUtil.globalize( (GlobalizationUtil.globalize(
"cms.ui.insufficient_privileges").localize()); "cms.ui.insufficient_privileges")));
} }
} }
@ -161,8 +171,10 @@ public class ContentSectionContainer extends CMSContainer {
m_form.addProcessListener(new FormProcessListener() { m_form.addProcessListener(new FormProcessListener() {
/** /**
* Process listener: redirects to the authoring kit to create a new item. * Process listener: redirects to the authoring kit to create a
* new item.
*/ */
@Override
public void process(FormSectionEvent e) throws FormProcessException { public void process(FormSectionEvent e) throws FormProcessException {
StaticNewItemForm form = (StaticNewItemForm) e.getSource(); StaticNewItemForm form = (StaticNewItemForm) e.getSource();
PageState state = e.getPageState(); PageState state = e.getPageState();
@ -194,7 +206,7 @@ public class ContentSectionContainer extends CMSContainer {
private static class StaticNewItemForm extends NewItemForm { private static class StaticNewItemForm extends NewItemForm {
private Hidden m_sectionIDParamWidget; private final Hidden m_sectionIDParamWidget;
public StaticNewItemForm(BigDecimalParameter sectionParam) { public StaticNewItemForm(BigDecimalParameter sectionParam) {
super("StaticNewItemForm"); super("StaticNewItemForm");
@ -204,32 +216,31 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* Sets the id of the content section in this form. This ID is * Sets the id of the content section in this form. This ID is used to
* used to generate a list of available content types in the * generate a list of available content types in the section.
* section.
* *
* @param state The current page state. * @param state The current page state.
* @param id The id of the ContentSection for which this form * @param id The id of the ContentSection for which this form should
* should display a list of content types * display a list of content types
* *
* @pre ( state != null && id != null ) * @pre ( state != null && id != null )
**/ */
public void setSectionId(PageState state, BigDecimal id) { public void setSectionId(PageState state, BigDecimal id) {
Assert.exists(id); Assert.exists(id);
m_sectionIDParamWidget.setValue(state, id); m_sectionIDParamWidget.setValue(state, id);
} }
/** /**
* Retrieves the content section for this form given the specified * Retrieves the content section for this form given the specified page
* page state. This method will return null if there is no content * state. This method will return null if there is no content section.
* section.
* *
* @param state The current page state. * @param state The current page state.
* @return The current content section or null if the section does * @return The current content section or null if the section does not
* not exist * exist
* *
* @pre ( state != null ) * @pre ( state != null )
**/ */
@Override
public ContentSection getContentSection(PageState state) { public ContentSection getContentSection(PageState state) {
BigDecimal id = getContentSectionID(state); BigDecimal id = getContentSectionID(state);
Assert.exists(id); Assert.exists(id);
@ -244,15 +255,14 @@ public class ContentSectionContainer extends CMSContainer {
/** /**
* Retrieves the ID of the content section for this form given the * Retrieves the ID of the content section for this form given the
* specified page state. This method will return null if no * specified page state. This method will return null if no content
* content section id has been set. * section id has been set.
* *
* @param state The current page state. * @param state The current page state.
* @return The id of the content section or null if it has not * @return The id of the content section or null if it has not been set.
* been set.
* *
* @pre ( state != null ) * @pre ( state != null )
**/ */
private BigDecimal getContentSectionID(PageState state) { private BigDecimal getContentSectionID(PageState state) {
return (BigDecimal) m_sectionIDParamWidget.getValue(state); return (BigDecimal) m_sectionIDParamWidget.getValue(state);
} }
@ -260,29 +270,36 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* A table that displays all content sections, with links to their * A table that displays all content sections, with links to their locations
* locations and admin pages and a {@link NewItemForm} next to each * and admin pages and a {@link NewItemForm} next to each section.
* section.
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
* @version $Revision: #13 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Revision: #13 $ $DateTime: 2004/08/17 23:15:09 $
**/ *
*/
private class ContentSectionTable extends Table { private class ContentSectionTable extends Table {
// We will use a (symboloc) headerKey to match columns. Because the
// number of columns depends on configuration for the llocation column,
// the index varies and con not be used.
private static final String COLUMN_SECTION = "Section"; private static final String COLUMN_SECTION = "Section";
private static final String COLUMN_LOCATION = "Public Site"; private static final String COLUMN_LOCATION = "Public Site";
private static final String COLUMN_ACTION = "Action"; private static final String COLUMN_ACTION = "Action";
/** /**
* Constructs a new ContentSectionTable, using a default table * Constructs a new ContentSectionTable, using a default table model
* model builder. * builder.
**/ */
private ContentSectionTable() { private ContentSectionTable() {
super(); super();
// we must use symbolic keys (instead of symbolic column index as
// usual) to identify a column because their number is dynamic
// depending on configuration of the location column!
Integer colNo = 0; Integer colNo = 0;
Label emptyView = new Label("There are currently no content sections installed."); Label emptyView = new Label(GlobalizationUtil
.globalize("cms.ui.contentcenter.section"));
emptyView.setFontWeight(Label.ITALIC); emptyView.setFontWeight(Label.ITALIC);
setEmptyView(emptyView); setEmptyView(emptyView);
@ -291,16 +308,32 @@ public class ContentSectionContainer extends CMSContainer {
// add columns to the table // add columns to the table
TableColumnModel columnModel = getColumnModel(); TableColumnModel columnModel = getColumnModel();
// prepare column headers
Label sectionHead = new Label(GlobalizationUtil
.globalize("cms.ui.contentcenter.section"));
sectionHead.setHint(GlobalizationUtil
.globalize("cms.ui.contentcenter.section_hint"));
Label locationHead = new Label(GlobalizationUtil
.globalize("cms.ui.contentcenter.location"));
locationHead.setHint(GlobalizationUtil
.globalize("cms.ui.contentcenter.location_hint"));
Label actionHead = new Label(GlobalizationUtil
.globalize("cms.ui.contentcenter.action"));
actionHead.setHint(GlobalizationUtil
.globalize("cms.ui.contentcenter.action_hint"));
//TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION); //TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION);
TableColumn contentSectionColumn = new TableColumn( TableColumn contentSectionColumn = new TableColumn(
colNo, colNo,
(String) GlobalizationUtil.globalize("cms.ui.contentcenter.section").localize(), sectionHead,
COLUMN_SECTION); COLUMN_SECTION);
contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer()); contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer());
columnModel.add(contentSectionColumn); columnModel.add(contentSectionColumn);
if (!ContentSection.getConfig().getHideLegacyPublicSiteLink()) { if (!ContentSection.getConfig().getHideLegacyPublicSiteLink()) {
TableColumn locationColumn = new TableColumn(colNo++, TableColumn locationColumn = new TableColumn(
colNo++,
locationHead,
COLUMN_LOCATION); COLUMN_LOCATION);
locationColumn.setCellRenderer(new URLTableCellRenderer()); locationColumn.setCellRenderer(new URLTableCellRenderer());
columnModel.add(locationColumn); columnModel.add(locationColumn);
@ -308,7 +341,7 @@ public class ContentSectionContainer extends CMSContainer {
TableColumn actionColumn = new TableColumn( TableColumn actionColumn = new TableColumn(
colNo++, colNo++,
(String) GlobalizationUtil.globalize("cms.ui.contentcenter.action").localize(), actionHead,
COLUMN_ACTION); COLUMN_ACTION);
actionColumn.setCellRenderer(new ActionTableCellRenderer()); actionColumn.setCellRenderer(new ActionTableCellRenderer());
columnModel.add(actionColumn); columnModel.add(actionColumn);
@ -320,10 +353,12 @@ public class ContentSectionContainer extends CMSContainer {
* An ContentSections table model builder * An ContentSections table model builder
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ *
*/
private class ContentSectionTableModelBuilder extends LockableImpl private class ContentSectionTableModelBuilder extends LockableImpl
implements TableModelBuilder { implements TableModelBuilder {
@Override
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
return new ContentSectionTableModel((ContentSectionTable) table, state); return new ContentSectionTableModel((ContentSectionTable) table, state);
@ -335,13 +370,14 @@ public class ContentSectionContainer extends CMSContainer {
* An ContentSections table model * An ContentSections table model
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ *
*/
private class ContentSectionTableModel implements TableModel { private class ContentSectionTableModel implements TableModel {
private ContentSectionTable m_table; private final ContentSectionTable m_table;
private TableColumnModel m_columnModel; private final TableColumnModel m_columnModel;
private PageState m_state; private final PageState m_state;
private ContentSectionCollection m_contentSections; private final ContentSectionCollection m_contentSections;
private ContentSection m_section; private ContentSection m_section;
private ContentSectionTableModel(ContentSectionTable table, private ContentSectionTableModel(ContentSectionTable table,
@ -354,24 +390,28 @@ public class ContentSectionContainer extends CMSContainer {
m_contentSections = getContentSectionCollection(); m_contentSections = getContentSectionCollection();
PermissionService.filterObjects(m_contentSections, PermissionService.filterObjects(m_contentSections,
PrivilegeDescriptor.READ, PrivilegeDescriptor.READ,
Kernel.getContext().getParty().getOID()); Kernel.getContext().getParty()
.getOID());
} }
/** /**
* Returns a collection of ContentSections to display in this * Returns a collection of ContentSections to display in this table.
* table. This implementation orders the content sections by * This implementation orders the content sections by
* <code>lower(label)</code>. * <code>lower(label)</code>.
**/ *
*/
private ContentSectionCollection getContentSectionCollection() { private ContentSectionCollection getContentSectionCollection() {
ContentSectionCollection sections = ContentSection.getAllSections(); ContentSectionCollection sections = ContentSection.getAllSections();
sections.addOrder("lower(label)"); sections.addOrder("lower(label)");
return sections; return sections;
} }
@Override
public int getColumnCount() { public int getColumnCount() {
return m_columnModel.size(); return m_columnModel.size();
} }
@Override
public boolean nextRow() { public boolean nextRow() {
if (m_contentSections.next()) { if (m_contentSections.next()) {
m_section = m_contentSections.getContentSection(); m_section = m_contentSections.getContentSection();
@ -381,42 +421,47 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* By default, we return null. For the section, location, and * By default, we return null. For the section, location, and action
* action columns, we return the current Content Section if * columns, we return the current Content Section if there is one.
* there is one.
* *
* @param columnIndex The index of the current column * @param columnIndex The index of the current column
**/ */
@Override
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
if (m_columnModel == null || m_section == null) { if (m_columnModel == null || m_section == null) {
return null; return null;
} }
TableColumn tc = m_columnModel.get(columnIndex); TableColumn tc = m_columnModel.get(columnIndex);
String columnName = (String) tc.getHeaderValue(); String columnKey = (String) tc.getHeaderKey();
Object result = m_section; Object result = m_section;
if (columnName.equals(COLUMN_SECTION) || columnName.equals(COLUMN_LOCATION) || columnName.equals( if (columnKey.equals(COLUMN_SECTION)
|| columnKey.equals(COLUMN_LOCATION)
|| columnKey.equals(
COLUMN_ACTION)) { COLUMN_ACTION)) {
result = m_section; result = m_section;
} }
return result; return result;
} }
@Override
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return m_section.getID(); return m_section.getID();
} }
/** /**
* Returns the table associated with this table model. * Returns the table associated with this table model.
**/ *
*/
protected Table getTable() { protected Table getTable() {
return m_table; return m_table;
} }
/** /**
* Returns the current page state * Returns the current page state
**/ *
*/
protected PageState getPageState() { protected PageState getPageState() {
return m_state; return m_state;
} }
@ -424,15 +469,16 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* Sets the hidden parameter in the form containers form to * Sets the hidden parameter in the form containers form to the id of
* the id of the current section. Then returns the form for * the current section. Then returns the form for display, but only if
* display, but only if the user has permission to create new * the user has permission to create new items in the current section.
* items in the current section.
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ *
*/
private class ActionTableCellRenderer implements TableCellRenderer { private class ActionTableCellRenderer implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
@ -450,12 +496,11 @@ public class ContentSectionContainer extends CMSContainer {
if (!sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder) if (!sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder)
|| !ContentSection.getConfig().getAllowContentCreateInSectionListing()) { || !ContentSection.getConfig().getAllowContentCreateInSectionListing()) {
return new Label("&nbsp;&nbsp;&nbsp;-&nbsp;-&nbsp;&nbsp;&nbsp;" // return null; // produces NPE here but works somewhere else.
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" // It's a kind of a hack. Label is supposed not to accept
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" // not-gloabalized data. Usually aou will return null here
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" // and xmlgenerator takes care of it. Doesn't work here.
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", return new Embedded("&nbsp;&nbsp;&nbsp;-&nbsp;-&nbsp;&nbsp;&nbsp;");
false);
} else { } else {
// set the value of the sectionIdParameter in the form // set the value of the sectionIdParameter in the form
// to this section // to this section
@ -468,23 +513,22 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* Generates the correct URL to the public pages for a content * Generates the correct URL to the public pages for a content section.
* section.
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ *
*/
public static class URLTableCellRenderer implements TableCellRenderer { public static class URLTableCellRenderer implements TableCellRenderer {
/** /**
* The object passed in is the current content section. This * The object passed in is the current content section. This returns a
* returns a Link whose name and target are the url to the * Link whose name and target are the url to the public pages.
* public pages.
* *
* @return Link whose name and target are the url to the public pages * @return Link whose name and target are the url to the public pages of
* of the current (passed in) content section * the current (passed in) content section or a Label if current use
* or a Label if current use does not habe acces priviledge * does not habe acces priviledge for the content section
* for the content section
*/ */
@Override
public Component getComponent(Table table, public Component getComponent(Table table,
PageState state, PageState state,
Object value, Object value,
@ -498,7 +542,6 @@ public class ContentSectionContainer extends CMSContainer {
String name = section.getName(); String name = section.getName();
String path = section.getPath(); // from Application String path = section.getPath(); // from Application
// If the user has no access, return a Label instead of a Link // If the user has no access, return a Label instead of a Link
SecurityManager sm = new SecurityManager(section); SecurityManager sm = new SecurityManager(section);
@ -507,23 +550,37 @@ public class ContentSectionContainer extends CMSContainer {
return new Link("/" + name + "/", path + "/"); return new Link("/" + name + "/", path + "/");
} else { } else {
return new Label("/" + name + "/", false); // Kind of a hack because Label is supposed not to accept
// "un-globalized" display data. Label had been abused here to
// to display a DataValue
return new Embedded("/" + name + "/", false);
// return null; // produces NPE here
} }
} }
} }
/** /**
* Generates the correct URL to the admin pages for a content * Generates the correct URL to the admin pages for a content section.
* section.
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ *
*/
public static class AdminURLTableCellRenderer extends URLTableCellRenderer { public static class AdminURLTableCellRenderer extends URLTableCellRenderer {
/** /**
* The object passed in is the current content section * The object passed in is the current content section
**/ *
* @param table
* @param state
* @param row
* @param value
* @param column
* @param isSelected
* @param key
* @return
*
*/
@Override @Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
@ -537,16 +594,23 @@ public class ContentSectionContainer extends CMSContainer {
return new Link(section.getName(), return new Link(section.getName(),
generateURL(section.getPath() + "/")); generateURL(section.getPath() + "/"));
} else { } else {
return new Label(section.getName(), false); //return new Label(section.getName(), false);
// return null; // Produces a NPE although it shouldn't and
// indeed doesn't elsewhere
// Kind of a hack because Label is supposed not to accept
// "un-globalized" display data. Label had been abused here to
// to display a DataValue
return new Embedded(section.getName(), false);
} }
} }
/** /**
* Generates the admin url for the specified prefix. Always * Generates the admin url for the specified prefix. Always returns
* returns something that does not start with a forward slash. * something that does not start with a forward slash.
* *
* @param prefix The prefix of the URL * @param prefix The prefix of the URL
**/ * @return
*/
protected String generateURL(String prefix) { protected String generateURL(String prefix) {
return prefix + PageLocations.SECTION_PAGE; return prefix + PageLocations.SECTION_PAGE;
} }

View File

@ -143,8 +143,7 @@ public class TasksPanel extends CMSContainer {
} }
/** /**
* Constructs a new task panel that shows no more than maxRows * Constructs a new task panel that shows a specified number enabled tasks.
* enabled tasks by default.
* *
* @param maxRows the maximum number of rows to show by default * @param maxRows the maximum number of rows to show by default
* @param typeModel * @param typeModel
@ -172,8 +171,7 @@ public class TasksPanel extends CMSContainer {
/** /**
* Adds the components to this tasks panel * Adds the components to this tasks panel
**/ */
// protected void addComponents() {
private void addComponents() { private void addComponents() {
m_creationPane = new BoxPanel(BoxPanel.VERTICAL); m_creationPane = new BoxPanel(BoxPanel.VERTICAL);

View File

@ -32,7 +32,6 @@ import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.util.Color;
import com.arsdigita.cms.ui.BaseItemPane; import com.arsdigita.cms.ui.BaseItemPane;
import com.arsdigita.cms.ui.item.ContentItemRequestLocal; import com.arsdigita.cms.ui.item.ContentItemRequestLocal;
import com.arsdigita.toolbox.ui.ActionGroup; import com.arsdigita.toolbox.ui.ActionGroup;
@ -107,6 +106,7 @@ final class DifferencePane extends BaseItemPane {
} }
private class ChangeCellRenderer implements TableCellRenderer { private class ChangeCellRenderer implements TableCellRenderer {
@Override
public Component getComponent(final Table table, public Component getComponent(final Table table,
final PageState state, final PageState state,
final Object value, final Object value,
@ -144,7 +144,13 @@ final class DifferencePane extends BaseItemPane {
(lz("cms.ui.item.revision.from") + " " + from); (lz("cms.ui.item.revision.from") + " " + from);
result.add(fromLabel); result.add(fromLabel);
fromLabel.setColor(Color.gray); // DEPRECATED! bebop is not supposed to specify design
// properties but logical qualifications. The direct
// speification of color must be placed by a logical
// qualification of logical status so that the theme can
// decide how to display properly. (propably setStyleAttribut
// TODO: Add as a (logical/semantic) qualifier
// fromLabel.setColor(Color.gray);
} }
return result; return result;
@ -153,6 +159,7 @@ final class DifferencePane extends BaseItemPane {
} }
private class ModelBuilder extends AbstractTableModelBuilder { private class ModelBuilder extends AbstractTableModelBuilder {
@Override
public final TableModel makeModel(final Table table, public final TableModel makeModel(final Table table,
final PageState state) { final PageState state) {
@ -172,10 +179,12 @@ final class DifferencePane extends BaseItemPane {
m_ops = new OperationIterator(difference); m_ops = new OperationIterator(difference);
} }
@Override
public final int getColumnCount() { public final int getColumnCount() {
return 3; return 3;
} }
@Override
public final boolean nextRow() { public final boolean nextRow() {
if (m_ops.hasNext()) { if (m_ops.hasNext()) {
m_op = m_ops.next(); m_op = m_ops.next();
@ -186,6 +195,7 @@ final class DifferencePane extends BaseItemPane {
} }
} }
@Override
public final Object getElementAt(final int column) { public final Object getElementAt(final int column) {
switch (column) { switch (column) {
case 0: case 0:
@ -201,6 +211,7 @@ final class DifferencePane extends BaseItemPane {
} }
} }
@Override
public final Object getKeyAt(final int column) { public final Object getKeyAt(final int column) {
return null; return null;
} }

View File

@ -73,27 +73,26 @@ import java.util.TooManyListenersException;
* *
* @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $ * @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $
*/ */
public abstract class BaseLink extends TextStylable public abstract class BaseLink extends DescriptiveComponent
implements Cloneable { implements Cloneable {
/** /** The name of the attribute used in XML to indicate which type of link
* The name of the attribute used in XML to indicate which type of link this * this link represents. */
* link represents. private final static String TYPE_ATTR = "type";
*/ private final static String HREF_NO_JAVASCRIPT = "href_no_javascript";
private final String TYPE_ATTR = "type"; private final static String HREF = "href";
private final String HREF_NO_JAVASCRIPT = "href_no_javascript";
private final String HREF = "href";
/** Label component used to display the link. Typically a Label, may be /** Component used to display the link. Typically a Label, may be
* e.g. an image as well. */ * e.g. an image as well. */
protected Component m_child; protected Component m_child;
/** Property to store the url the Link points to. */ /** Property to store the url the Link points to. */
protected String m_url; protected String m_url;
/** Property to store informational text for the user about the Link, e.g. // Use the parent class' property!
* how to use it, or when to use it (or not to use it). */ // /** Property to store informational text for the user about the Link, e.g.
private GlobalizedMessage m_hint; // * how to use it, or when to use it (or not to use it). */
// private GlobalizedMessage m_hint;
protected String m_noJavascriptURL = null; protected String m_noJavascriptURL = null;
@ -102,11 +101,26 @@ public abstract class BaseLink extends TextStylable
private String m_sConfirmMsg = ""; private String m_sConfirmMsg = "";
private GlobalizedMessage m_confirmMsg; private GlobalizedMessage m_confirmMsg;
/**
* Constructor creates a link taking url as the target and display it to
* the user at the same time. It is the only allowed way to present the
* user with a not globlized information. The implementation currently
* miss-uses the Label component to display just a not globalized String
* which is deprecated.
*
* @param url
* @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead
*/
public BaseLink(final String url) {
this(new Label(url), url);
}
/** /**
* Constructor * Constructor
* *
* @param child label component, text, image, etc. * @param child display component (Label, Image, etc.)
* @param url * @param url URL to point at
*/ */
public BaseLink(final Component child, final String url) { public BaseLink(final Component child, final String url) {
super(); super();
@ -117,18 +131,9 @@ public abstract class BaseLink extends TextStylable
/** /**
* Constructor. * Constructor.
* *
* @param label as text * @param child display component (Label, Image, etc.)
* @param url * @param listener PrintListener, may be used to change either the Display
*/ * text or the url within a locked page.
public BaseLink(final String label, final String url) {
this(new Label(label), url);
}
/**
* Constructor.
*
* @param child
* @param listener
*/ */
public BaseLink(final Component child, final PrintListener listener) { public BaseLink(final Component child, final PrintListener listener) {
this(child, ""); this(child, "");
@ -140,16 +145,6 @@ public abstract class BaseLink extends TextStylable
} }
} }
/**
* Constructor.
*
* @param label
* @param listener
*/
public BaseLink(final String label, final PrintListener listener) {
this(new Label(label), listener);
}
/** /**
* Constructor. * Constructor.
* *
@ -159,8 +154,37 @@ public abstract class BaseLink extends TextStylable
this("", listener); this("", listener);
} }
// DEPRECATED constructors
/** /**
* Constructor.
* *
* @param label as text
* @param url
* @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead
*/
public BaseLink(final String label, final String url) {
this(new Label(label), url);
}
/**
* Constructor.
*
* @param label as text
* @param listener PrintListener, may be used to change either the Display
* text or the url within a locked page.
* @deprecated use BaseLink(Component,listener) instead with a Label using
* a GlobalizedMessage instead
*/
public BaseLink(final String label, final PrintListener listener) {
this(new Label(label), listener);
}
// Class Methods
/**
* Clone.
* @return * @return
* @throws CloneNotSupportedException * @throws CloneNotSupportedException
*/ */
@ -173,9 +197,10 @@ public abstract class BaseLink extends TextStylable
/** /**
* Adds a print listener. * Adds a print listener.
* Since the <code>PrintListener</code> is expected to modify the * Since the <code>PrintListener</code> is expected to modify the target
* target of the <code>PrintEvent</code>, only one print listener can be * of the <code>PrintEvent</code>, only one print listener can be set
* set for a link. * for a link.
*
* @param listener The print listener. Must not <code>null</code>. * @param listener The print listener. Must not <code>null</code>.
* @throws IllegalArgumentException if <code>listener</code> is null. * @throws IllegalArgumentException if <code>listener</code> is null.
* @throws TooManyListenersException if a print listener has previously been * @throws TooManyListenersException if a print listener has previously been
@ -194,13 +219,15 @@ public abstract class BaseLink extends TextStylable
/** /**
* Removes a previously added print listener. If the passed in * Removes a previously added print listener. If the passed in
* <code>listener</code> is not the listener that was added with {@link #addPrintListener * <code>listener</code> is not the listener that was added with
* addPrintListener}, an IllegalArgumentException will be thrown. * {@link #addPrintListener addPrintListener}, an IllegalArgumentException
* will be thrown.
* *
* @param listener The listener that was previously added with <code>addPrintListener</code>. * @param listener The listener that was previously added with
* <code>addPrintListener</code>.
* Must not be <code>null</code>. * Must not be <code>null</code>.
* @throws IllegalArgumentException if <code>listener</code> is not the currently registered * @throws IllegalArgumentException if <code>listener</code> is not the
* print listener or is <code>null</code>. * currently registered print listener or is <code>null</code>.
*/ */
public void removePrintListener(final PrintListener listener) public void removePrintListener(final PrintListener listener)
throws IllegalArgumentException { throws IllegalArgumentException {
@ -247,6 +274,22 @@ public abstract class BaseLink extends TextStylable
m_child = child; m_child = child;
} }
/**
* Use a GlobalizedMessage to be used to display the link. It's primary
* purpose is to hide the parent class' method to prevent its usage because
* Labels and GlobalizedMessages are used here differently (a
* GlobalizedMessage is here not directly used as a Label by specifying it
* as an attribugte, inside a Label component).
* @param message
*/
@Override
public void setLabel(final GlobalizedMessage message) {
Assert.isUnlocked(this);
Label label = new Label(message);
setChild( (Component)label);
}
/** /**
* *
* @return * @return
@ -261,16 +304,6 @@ public abstract class BaseLink extends TextStylable
m_url = url; m_url = url;
} }
/**
* Sets a popup hint for the Link. It usually contains some explanation for
* the user about the link, how to use, why it is there, etc.
*
* @param hint GlobalizedMessage object with the information text.
*/
public void setHint(GlobalizedMessage hint) {
m_hint = hint;
}
/** /**
* Sets the type of link this link represents. * Sets the type of link this link represents.
* *
@ -301,26 +334,27 @@ public abstract class BaseLink extends TextStylable
* There may be additional attributes depending on what type of link this * There may be additional attributes depending on what type of link this
* link represents. * link represents.
* *
* @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to.
*
* @see ControlLink#generateXML * @see ControlLink#generateXML
* @see ToggleLink#generateXML * @see ToggleLink#generateXML
*
* @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to.
*/ */
@Override @Override
public void generateXML(final PageState state, final Element parent) { public void generateXML(final PageState state, final Element parent) {
if (isVisible(state)) { if (isVisible(state)) {
BaseLink target = firePrintEvent(state); BaseLink target = firePrintEvent(state);
Element link = parent.newChildElement("bebop:link", BEBOP_XML_NS); Element link = parent.newChildElement("bebop:link", BEBOP_XML_NS);
target.generateURL(state, link); target.generateURL(state, link);
target.exportConfirmAttributes(state, link); target.exportConfirmAttributes(state, link);
//setup the link without javascript //setup the link without javascript
target.setupNoJavascriptURL(state, link); target.setupNoJavascriptURL(state, link);
target.exportAttributes(link); target.exportAttributes(link);
target.generateExtraXMLAttributes(state, link); target.generateExtraXMLAttributes(state, link);
target.generateDescriptionXML(state, link);
target.getChild().generateXML(state, link); target.getChild().generateXML(state, link);
if(m_hint != null) target.setAttribute("hint",
(String) m_hint.localize());
} }
} }

View File

@ -97,3 +97,4 @@ bebop.cancel.msg=Submission Cancelled
bebop.parameter.unexpected_value_type=Unexpected value type: {0} bebop.parameter.unexpected_value_type=Unexpected value type: {0}
bebop.date.year.hint=Year bebop.date.year.hint=Year
bebop.date.year.label=Year bebop.date.year.label=Year
bebop.hint.no_entry_yet=No information available yet.

View File

@ -97,3 +97,4 @@ bebop.cancel.msg=Bearbeitung abgebrochen
bebop.parameter.unexpected_value_type=Unerwarteter Typ des Wertes: {0} bebop.parameter.unexpected_value_type=Unerwarteter Typ des Wertes: {0}
bebop.date.year.hint=Jahr bebop.date.year.hint=Jahr
bebop.date.year.label=Jahr bebop.date.year.label=Jahr
bebop.hint.no_entry_yet=Gegenw\u00e4rtig noch keine Information verf\u00fcgbar.

View File

@ -97,3 +97,4 @@ bebop.cancel.msg=TRANSLATE THIS: Previous (bebop.cancel.submission.msg)
bebop.parameter.unexpected_value_type=Unexpected value type: {0} bebop.parameter.unexpected_value_type=Unexpected value type: {0}
bebop.date.year.hint= bebop.date.year.hint=
bebop.date.year.label= bebop.date.year.label=
bebop.hint.no_entry_yet=No information available yet.

View File

@ -22,14 +22,13 @@ import com.arsdigita.bebop.util.Color;
import com.arsdigita.bebop.util.Size; import com.arsdigita.bebop.util.Size;
/** /**
* Abstract class that contain the CSS-like * Abstract class that contain the CSS-like Block Stylable attributes.
* Block Stylable attributes.
* *
* @author Jim Parsons * @author Jim Parsons
* @author Justin Ross * @author Justin Ross
* @version $Id: BlockStylable.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: BlockStylable.java 287 2005-02-22 00:29:02Z sskracic $
* */ * */
abstract public class BlockStylable extends TextStylable abstract public class BlockStylable extends DescriptiveComponent
{ {
/** /**
@ -74,32 +73,30 @@ abstract public class BlockStylable extends TextStylable
public static final int INSERT = 1 << 7; public static final int INSERT = 1 << 7;
/** /**
* Constant for specifying ABSMIDDLE alignment of this image input. * Constant for specifying ABSMIDDLE alignment of this image input. See the
* See the <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">W3C HTML 4.01 * <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* Specification</a> * W3C HTML 4.01 Specification</a> for a description of this attribute.
* for a description of this attribute.
*/ */
public static final int ABSMIDDLE = 1 << 8; public static final int ABSMIDDLE = 1 << 8;
/** /**
* Constant for specifying ABSBOTTOM alignment of this image input. * Constant for specifying ABSBOTTOM alignment of this image input. See the
* See the <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">W3C HTML 4.01 * <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* Specification</a> * W3C HTML 4.01 Specification</a> for a description of this attribute.
* for a description of this attribute.
*/ */
public static final int ABSBOTTOM = 1 << 9; public static final int ABSBOTTOM = 1 << 9;
/** /**
* Constant for specifying TEXTOP alignment of this image input. * Constant for specifying ABSBOTTOM alignment of this image input. See the
* (See the <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment"> * <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.) * W3C HTML 4.01 Specification</a> for a description of this attribute.
*/ */
public static final int TEXTTOP = 1 << 10; public static final int TEXTTOP = 1 << 10;
/** /**
* Constant for specifying BASELINE alignment of this image input. * Constant for specifying ABSBOTTOM alignment of this image input. See the
* (See the <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment"> * <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.) * W3C HTML 4.01 Specification</a> for a description of this attribute.
*/ */
public static final int BASELINE = 1 << 11; public static final int BASELINE = 1 << 11;
@ -109,7 +106,7 @@ abstract public class BlockStylable extends TextStylable
* This is a helper class for generating attribute names for style * This is a helper class for generating attribute names for style
* attributes in setBorder, setPadding, and setMargin. * attributes in setBorder, setPadding, and setMargin.
*/ */
private String getSideStub(int sideEnum) { /* private String getSideStub(int sideEnum) {
switch (sideEnum) { switch (sideEnum) {
case TOP: case TOP:
return "top"; return "top";
@ -124,7 +121,7 @@ abstract public class BlockStylable extends TextStylable
default: default:
return ""; return "";
} }
} } */
/** /**
* Sets this component's padding. * Sets this component's padding.
@ -133,12 +130,12 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setPadding(Size, int) * @see BlockStylable#setPadding(Size, int)
* @pre size != null * @pre size != null
*/ */
public void setPadding(Size size) { // public void setPadding(Size size) {
setPadding(size, TOP); // setPadding(size, TOP);
setPadding(size, BOTTOM); // setPadding(size, BOTTOM);
setPadding(size, LEFT); // setPadding(size, LEFT);
setPadding(size, RIGHT); // setPadding(size, RIGHT);
} // }
/** /**
* Sets the padding of one of this component's sides. * Sets the padding of one of this component's sides.
@ -148,9 +145,8 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setPadding(Size) * @see BlockStylable#setPadding(Size)
* @pre size != null * @pre size != null
*/ */
public void setPadding(Size size, int sideEnum) { // public void setPadding(Size size, int sideEnum) {
setAttribute(getSideStub(sideEnum) + "Padding", size.toString()); // }
}
/** /**
* Sets this component's border. * Sets this component's border.
@ -159,12 +155,12 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setBorder(Size, int) * @see BlockStylable#setBorder(Size, int)
* @pre size != null * @pre size != null
*/ */
public void setBorder(Size size) { // public void setBorder(Size size) {
setBorder(size, TOP); // setBorder(size, TOP);
setBorder(size, BOTTOM); // setBorder(size, BOTTOM);
setBorder(size, LEFT); // setBorder(size, LEFT);
setBorder(size, RIGHT); // setBorder(size, RIGHT);
} // }
/** /**
* Sets the border size for one side of this component. * Sets the border size for one side of this component.
@ -174,9 +170,9 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setBorder(Size) * @see BlockStylable#setBorder(Size)
* @pre size != null * @pre size != null
*/ */
public void setBorder(Size size, int sideEnum) { // public void setBorder(Size size, int sideEnum) {
setAttribute(getSideStub(sideEnum) + "Border", size.toString()); // setAttribute(getSideStub(sideEnum) + "Border", size.toString());
} // }
/** /**
* Sets the color of this component's border. * Sets the color of this component's border.
@ -184,9 +180,9 @@ abstract public class BlockStylable extends TextStylable
* @param borderColor the color for the border * @param borderColor the color for the border
* @pre borderColor != null * @pre borderColor != null
*/ */
public void setBorderColor(Color borderColor) { // public void setBorderColor(Color borderColor) {
setAttribute("borderColor", borderColor.toString()); // setAttribute("borderColor", borderColor.toString());
} // }
/** /**
* Sets this component's margin. * Sets this component's margin.
@ -195,12 +191,12 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setMargin(Size, int) * @see BlockStylable#setMargin(Size, int)
* @pre size != null * @pre size != null
*/ */
public void setMargin(Size size) { // public void setMargin(Size size) {
setMargin(size, TOP); // setMargin(size, TOP);
setMargin(size, BOTTOM); // setMargin(size, BOTTOM);
setMargin(size, LEFT); // setMargin(size, LEFT);
setMargin(size, RIGHT); // setMargin(size, RIGHT);
} // }
/** /**
* Sets the margin of one of this component's sides. * Sets the margin of one of this component's sides.
@ -210,9 +206,9 @@ abstract public class BlockStylable extends TextStylable
* @see BlockStylable#setMargin(Size) * @see BlockStylable#setMargin(Size)
* @pre size != null * @pre size != null
*/ */
public void setMargin(Size size, int sideEnum) { // public void setMargin(Size size, int sideEnum) {
setAttribute(getSideStub(sideEnum) + "Margin", size.toString()); // setAttribute(getSideStub(sideEnum) + "Margin", size.toString());
} // }
/** /**
* Sets the horizontal alignment of this component. * Sets the horizontal alignment of this component.
@ -220,25 +216,25 @@ abstract public class BlockStylable extends TextStylable
* @param alignmentEnum the horizontal alignment (LEFT, RIGHT, or * @param alignmentEnum the horizontal alignment (LEFT, RIGHT, or
* CENTER) * CENTER)
*/ */
public void setHorizontalAlignment(int alignmentEnum) { // public void setHorizontalAlignment(int alignmentEnum) {
String alignmentLiteral = ""; // String alignmentLiteral = "";
switch (alignmentEnum) { // switch (alignmentEnum) {
case LEFT: // case LEFT:
alignmentLiteral = "left"; // alignmentLiteral = "left";
break; // break;
case RIGHT: // case RIGHT:
alignmentLiteral = "right"; // alignmentLiteral = "right";
break; // break;
case CENTER: // case CENTER:
alignmentLiteral = "center"; // alignmentLiteral = "center";
break; // break;
default: // default:
throw new IllegalArgumentException("Undefined Arg in setHorizontalAlignment"); // throw new IllegalArgumentException("Undefined Arg in setHorizontalAlignment");
} // }
setAttribute("horizontalAlignment", alignmentLiteral); // setAttribute("horizontalAlignment", alignmentLiteral);
} // }
/** /**
* Sets the vertical alignment of this component. * Sets the vertical alignment of this component.
@ -246,24 +242,24 @@ abstract public class BlockStylable extends TextStylable
* @param alignmentEnum the vertical alignment (TOP, BOTTOM, or * @param alignmentEnum the vertical alignment (TOP, BOTTOM, or
* MIDDLE) * MIDDLE)
*/ */
public void setVerticalAlignment(int alignmentEnum) { // public void setVerticalAlignment(int alignmentEnum) {
String alignmentLiteral = ""; // String alignmentLiteral = "";
switch (alignmentEnum) { // switch (alignmentEnum) {
case TOP: // case TOP:
alignmentLiteral = "top"; // alignmentLiteral = "top";
break; // break;
case BOTTOM: // case BOTTOM:
alignmentLiteral = "bottom"; // alignmentLiteral = "bottom";
break; // break;
case CENTER: // case CENTER:
alignmentLiteral = "center"; // alignmentLiteral = "center";
break; // break;
default: // default:
throw new IllegalArgumentException("Undefined Arg in setVerticalAlignment"); // throw new IllegalArgumentException("Undefined Arg in setVerticalAlignment");
} // }
setAttribute("verticalAlignment", alignmentLiteral); // setAttribute("verticalAlignment", alignmentLiteral);
} // }
} }

View File

@ -28,41 +28,47 @@ import com.arsdigita.bebop.form.Hidden;
// This interface contains the XML element name of this class // This interface contains the XML element name of this class
// in a constant which is used when generating XML // in a constant which is used when generating XML
import com.arsdigita.bebop.util.BebopConstants; import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.bebop.util.PanelConstraints;
/** /**
* A container that prints its components in one row, either horizontally or * A container that prints its components in one row, either horizontally or
* vertically. * vertically.
* *
* @author David Lutterkort * @author David Lutterkort
*
* @version $Id: BoxPanel.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: BoxPanel.java 287 2005-02-22 00:29:02Z sskracic $
* */ */
public class BoxPanel extends SimpleContainer implements BebopConstants { public class BoxPanel extends SimpleContainer
implements BebopConstants, PanelConstraints {
/** /** Specifies that components should be laid out left to right. */
* Specifies that components should be laid out left to right.
*/
public final static int HORIZONTAL = 1; public final static int HORIZONTAL = 1;
/**
* Specifies that components should be laid out top to bottom. /** Specifies that components should be laid out top to bottom. */
*/
public final static int VERTICAL = 2; public final static int VERTICAL = 2;
/** XML attribute for width */
private static final String WIDTH_ATTR = "width"; private static final String WIDTH_ATTR = "width";
/** XML attribute wether to draw a border. */
private static final String BORDER_ATTR = "border"; private static final String BORDER_ATTR = "border";
/** Property to whether to draw a HORIZONTAL or VERTICAL box panel. */
private int m_axis; private int m_axis;
/** Property to store whether to to center alignment. */
private boolean m_centering; private boolean m_centering;
// Instance methods
/** /**
* Creates a box panel that lays out its components from top to bottom. * Constructor, creates a box panel that lays out its components from
* The components are not centered. * top to bottom. The components are not centered.
*/ */
public BoxPanel() { public BoxPanel() {
this(VERTICAL); this(VERTICAL);
} }
/** /**
* Creates a box panel that lays out its components in the given * Constructor, creates a box panel that lays out its components in the given
* direction. The components are not centered. * direction. The components are not centered.
* *
* @param axis the axis to use to lay out the components * @param axis the axis to use to lay out the components
@ -83,39 +89,7 @@ public class BoxPanel extends SimpleContainer implements BebopConstants {
m_centering = centering; m_centering = centering;
} }
/** // Instance methods
* Adds nodes for the panel and its child components to be rendered,
* usually in a table. Any hidden widgets directly contained in the box
* panel are added directly to <code>parent</code> and are not in any
* of the cells that the box panel generates.
*
* <p>Generates DOM fragment:
* <p><code>&lt;bebop:boxPanel [width=...] border=... center... axis...>
* &lt;bebop:cell> cell contents &lt;/bebop:cell>
* &lt;/bebop:boxPanel></code>
*/
public void generateXML(PageState state, Element parent) {
if (isVisible(state)) {
Element panel = parent.newChildElement(BEBOP_BOXPANEL, BEBOP_XML_NS);
// or: rowPanel/columPanel?
panel.addAttribute("center", String.valueOf(m_centering));
panel.addAttribute("axis", String.valueOf(m_axis));
exportAttributes(panel);
for (Iterator i = children(); i.hasNext();) {
Component c = (Component) i.next();
if (c.isVisible(state)) {
if (c instanceof Hidden) {
c.generateXML(state, parent);
} else {
Element cell = panel.newChildElement(BEBOP_CELL, BEBOP_XML_NS);
c.generateXML(state, cell);
}
}
}
}
}
/** /**
* Sets the width attribute of the box panel. The given width should be in * Sets the width attribute of the box panel. The given width should be in
@ -141,6 +115,7 @@ public class BoxPanel extends SimpleContainer implements BebopConstants {
// setAttribute(BORDER_ATTR, "0"); // setAttribute(BORDER_ATTR, "0");
// } // }
// } // }
/** /**
* *
* Sets the width of the border to draw around the components. This value * Sets the width of the border to draw around the components. This value
@ -153,4 +128,41 @@ public class BoxPanel extends SimpleContainer implements BebopConstants {
setAttribute(BORDER_ATTR, String.valueOf(border)); setAttribute(BORDER_ATTR, String.valueOf(border));
} }
/**
* Adds nodes for the panel and its child components to be rendered,
* usually in a table. Any hidden widgets directly contained in the box
* panel are added directly to <code>parent</code> and are not in any
* of the cells that the box panel generates.
*
* <p>Generates DOM fragment:
* <p><code>&lt;bebop:boxPanel [width=...] border=... center... axis...>
* &lt;bebop:cell> cell contents &lt;/bebop:cell>
* &lt;/bebop:boxPanel></code>
*
* @param parent
*/
@Override
public void generateXML(PageState state, Element parent) {
if (isVisible(state)) {
Element panel = parent.newChildElement(BEBOP_BOXPANEL, BEBOP_XML_NS);
// or: rowPanel/columPanel?
panel.addAttribute("center", String.valueOf(m_centering));
panel.addAttribute("axis", String.valueOf(m_axis));
exportAttributes(panel);
for (Iterator i = children(); i.hasNext();) {
Component c = (Component) i.next();
if (c.isVisible(state)) {
if (c instanceof Hidden) {
c.generateXML(state, parent);
} else {
Element cell = panel.newChildElement(BEBOP_CELL, BEBOP_XML_NS);
c.generateXML(state, cell);
}
}
}
}
}
} }

View File

@ -18,15 +18,16 @@
*/ */
package com.arsdigita.bebop; package com.arsdigita.bebop;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.util.Attributes;
import com.arsdigita.bebop.util.PanelConstraints;
import com.arsdigita.util.Assert;
import com.arsdigita.xml.Element;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import com.arsdigita.util.Assert;
import com.arsdigita.bebop.util.Attributes;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.xml.Element;
/** /**
* A container that prints its components in a table. Each child is printed * A container that prints its components in a table. Each child is printed
* in its own table cell. The number of columns can be specified in the * in its own table cell. The number of columns can be specified in the
@ -35,8 +36,8 @@ import com.arsdigita.xml.Element;
* at a time (filling each row from left to right), from the top of the table * at a time (filling each row from left to right), from the top of the table
* to the bottom. * to the bottom.
* *
* <p> The position of the component within the cell can * <p> The position of the component within the cell can be influenced with the
* be influenced with the following constraints. * following constraints.
* <TABLE border=0> * <TABLE border=0>
* <tr> * <tr>
* <TD nowrap valign="top">Horizontal alignment</TD> * <TD nowrap valign="top">Horizontal alignment</TD>
@ -48,8 +49,8 @@ import com.arsdigita.xml.Element;
* <code>BOTTOM</code>.</td></tr> * <code>BOTTOM</code>.</td></tr>
* <tr> * <tr>
* <td nowrap valign="top">Full width</td> * <td nowrap valign="top">Full width</td>
* <td valign="top">Use <code>FULL_WIDTH</code> to instruct the panel to put * <td valign="top">Use <code>FULL_WIDTH</code> to instruct the panel to
* the component in a row by itself, spanning the full width of the * put the component in a row by itself, spanning the full width of the
* table.</td></tr> * table.</td></tr>
* <tr> * <tr>
* <td nowrap valign="top">Inserting children</td> * <td nowrap valign="top">Inserting children</td>
@ -59,22 +60,20 @@ import com.arsdigita.xml.Element;
* columns.</td></tr> * columns.</td></tr>
* </TABLE> * </TABLE>
* *
* <p>Constraints can be combined by * <p>Constraints can be combined by OR-ing them together. For example, to print
* ORing them together. For example, to print a component in a row of its * a component in a row of its own, left-aligned, at the bottom of its cell,
* own, left-aligned, at the bottom of its cell, use the constraint * use the constraint <code>FULL_WIDTH | LEFT | BOTTOM</code>.
* <code>FULL_WIDTH | LEFT | BOTTOM</code>.
* *
* <p> Using the <code>INSERT</code> constraint fuses the current * <p> Using the <code>INSERT</code> constraint fuses the current ColumnPanel
* <code>ColumnPanel</code> with the panel of the child to which the * with the panel of the child to which the constraint is applied. For example,
* constraint is applied. For example, consider a {@link Form} that is to * consider a {@link Form} that is to have a 2-column format with labels in the
* have a 2-column format with labels in the left column and widgets * left column and widgets in the right column. If a {@link FormSection} is
* in the right column. If a {@link FormSection} is added to the form, it * added to the form, it should be included seamlessly into the parent form.
* should be included seamlessly into the parent form. To do this, * To do this, set the <code>INSERT</code> constraint when the {@link
* set the <code>INSERT</code> constraint when the {@link
* FormSection} is added to the <code>ColumnPanel</code> of the {@link Form}. At * FormSection} is added to the <code>ColumnPanel</code> of the {@link Form}. At
* the same time, tell the <code>ColumnPanel</code> used to lay out the {@link * the same time, tell the <code>ColumnPanel</code> used to lay out the {@link
* FormSection} that it is to be inserted into another * FormSection} that it is to be inserted into another panel.
* panel. *
* <P>The following pseudo-code illustrates the example. (It assumes that * <P>The following pseudo-code illustrates the example. (It assumes that
* Form and FormSection are decorators of the ColumnPanel.) * Form and FormSection are decorators of the ColumnPanel.)
* *
@ -91,41 +90,32 @@ import com.arsdigita.xml.Element;
* </pre> * </pre>
* *
* @author David Lutterkort * @author David Lutterkort
*
* @version $Id: ColumnPanel.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ColumnPanel.java 287 2005-02-22 00:29:02Z sskracic $
* */
public class ColumnPanel extends SimpleContainer {
/**
* An empty constraint corresponding to the default
*/ */
public class ColumnPanel extends SimpleContainer
implements PanelConstraints {
/** An empty constraint corresponding to the default */
private static final Constraint DEFAULT_CONSTRAINT = new Constraint(); private static final Constraint DEFAULT_CONSTRAINT = new Constraint();
/** /** The number of columns in the panel */
* The number of columns in the panel
*/
private int m_nCols; private int m_nCols;
/** /** Explicitly registered constraints for child components. Maps
* Explicitly registered constraints for child components. Maps * <code>Components</code>s to <code>Constraints</code> */
* <code>Components</code>s to <code>Constraints</code>
*/
private Map m_constraints; private Map m_constraints;
/** /** Is this panel inserted in another one ? If so, do not produce
* Is this panel inserted in another one ? If so, do not produce * &lt;table&gt; tags */
* &lt;table&gt; tags
*/
private boolean m_inserted; private boolean m_inserted;
/** /** Border attributes */
* Border attributes
*/
private Attributes m_border; private Attributes m_border;
private Attributes m_padFrame; private Attributes m_padFrame;
private Attributes m_pad; private Attributes m_pad;
private String[] m_columnWidth; private String[] m_columnWidth;
// Instance methods // Instance methods
/** /**
@ -141,16 +131,16 @@ public class ColumnPanel extends SimpleContainer {
} }
/** /**
* Creates a table panel with the specified number of columns * Creates a table panel with the specified number of columns that will
* that will be printed as a direct child of a <code>ColumnPanel</code> * be printed as a direct child of a <code>ColumnPanel</code>
* with the same number of columns. * with the same number of columns.
* @see #setInserted
* *
* @param nCols number of columns in the panel * @param nCols number of columns in the panel
* @param inserted <code>true</code> if this panel * @param inserted <code>true</code> if this panel
* is to be printed as a direct child of a * is to be printed as a direct child of a
* <code>ColumnPanel</code> with the same number of * <code>ColumnPanel</code> with the same number of
* columns * columns
* @see #setInserted
*/ */
public ColumnPanel(int nCols, boolean inserted) { public ColumnPanel(int nCols, boolean inserted) {
m_nCols = nCols; m_nCols = nCols;
@ -161,9 +151,11 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* Adds a component, specifying its constraints. * Adds a component, specifying its constraints.
*
* @param c the component to add * @param c the component to add
* @param constraints the constraints for this component * @param constraints the constraints for this component
*/ */
@Override
public void add(Component c, int constraints) { public void add(Component c, int constraints) {
super.add(c); super.add(c);
setConstraint(c, constraints); setConstraint(c, constraints);
@ -229,6 +221,7 @@ public class ColumnPanel extends SimpleContainer {
* @param state the current page state * @param state the current page state
* @param parent the parent element for these child components * @param parent the parent element for these child components
*/ */
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if ( isVisible(state) ) { if ( isVisible(state) ) {
@ -255,6 +248,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param c
*/ */
public void setBorderColor(String c) { public void setBorderColor(String c) {
makeBorder(); makeBorder();
@ -264,6 +258,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param w
*/ */
public void setBorderWidth(String w) { public void setBorderWidth(String w) {
makeBorder(); makeBorder();
@ -277,6 +272,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param b
*/ */
public void setBorder(boolean b) { public void setBorder(boolean b) {
if (b) { if (b) {
@ -314,6 +310,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param c
*/ */
public void setPadColor(String c) { public void setPadColor(String c) {
makePadFrame(); makePadFrame();
@ -325,6 +322,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param w
*/ */
public void setWidth(String w) { public void setWidth(String w) {
makePadFrame(); makePadFrame();
@ -334,6 +332,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param w
*/ */
public void setPadFrameWidth(String w) { public void setPadFrameWidth(String w) {
makePadFrame(); makePadFrame();
@ -343,6 +342,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param border
*/ */
public void setPadBorder(boolean border) { public void setPadBorder(boolean border) {
makePad(); makePad();
@ -356,6 +356,7 @@ public class ColumnPanel extends SimpleContainer {
/** /**
* *
* *
* @param padding
*/ */
public void setPadCellPadding(String padding) { public void setPadCellPadding(String padding) {
makePad(); makePad();
@ -500,7 +501,7 @@ public class ColumnPanel extends SimpleContainer {
} }
public Constraint(int constraints) { public Constraint(int constraints) {
StringBuffer s = new StringBuffer(); StringBuilder s = new StringBuilder();
if ( (constraints & (LEFT|CENTER|RIGHT)) != 0 ) { if ( (constraints & (LEFT|CENTER|RIGHT)) != 0 ) {
s.append(" align=\""); s.append(" align=\"");

View File

@ -249,6 +249,7 @@ public interface Component extends Lockable {
* malfunction and produce errors like "Widget ... isn't * malfunction and produce errors like "Widget ... isn't
* associated with any Form" * associated with any Form"
* *
* @param p
* @pre p != null * @pre p != null
*/ */
void register(Page p); void register(Page p);
@ -260,6 +261,8 @@ public interface Component extends Lockable {
* (components that have a connection to an HTML form). Other * (components that have a connection to an HTML form). Other
* components can implement it as a no-op. * components can implement it as a no-op.
* *
* @param f
* @param m
* @pre f != null * @pre f != null
* @pre m != null * @pre m != null
*/ */
@ -340,6 +343,9 @@ public interface Component extends Lockable {
* To avoid collision with indexOf, it * To avoid collision with indexOf, it
* should (1) be a legal fragment of a cgi parameter, (2) differ from "g", * should (1) be a legal fragment of a cgi parameter, (2) differ from "g",
* and (3) not start with a digit. * and (3) not start with a digit.
*
* @param key
* @return
*/ */
Component setKey(String key); Component setKey(String key);
@ -354,14 +360,12 @@ public interface Component extends Lockable {
/** /**
* Determines whether the component is visible in the request * Determines whether the component is visible in the request
* represented by <code>state</code>. * represented by <code>state</code>.
*
* @return <code>true</code> if the component is visible in the request;
* <code>false</code> otherwise.
*
* @param state represents the current request
* @see #setVisible setVisible * @see #setVisible setVisible
* @see <a href="Component.html#visibility">Description of Visibility * @see <a href="Component.html#visibility">Description of Visibility
* above</a> * above</a>
*
*
* @param state represents the current request
* @return <code>true</code> if the component is visible; <code>false</code> * @return <code>true</code> if the component is visible; <code>false</code>
* otherwise. * otherwise.
* @pre state != null * @pre state != null

View File

@ -0,0 +1,119 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.bebop;
import com.arsdigita.bebop.util.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
/**
* A (Simple) Component with various descriptive information, specifically 'hints'
* with explanations about it's proper usage. These hints provide a kind of
* online manual.
*
* @author Peter Boy (pb@zes.uni-bremen.de)
* @version $Id: TextStylable.java 287 2005-02-22 00:29:02Z sskracic $
*/
abstract public class DescriptiveComponent extends SimpleComponent {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
* and set com.arsdigita.bebop.DescriptiveComponent=DEBUG
* by uncommenting or adding the line. */
private static final Logger s_log = Logger.getLogger(DescriptiveComponent.class);
/** Property to store informational text for the user about the Link, e.g.
* how to use it, or when to use it (or not to use it). */
private GlobalizedMessage m_hint = GlobalizationUtil
.globalize("bebop.hint.no_entry_yet");
/** Property to store a (localized) label (or title) of this widget. A
* label is the text (name) displayed for the user to identify and
* distinguish the various elements on the screem. */
private GlobalizedMessage m_label;
/**
* Sets a popup hint for the component. It usually contains some explanation
* for the user about the component, how to use, why it is there, etc.
*
* @param hint GlobalizedMessage object with the information text.
*/
public void setHint(GlobalizedMessage hint) {
m_hint = hint;
}
/**
* Retrieve the popup hint for the component. It is specifically meant for
* client classes which have to generate the xml on their own and can not
* use the generateDescriptionXML method provided.
*
* @return popup hint message for the component
*/
public GlobalizedMessage getHint() {
return m_hint;
}
/**
* Sets a popup hint for the Link. It usually contains some explanation for
* the user about the link, how to use, why it is there, etc.
*
* @param label GlobalizedMessage object with the text to identify and
* distinguish the component.
*/
public void setLabel(GlobalizedMessage label) {
m_label = label;
}
/**
* Retrieve the labej for the component. It is specifically meant for
* client classes which have to generate the xml on their own and can not
* use the generateDescriptionXML method provided.
*
* @return popup hint message for the component
*/
public GlobalizedMessage getLabel() {
return m_label;
}
/**
* Generates a (J)DOM fragment for clients to include into their generated
* XML.
*
* @param state
* @param parent the XML Element instance to add the attributes managed by
* by this class
*/
protected void generateDescriptionXML(final PageState state,
final Element parent) {
if (m_label != null) {
parent.addAttribute("label", (String) m_label.localize());
}
if (m_hint != null) {
parent.addAttribute("hint", (String) m_hint.localize());
}
// Do we need this?
//exportAttributes(parent);
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright (C) 2014 Peter Boy, University of Bremen. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.bebop;
import static com.arsdigita.bebop.Component.BEBOP_XML_NS;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.xml.Element;
/**
* Injects arbitrary content as a String into the xml output. It is not for
* any semantic type of data und it is not localizable. Specifically it is
* meant for data as Javascript and alike.
*
* It generates some fixed string to be included in the XML output.
*
* It resembles the Label methods for String parameters and currently
* generates the same XML attributes in order to avoid any need to modify the
* themes.
*
* @author pb
*/
public class Embedded extends SimpleComponent {
private final String m_content;
/** The setting for output escaping affects how markup in the
* <code>content</code> is handled.
* <UL><LI>If output escaping is in effect (true), &lt;b>example&lt;/b>
* will appear literally.</LI>
* <LI>If output escaping is disabled, &lt;b>example&lt;/b> appears as the
* String "example" in bold (i.e. retaining the markup.</LI></UL>
* Default is false. */
private boolean m_escaping = false; // default for a primitive
private PrintListener m_printListener;
/**
* Default constructor creates a new <code>Embedded</code> with the empty
* content.
*
* @param content
*/
public Embedded() {
m_content = "";
}
/**
* Constructor creates a new <code>Embedded</code> with the specified
* (fixed) content.
*
* @param content
*/
public Embedded(String content) {
m_content = content;
}
/**
* Constructor creates a new <code>Embedded</code> with the specified
* content and output escaping turned on if <code>escaping</code> is
* <code>true</code>.
*
* The setting for output escaping affects how markup in the
* <code>content</code> is handled. For example: <UL><LI>If output escaping
* is in effect, &lt;b>content&lt;/b> will appear literally.</LI> <LI>If
* output escaping is disabled, &lt;b>content&lt;/b> appears as the String
* "context" in bold.</LI></UL>
*
* @param content the content to inject into the output.
* @param escaping <code>true</code> if output escaping will be in effect;
* <code>false</code> if output escaping will be disabled
*/
public Embedded(String content, boolean escaping) {
m_content = content;
m_escaping = escaping;
}
/**
* Generates the (J)DOM fragment for a embedded.
* <p><pre>
* &lt;bebop:link href="..." type="..." %bebopAttr;/>
* </pre>
*
* @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to.
*/
@Override
public void generateXML(PageState state, Element parent) {
if (!isVisible(state)) {
return;
}
Embedded target = firePrintEvent(state);
Element content = parent.newChildElement("bebop:label", BEBOP_XML_NS);
target.exportAttributes(content);
if (!target.m_escaping) {
content.addAttribute("escape", "yes");
} else {
content.addAttribute("escape", "no");
}
content.setText(m_content);
}
/**
*
* @param state
* @return
*/
protected Embedded firePrintEvent(PageState state) {
Embedded e = this;
if (m_printListener != null) {
try {
e = (Embedded) this.clone();
m_printListener.prepare(new PrintEvent(this, state, e));
} catch (CloneNotSupportedException nse) {
throw new RuntimeException(
"Couldn't clone Embedded for PrintListener. "
+ "This probably indicates a serious programming error: "
+ nse.getMessage());
}
}
return e;
}
}

View File

@ -41,16 +41,36 @@ public class FormProcessException extends ServletException {
/** Globalized version of the exception message, intended for output in the UI */ /** Globalized version of the exception message, intended for output in the UI */
private GlobalizedMessage m_globalizedMessage; private GlobalizedMessage m_globalizedMessage;
/**
* Constructor using a String as message presented to the user.
* @param message
* @deprecated Use FormProcessException(GlobalizedMessage) instead. The
* error message for the user should always be globalized so it
* can be transformed to the current users requested language.
*/
public FormProcessException(String message) { public FormProcessException(String message) {
super(message); super(message);
} }
/**
* Constructor using both types of messages which may be presented to the
* user. It's a kind of fallback just in kind we really need a non-
* globalized message. Usage is stropngly discouraged.
* @param message
* @param globalizedMessage
*/
public FormProcessException(String message, public FormProcessException(String message,
GlobalizedMessage globalizedMessage) { GlobalizedMessage globalizedMessage) {
super(message); super(message);
m_globalizedMessage = globalizedMessage; m_globalizedMessage = globalizedMessage;
} }
/**
* Constructor using a GlobalizedMessage as the error text presented to the
* user. Using this constructor is the strongly recommended way!
*
* @param globalizedMessage
*/
public FormProcessException(GlobalizedMessage globalizedMessage) { public FormProcessException(GlobalizedMessage globalizedMessage) {
super(); super();
m_globalizedMessage = globalizedMessage; m_globalizedMessage = globalizedMessage;

View File

@ -689,10 +689,9 @@ public class FormSection extends SimpleComponent implements Container {
* static ints. Use a bitwise OR to specify multiple constraints. * static ints. Use a bitwise OR to specify multiple constraints.
* *
* @param pc the component to add to this container * @param pc the component to add to this container
* * @param constraints layout constraints (a bitwise OR of static ints in
* @param constraints layout constraints (a * the particular layout)
* bitwise OR of static ints in the particular layout) */
* */
@Override @Override
public void add(Component pc, int constraints) { public void add(Component pc, int constraints) {
m_panel.add(pc, constraints); m_panel.add(pc, constraints);

View File

@ -64,6 +64,7 @@ public class Grid extends Table {
setWidth("100%"); setWidth("100%");
// Ignore null values // Ignore null values
setDefaultCellRenderer(new DefaultTableCellRenderer(true) { setDefaultCellRenderer(new DefaultTableCellRenderer(true) {
@Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
@ -119,6 +120,7 @@ public class Grid extends Table {
return new GridTableModel(m, m_cols); return new GridTableModel(m, m_cols);
} }
@Override
public void lock() { public void lock() {
m_builder.lock(); m_builder.lock();
super.lock(); super.lock();

View File

@ -18,15 +18,16 @@
*/ */
package com.arsdigita.bebop; package com.arsdigita.bebop;
import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.bebop.util.PanelConstraints;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.util.Assert;
import com.arsdigita.xml.Element;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import com.arsdigita.util.Assert;
import com.arsdigita.bebop.util.BebopConstants;
import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.xml.Element;
/** /**
* <p>A container that prints its components in a table. Each child is * <p>A container that prints its components in a table. Each child is
* printed in its own table cell. The number of columns can be * printed in its own table cell. The number of columns can be
@ -102,7 +103,8 @@ import com.arsdigita.xml.Element;
* @author Justin Ross * @author Justin Ross
* @version $Id: GridPanel.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: GridPanel.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class GridPanel extends SimpleContainer implements BebopConstants { public class GridPanel extends SimpleContainer
implements BebopConstants, PanelConstraints {
private static final ChildConstraint DEFAULT_CONSTRAINT private static final ChildConstraint DEFAULT_CONSTRAINT
= new ChildConstraint(); = new ChildConstraint();
@ -201,7 +203,11 @@ public class GridPanel extends SimpleContainer implements BebopConstants {
* ... * ...
* &lt;/bebop:panelRow> * &lt;/bebop:panelRow>
* &lt;/bebop:gridPanel></pre></code> * &lt;/bebop:gridPanel></pre></code>
*
* @param pageState
* @param parent
*/ */
@Override
public void generateXML(PageState pageState, Element parent) { public void generateXML(PageState pageState, Element parent) {
if (isVisible(pageState)) { if (isVisible(pageState)) {
if (isInserted()) { if (isInserted()) {

View File

@ -33,7 +33,7 @@ import com.arsdigita.bebop.event.PrintEvent;
* @version $Id: Image.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: Image.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class Image extends BlockStylable { public class Image extends DescriptiveComponent {
private final String IMAGE_URL = "src"; private final String IMAGE_URL = "src";
private final String ALT = "alt"; private final String ALT = "alt";
@ -76,6 +76,7 @@ public class Image extends BlockStylable {
/** /**
* *
* *
* @param height
*/ */
public void setHeight(String height) { public void setHeight(String height) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -85,6 +86,7 @@ public class Image extends BlockStylable {
/** /**
* *
* *
* @param width
*/ */
public void setWidth(String width) { public void setWidth(String width) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -94,6 +96,7 @@ public class Image extends BlockStylable {
/** /**
* *
* *
* @param border
*/ */
public void setBorder(String border) { public void setBorder(String border) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -105,7 +108,7 @@ public class Image extends BlockStylable {
* image, since the <code>PrintListener</code> is expected to modify the * image, since the <code>PrintListener</code> is expected to modify the
* target of the <code>PrintEvent</code>. * target of the <code>PrintEvent</code>.
* @param listener the print listener * @param listener the print listener
* @throws IlegalArgumentException if <code>listener</code> is null. * @throws IllegalArgumentException if <code>listener</code> is null.
* @throws IllegalStateException if a print listener has previously been * @throws IllegalStateException if a print listener has previously been
* added. * added.
* @pre listener != null */ * @pre listener != null */
@ -156,10 +159,9 @@ public class Image extends BlockStylable {
* [width=...] [border=...]/> * [width=...] [border=...]/>
* </pre></code> * </pre></code>
* *
* @param pageState the pageState used to determine values of form
* widgets and page state attributes
* @param parent the XML element to which the form adds its XML representation * @param parent the XML element to which the form adds its XML representation
* */ * */
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if ( ! isVisible(state) ) { if ( ! isVisible(state) ) {

View File

@ -25,41 +25,54 @@ import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
/** /**
* A text label. The label can be used to generate either some static, fixed * A text label displayed to the user for information about and identification
* text or a new text string for every request. To set a new text string for * of certain parts of the screen. Therefore the label has to use a
* each request, use the {@link * GlobalizedMessage for the information presented.
* #setLabel(String,PageState)} method. *
* A Label is meant to provide semantically relevant informatin and may not be
* used for fixed arbitrary Text. Use Embedded instead.
*
* (Previous usage: can be used to generate either some static, fixed
* text or a new text string for every request.)
*
* To modify the information with an already locked label use the {@link
* #setLabel(String,PageState)} method which can adjust for each request.
* *
* @author David Lutterkort * @author David Lutterkort
* @version $Id: Label.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: Label.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class Label extends BlockStylable implements Cloneable { public class Label extends DescriptiveComponent implements Cloneable {
private static final String NO_LABEL = ""; private static final String NO_LABEL = "";
public static final String BOLD = "b"; public static final String BOLD = "b";
public static final String ITALIC = "i"; public static final String ITALIC = "i";
// the default label // the default label
private GlobalizedMessage m_label; private GlobalizedMessage m_label;
// a requestlocal set of labels (to avoid printlisteners) // a requestlocal set of labels (to avoid printlisteners)
private RequestLocal m_requestLabel = new RequestLocal(); private RequestLocal m_requestLabel = new RequestLocal();
private String m_fontWeight; private String m_fontWeight;
private boolean m_escaping; /** The setting for output escaping affects how markup in the
* <code>content</code> is handled.
* <UL><LI>If output escaping is in effect (true), &lt;b>example&lt;/b>
* will appear literally.</LI>
* <LI>If output escaping is disabled, &lt;b>example&lt;/b> appears as the
* String "example" in bold (i.e. retaining the markup.</LI></UL>
* Default is false. */
private boolean m_escaping = false; // default for a primitive
private PrintListener m_printListener; private PrintListener m_printListener;
/** /**
* Creates a new * Constructor creates a new <code>Label</code> with empty text.
* <code>Label</code> with empty text.
*/ */
public Label() { public Label() {
this(NO_LABEL); this(NO_LABEL);
} }
/** /**
* Creates a new * Creates a new <code>Label</code> with the specified (fixed) text.
* <code>Label</code> with the specified text.
* *
* @param label the text to display * @param label the text to display
*
* @deprecated refactor to use Label(GlobalizedMessage label) instad * @deprecated refactor to use Label(GlobalizedMessage label) instad
*/ */
public Label(String label) { public Label(String label) {
@ -79,7 +92,7 @@ public class Label extends BlockStylable implements Cloneable {
* bold.</LI></UL> * bold.</LI></UL>
* *
* @param label the text to display * @param label the text to display
* @param <code>true</code> if output escaping will be in effect; * @param escaping <code>true</code> if output escaping will be in effect;
* <code>false</code> if output escaping will be disabled * <code>false</code> if output escaping will be disabled
* *
* @deprecated refactor to Label(GlobalizedMessage label, boolean escaping) * @deprecated refactor to Label(GlobalizedMessage label, boolean escaping)
@ -180,9 +193,12 @@ public class Label extends BlockStylable implements Cloneable {
* *
* @deprecated Use {@link #getGlobalizedMessage()} * @deprecated Use {@link #getGlobalizedMessage()}
*/ */
public String getLabel() { // Conflicts with Super's getLabel message of type GlobalizedMessage. But isn't
return getGlobalizedMessage().getKey(); // needed anyway. Should deleted as soon as the refactoring of Label is
} // completed (i.e. any string Label ironed out).
// public String getLabel() {
// return getGlobalizedMessage().getKey();
// }
/** /**
* <p> This should really be getLabel(), but since it was marked STABLE I * <p> This should really be getLabel(), but since it was marked STABLE I
@ -198,7 +214,7 @@ public class Label extends BlockStylable implements Cloneable {
* <p> This should really be getLabel(), but since it was marked STABLE I * <p> This should really be getLabel(), but since it was marked STABLE I
* can't change its return type. </p> * can't change its return type. </p>
* *
* @param the current PageState * @param state the current PageState
* @return the label to display for this request, or if state is null, the * @return the label to display for this request, or if state is null, the
* default label * default label
*/ */
@ -240,6 +256,8 @@ public class Label extends BlockStylable implements Cloneable {
if (label == null || label.length() == 0) { if (label == null || label.length() == 0) {
label = " "; label = " ";
} }
// Seems to be quite useless. label is taken as a key for some (unknown)
// Resource bundle.
setLabel(new GlobalizedMessage(label), state); setLabel(new GlobalizedMessage(label), state);
} }
@ -264,9 +282,13 @@ public class Label extends BlockStylable implements Cloneable {
/** /**
* Sets the default text for this Label. * Sets the default text for this Label.
* *
* Overwrites parent's method an therefore prevents the usage of parent's
* label methods (which are attributes, but here it is the content).
*
* @param label The GlobalizedMessage containing the label text or the * @param label The GlobalizedMessage containing the label text or the
* lookup key to use in the ResourceBundle * lookup key to use in the ResourceBundle
*/ */
@Override
public void setLabel(GlobalizedMessage label) { public void setLabel(GlobalizedMessage label) {
setLabel(label, null); setLabel(label, null);
} }
@ -279,6 +301,8 @@ public class Label extends BlockStylable implements Cloneable {
* Controls whether output is escaped during transformation, by default * Controls whether output is escaped during transformation, by default
* true. If true, it will be printed literally, and the user will see * true. If true, it will be printed literally, and the user will see
* &lt;b&gt;. When false, the browser will interpret as a bold tag. * &lt;b&gt;. When false, the browser will interpret as a bold tag.
*
* @param escaping
*/ */
public final void setOutputEscaping(boolean escaping) { public final void setOutputEscaping(boolean escaping) {
m_escaping = escaping; m_escaping = escaping;
@ -300,7 +324,7 @@ public class Label extends BlockStylable implements Cloneable {
* <code>PrintEvent</code>. * <code>PrintEvent</code>.
* *
* @param listener the print listener * @param listener the print listener
* @throws IlegalArgumentException if <code>listener</code> is null. * @throws IllegalArgumentException if <code>listener</code> is null.
* @throws IllegalStateException if a print listener has previously been * @throws IllegalStateException if a print listener has previously been
* added. * added.
* @pre listener != null * @pre listener != null
@ -338,6 +362,16 @@ public class Label extends BlockStylable implements Cloneable {
m_printListener = null; m_printListener = null;
} }
/**
* Generates the (J)DOM fragment for a label.
* <p><pre>
* &lt;bebop:link href="..." type="..." %bebopAttr;/>
* </pre>
*
* @param state The current {@link PageState}.
* @param parent The XML element to attach the XML to.
*/
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if (!isVisible(state)) { if (!isVisible(state)) {
@ -347,7 +381,9 @@ public class Label extends BlockStylable implements Cloneable {
Label target = firePrintEvent(state); Label target = firePrintEvent(state);
Element label = parent.newChildElement("bebop:label", BEBOP_XML_NS); Element label = parent.newChildElement("bebop:label", BEBOP_XML_NS);
target.exportAttributes(label); target.exportAttributes(label);
target.generateDescriptionXML(state, label);
String weight = target.getFontWeight(); String weight = target.getFontWeight();
if (weight != null && weight.length() > 0) { if (weight != null && weight.length() > 0) {
@ -380,6 +416,11 @@ public class Label extends BlockStylable implements Cloneable {
label.setText(target.getLabel(state)); label.setText(target.getLabel(state));
} }
/**
*
* @param state
* @return
*/
protected Label firePrintEvent(PageState state) { protected Label firePrintEvent(PageState state) {
Label l = this; Label l = this;

View File

@ -36,7 +36,7 @@ import org.apache.log4j.Logger;
* *
* <pre> * <pre>
* Page p = new Page("Link Example"); * Page p = new Page("Link Example");
* Link link = new Link("Click Here","path/to/target/"); * Link link = new Link(new Label(GlobalizedMessage),"path/to/target/");
* link.setVar("foo","1"); * link.setVar("foo","1");
* p.add(link); * p.add(link);
* </pre> * </pre>
@ -76,6 +76,21 @@ public class Link extends BaseLink {
setTypeAttr(TYPE_LINK); setTypeAttr(TYPE_LINK);
} }
/**
* Constructor creates a link taking url as the target and display it to
* the user at the same time. It is the only allowed way to present the
* user with a not globlized information. The implementation currently
* miss-uses the Label component to display just a not globalized String
* which is deprecated.
*
* @param url
* @deprecated use BaseLink(Component,url) instead with a Label using a
* GlobalizedMessage instead
*/
public Link(final String url) {
super(new Label(url), url);
}
/** /**
* Constructor, creates a link with a globalized label or an image as label. * Constructor, creates a link with a globalized label or an image as label.
* *
@ -103,6 +118,9 @@ public class Link extends BaseLink {
* PrintListeners are a convenient way to alter underlying Link * PrintListeners are a convenient way to alter underlying Link
* attributes such as Link text or target URL within a locked page * attributes such as Link text or target URL within a locked page
* on a per request basis. * on a per request basis.
*
* @param child
* @param l
*/ */
public Link(Component child, PrintListener l) { public Link(Component child, PrintListener l) {
super(child, l); super(child, l);
@ -117,6 +135,7 @@ public class Link extends BaseLink {
* separate call to the <tt>addPrintListener</tt> method. PrintListeners * separate call to the <tt>addPrintListener</tt> method. PrintListeners
* are a convenient way to alter underlying Link attributes such as Link * are a convenient way to alter underlying Link attributes such as Link
* text or target URL within a locked page on a per request basis. * text or target URL within a locked page on a per request basis.
*
* @deprecated refactor to use Link(Component,PrintListener) to provide a * @deprecated refactor to use Link(Component,PrintListener) to provide a
* globalized label for the link. * globalized label for the link.
*/ */
@ -133,9 +152,12 @@ public class Link extends BaseLink {
* separate call to the <tt>addPrintListener</tt> method. PrintListeners * separate call to the <tt>addPrintListener</tt> method. PrintListeners
* are a convenient way to alter underlying Link attributes such as Link * are a convenient way to alter underlying Link attributes such as Link
* text or target URL within a locked page on a per request basis. * text or target URL within a locked page on a per request basis.
*
* @param listener PrintListener, may be used to change either the Display
* text or the url within a locked page.
*/ */
public Link(PrintListener l) { public Link(PrintListener listener) {
super(l); super(listener);
init(); init();
} }
@ -175,6 +197,8 @@ public class Link extends BaseLink {
* @see com.arsdigita.web.ParameterMap * @see com.arsdigita.web.ParameterMap
* @param label a <code>String</code> of label text * @param label a <code>String</code> of label text
* @param url a <code>URL</code> for the link's target * @param url a <code>URL</code> for the link's target
* @deprecated refactor to use Link(Component,URL) to provide a
* globalized label for the link.
*/ */
public Link(String label, URL url) { public Link(String label, URL url) {
super(label, url.toString()); super(label, url.toString());
@ -184,6 +208,7 @@ public class Link extends BaseLink {
m_webURL = url; m_webURL = url;
} }
@Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
Link result = (Link) super.clone(); Link result = (Link) super.clone();

View File

@ -75,7 +75,7 @@ import org.apache.log4j.Logger;
* *
* @version $Id: Page.java 1270 2006-07-18 13:34:55Z cgyg9330 $ * @version $Id: Page.java 1270 2006-07-18 13:34:55Z cgyg9330 $
*/ */
public class Page extends BlockStylable implements Container { public class Page extends SimpleComponent implements Container {
/** /**
* Class specific logger instance. * Class specific logger instance.

View File

@ -124,7 +124,9 @@ public class SimpleComponent extends Completable
/** /**
* Does processing that is special to the component * Does processing that is special to the component
* receiving the click. * receiving the click.
*
* @param state the current page state * @param state the current page state
* @throws javax.servlet.ServletException
*/ */
@Override @Override
public void respond(PageState state) public void respond(PageState state)

View File

@ -59,8 +59,7 @@ import com.arsdigita.xml.Element;
* *
* @version $Id: SimpleContainer.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: SimpleContainer.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class SimpleContainer extends SimpleComponent implements Container {
public class SimpleContainer extends BlockStylable implements Container {
private List m_components; private List m_components;
private String m_tag, m_ns; private String m_tag, m_ns;

View File

@ -68,22 +68,22 @@ import org.apache.log4j.Logger;
* return a {@link TableModel}, which wraps the query. * return a {@link TableModel}, which wraps the query.
* <p> * <p>
* *
* The content in the cells is rendered by the {@link * The content in the cells is rendered by the {@link TableCellRenderer} that
* TableCellRenderer} that is set for the {@link TableColumn} to which the * is set for the {@link TableColumn} to which the cell belongs.
* cell belongs. If the <code>TableCellRenderer</code> has not been *
* set, the <code>TableCellRenderer</code> for the * If the <code>TableCellRenderer</code> has not been set, the
* <code>Table</code> is used. By default, the <code>Table</code> * <code>TableCellRenderer</code> for the <code>Table</code> is used.
* class uses an inactive * By default, the <code>Table</code> class uses an inactive instance of the
* instance of the {@link DefaultTableCellRenderer} (cell content is * {@link DefaultTableCellRenderer} (cell content is displayed as {@link Label}s).
* displayed as {@link Label}s). However, if an * However, if an active <code>DefaultTableCellRenderer</code> is used, the
* active <code>DefaultTableCellRenderer</code> is used, the cells in * cells in the table appear as links. When the user clicks a link, the
* the table appear as links. When the user clicks a link, the
* <code>Table</code>'s action listeners will be fired. * <code>Table</code>'s action listeners will be fired.
* <P>The currently *
* selected cell is represented by two {@link SingleSelectionModel}s - * <P>
* one model for the row and one model for the column. Typically, the * The currently selected cell is represented by two {@link SingleSelectionModel}s -
* selected row is identified by a string key and the selected column * one model for the row and one model for the column. Typically, the selected
* is identified by an integer. * row is identified by a string key and the selected column is identified by
* an integer.
* *
* @see TableModel * @see TableModel
* @see TableColumnModel * @see TableColumnModel
@ -91,7 +91,7 @@ import org.apache.log4j.Logger;
* @author David Lutterkort * @author David Lutterkort
* @version $Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $ * @version $Id: Table.java 1638 2007-09-17 11:48:34Z chrisg23 $
*/ */
public class Table extends BlockStylable implements BebopConstants { public class Table extends SimpleComponent implements BebopConstants {
private static final Logger logger = Logger.getLogger(Table.class); private static final Logger logger = Logger.getLogger(Table.class);
// Names for HTML Attributes // Names for HTML Attributes
@ -180,6 +180,7 @@ public class Table extends BlockStylable implements BebopConstants {
} }
// Events and listeners // Events and listeners
/** /**
* Adds a {@link TableActionListener} to the table. The listener is * Adds a {@link TableActionListener} to the table. The listener is
* fired whenever a table cell is clicked. * fired whenever a table cell is clicked.
@ -258,7 +259,7 @@ public class Table extends BlockStylable implements BebopConstants {
*/ */
protected TableActionListener createTableActionListener() { protected TableActionListener createTableActionListener() {
return new TableActionAdapter() { return new TableActionAdapter() {
@Override
public void headSelected(TableActionEvent e) { public void headSelected(TableActionEvent e) {
fireHeadSelected(e.getPageState(), e.getRowKey(), e.getColumn()); fireHeadSelected(e.getPageState(), e.getRowKey(), e.getColumn());
} }
@ -504,7 +505,9 @@ public class Table extends BlockStylable implements BebopConstants {
* handle all user input to the table. * handle all user input to the table.
* *
* @param s the page state * @param s the page state
* @throws javax.servlet.ServletException
*/ */
@Override
public void respond(PageState s) throws ServletException { public void respond(PageState s) throws ServletException {
String event = s.getControlEventName(); String event = s.getControlEventName();
String rowKey = null; String rowKey = null;
@ -532,6 +535,7 @@ public class Table extends BlockStylable implements BebopConstants {
* *
* @param p the page that contains this table * @param p the page that contains this table
*/ */
@Override
public void register(Page p) { public void register(Page p) {
ParameterModel m = getRowSelectionModel() == null ? null ParameterModel m = getRowSelectionModel() == null ? null
: getRowSelectionModel().getStateParameter(); : getRowSelectionModel().getStateParameter();
@ -543,7 +547,6 @@ public class Table extends BlockStylable implements BebopConstants {
if (m != null) { if (m != null) {
p.addComponentStateParam(this, m); p.addComponentStateParam(this, m);
} }
return;
} }
/** /**
@ -552,15 +555,18 @@ public class Table extends BlockStylable implements BebopConstants {
* *
* @return an iterator over Bebop components. * @return an iterator over Bebop components.
*/ */
@Override
public Iterator children() { public Iterator children() {
return new Iterator() { return new Iterator() {
int pos = (getHeader() == null) ? -1 : -2; int pos = (getHeader() == null) ? -1 : -2;
@Override
public boolean hasNext() { public boolean hasNext() {
return pos < getColumnModel().size() - 1; return pos < getColumnModel().size() - 1;
} }
@Override
public Object next() { public Object next() {
pos += 1; pos += 1;
if (pos == -1) { if (pos == -1) {
@ -570,6 +576,7 @@ public class Table extends BlockStylable implements BebopConstants {
} }
} }
@Override
public void remove() { public void remove() {
throw new UnsupportedOperationException("Read-only iterator."); throw new UnsupportedOperationException("Read-only iterator.");
} }
@ -647,7 +654,6 @@ public class Table extends BlockStylable implements BebopConstants {
*/ */
protected void generateExtraXMLAttributes(PageState state, protected void generateExtraXMLAttributes(PageState state,
Element element) { Element element) {
return;
} }
/** /**
@ -673,6 +679,7 @@ public class Table extends BlockStylable implements BebopConstants {
* @param s the page state * @param s the page state
* @param p the parent {@link Element} * @param p the parent {@link Element}
*/ */
@Override
public void generateXML(PageState s, Element p) { public void generateXML(PageState s, Element p) {
TableModel model = getTableModel(s); TableModel model = getTableModel(s);
@ -781,6 +788,7 @@ public class Table extends BlockStylable implements BebopConstants {
private void initTableModel() { private void initTableModel() {
m_tableModel = new RequestLocal() { m_tableModel = new RequestLocal() {
@Override
protected Object initialValue(PageState s) { protected Object initialValue(PageState s) {
return m_modelBuilder.makeModel(Table.this, s); return m_modelBuilder.makeModel(Table.this, s);
} }
@ -793,6 +801,7 @@ public class Table extends BlockStylable implements BebopConstants {
* header components. * header components.
* @see com.arsdigita.util.Lockable#lock * @see com.arsdigita.util.Lockable#lock
*/ */
@Override
public void lock() { public void lock() {
getModelBuilder().lock(); getModelBuilder().lock();
getColumnModel().lock(); getColumnModel().lock();
@ -811,52 +820,67 @@ public class Table extends BlockStylable implements BebopConstants {
public static class MatrixTableModelBuilder public static class MatrixTableModelBuilder
extends AbstractTableModelBuilder { extends AbstractTableModelBuilder {
private Object[][] m_data; private final Object[][] m_data;
/**
* Constructor.
*
* @param data
*/
public MatrixTableModelBuilder(Object[][] data) { public MatrixTableModelBuilder(Object[][] data) {
m_data = data; m_data = data;
} }
@Override
public TableModel makeModel(Table t, PageState s) { public TableModel makeModel(Table t, PageState s) {
return new TableModel() { return new TableModel() {
private int row = -1; private int row = -1;
@Override
public int getColumnCount() { public int getColumnCount() {
return m_data[0].length; return m_data[0].length;
} }
@Override
public boolean nextRow() { public boolean nextRow() {
return (++row < m_data.length); return (++row < m_data.length);
} }
@Override
public Object getElementAt(int j) { public Object getElementAt(int j) {
return m_data[row][j]; return m_data[row][j];
} }
@Override
public Object getKeyAt(int j) { public Object getKeyAt(int j) {
return String.valueOf(row); return String.valueOf(row);
} }
}; };
} }
} }
/** /**
* A {@link TableModel} that has no rows. * A {@link TableModel} that has no rows.
*/ */
public static final TableModel EMPTY_MODEL = new TableModel() { public static final TableModel EMPTY_MODEL = new TableModel() {
@Override
public int getColumnCount() { public int getColumnCount() {
return 0; return 0;
} }
@Override
public boolean nextRow() { public boolean nextRow() {
return false; return false;
} }
@Override
public Object getKeyAt(int column) { public Object getKeyAt(int column) {
throw new IllegalStateException("TableModel is empty"); throw new IllegalStateException("TableModel is empty");
} }
@Override
public Object getElementAt(int column) { public Object getElementAt(int column) {
throw new IllegalStateException("TableModel is empty"); throw new IllegalStateException("TableModel is empty");
} }

View File

@ -1,51 +0,0 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.bebop;
import com.arsdigita.bebop.util.Color;
/**
* Encapsulates standard methods to style text in a
* Bebop component.
*
* @version $Id: TextStylable.java 287 2005-02-22 00:29:02Z sskracic $
* */
abstract public class TextStylable extends SimpleComponent {
/**
* Sets a component's foreground or text color.
*
* @param color the color to set for this component
* @pre color != null
*/
public void setColor(Color color) {
setAttribute("color", color.toString());
}
/**
* Sets a component's background color.
*
* @param backgroundColor the color to set for this component's background
* @pre backgroundColor != null
*/
public void setBackgroundColor(Color backgroundColor) {
setAttribute("backgroundColor", backgroundColor.toString());
}
}

View File

@ -18,11 +18,6 @@
*/ */
package com.arsdigita.bebop; package com.arsdigita.bebop;
import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
import com.arsdigita.bebop.event.ChangeEvent; import com.arsdigita.bebop.event.ChangeEvent;
import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
@ -31,6 +26,11 @@ import com.arsdigita.bebop.form.Widget;
import static com.arsdigita.bebop.util.GlobalizationUtil.globalize; import static com.arsdigita.bebop.util.GlobalizationUtil.globalize;
import com.arsdigita.bebop.util.Traversal; import com.arsdigita.bebop.util.Traversal;
import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
/** /**
* The Wizard class can be used in conjunction with FormStep to build a series * The Wizard class can be used in conjunction with FormStep to build a series
* of forms that gather information from the user in several stages. A simple * of forms that gather information from the user in several stages. A simple
@ -97,8 +97,7 @@ import com.arsdigita.bebop.util.Traversal;
* links on a confirmation step in a wizard with several steps) * links on a confirmation step in a wizard with several steps)
* *
* @version $Id: Wizard.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $ * @version $Id: Wizard.java 1414 2006-12-07 14:24:10Z chrisgilbert23 $
**/ */
public class Wizard extends MultiStepForm { public class Wizard extends MultiStepForm {
private static Logger s_log = Logger.getLogger(Wizard.class); private static Logger s_log = Logger.getLogger(Wizard.class);

View File

@ -19,6 +19,7 @@
package com.arsdigita.bebop.form; package com.arsdigita.bebop.form;
import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.util.PanelConstraints;
/** /**
* A class representing an image HTML form element. * A class representing an image HTML form element.
@ -29,71 +30,14 @@ import com.arsdigita.bebop.parameters.ParameterModel;
* @author Michael Pih * @author Michael Pih
* @version $Id: ImageSubmit.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ImageSubmit.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class ImageSubmit extends Widget { public class ImageSubmit extends Widget implements PanelConstraints {
/** /**
* Constant for specifying LEFT alignment of this image input. * Constructor.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a> *
* for a description of what this attribute does. * @param name
*/ */
// public static final int LEFT = 0;
/**
* Constant for specifying RIGHT alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
// public static final int RIGHT = 1;
/**
* Constant for specifying TOP alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
// public static final int TOP = 2;
/**
* Constant for specifying ABSMIDDLE alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
// public static final int ABSMIDDLE = 3;
/**
* Constant for specifying ABSBOTTOM alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
//public static final int ABSBOTTOM = 4;
/**
* Constant for specifying TEXTOP alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
// public static final int TEXTTOP = 5;
/**
* Constant for specifying MIDDLE alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
// public static final int MIDDLE = 6;
/**
* Constant for specifying BASELINE alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
//public static final int BASELINE = 7;
/**
* Constant for specifying BOTTOM alignment of this image input.
* See <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">here</a>
* for a description of what this attribute does.
*/
//public static final int BOTTOM = 8;
public ImageSubmit(String name) { public ImageSubmit(String name) {
super(name); super(name);
} }
@ -104,7 +48,10 @@ public class ImageSubmit extends Widget {
/** /**
* Returns a string naming the type of this widget. * Returns a string naming the type of this widget.
*
* @return
*/ */
@Override
public String getType() { public String getType() {
return "image"; return "image";
} }
@ -112,6 +59,8 @@ public class ImageSubmit extends Widget {
/** /**
* Sets the <tt>SRC</tt> attribute for the <tt>INPUT</tt> tag * Sets the <tt>SRC</tt> attribute for the <tt>INPUT</tt> tag
* used to render this form element. * used to render this form element.
*
* @param location
*/ */
public void setSrc(String location) { public void setSrc(String location) {
setAttribute("src",location); setAttribute("src",location);
@ -127,7 +76,11 @@ public class ImageSubmit extends Widget {
/** /**
* Sets the <tt>ALIGN</tt> attribute for the <tt>INPUT</tt> tag * Sets the <tt>ALIGN</tt> attribute for the <tt>INPUT</tt> tag
* used to render this form element. * used to render this form element. Uses the positional constants defined
* in Interface PanelConstraints.
* Note: These may be refactored in future versions.
*
* @param align Symbolic constant denoting the alignment.
*/ */
public void setAlign(int align) { public void setAlign(int align) {
String alignString = null; String alignString = null;
@ -166,6 +119,7 @@ public class ImageSubmit extends Widget {
setAttribute("align",alignString); setAttribute("align",alignString);
} }
@Override
public boolean isCompound() { public boolean isCompound() {
return false; return false;
} }
@ -175,7 +129,8 @@ public class ImageSubmit extends Widget {
*/ */
/* public void accept(FormVisitor visitor) throws IOException { /* public void accept(FormVisitor visitor) throws IOException {
visitor.visitImage(this); visitor.visitImage(this);
}*/ }
*/
} }

View File

@ -18,9 +18,9 @@
*/ */
package com.arsdigita.bebop.form; package com.arsdigita.bebop.form;
import com.arsdigita.bebop.BlockStylable;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.DescriptiveComponent;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.bebop.parameters.ParameterData;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -39,7 +39,7 @@ import com.arsdigita.xml.Element;
* *
* $Id: Option.java 287 2005-02-22 00:29:02Z sskracic $ * $Id: Option.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class Option extends BlockStylable { public class Option extends DescriptiveComponent {
private String m_value; private String m_value;
private OptionGroup m_group; private OptionGroup m_group;
@ -60,6 +60,9 @@ public class Option extends BlockStylable {
* Constructor creates an Option whose label part consisting of a string. * Constructor creates an Option whose label part consisting of a string.
* This results in a badly globalized label part. The localization depends * This results in a badly globalized label part. The localization depends
* on the language selected at the time the Option is created. * on the language selected at the time the Option is created.
*
* @param value
* @param label
* @deprecated use Option(value,component) instead * @deprecated use Option(value,component) instead
*/ */
public Option(String value, String label) { public Option(String value, String label) {
@ -98,9 +101,9 @@ public class Option extends BlockStylable {
* @exception ClassCastException is thrown if the component is not * @exception ClassCastException is thrown if the component is not
* a label * a label
*/ */
public final String getLabel() { // public final String getLabel() {
return ((Label)m_component).getLabel(); // return ((Label)m_component).getLabel();
} // }
/** /**
* This sets the component to the label consisting of the passed in * This sets the component to the label consisting of the passed in
@ -149,6 +152,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ONFOCUS</tt> attribute for the HTML tags that compose * Sets the <tt>ONFOCUS</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
*/ */
public void setOnFocus(String javascriptCode) { public void setOnFocus(String javascriptCode) {
setAttribute(Widget.ON_FOCUS,javascriptCode); setAttribute(Widget.ON_FOCUS,javascriptCode);
@ -157,6 +161,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ONBLUR</tt> attribute for the HTML tags that compose * Sets the <tt>ONBLUR</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
*/ */
public void setOnBlur(String javascriptCode) { public void setOnBlur(String javascriptCode) {
setAttribute(Widget.ON_BLUR,javascriptCode); setAttribute(Widget.ON_BLUR,javascriptCode);
@ -165,6 +170,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ONSELECT</tt> attribute for the HTML tags that compose * Sets the <tt>ONSELECT</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
*/ */
public void setOnSelect(String javascriptCode) { public void setOnSelect(String javascriptCode) {
setAttribute(Widget.ON_SELECT,javascriptCode); setAttribute(Widget.ON_SELECT,javascriptCode);
@ -173,6 +179,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ONCHANGE</tt> attribute for the HTML tags that compose * Sets the <tt>ONCHANGE</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
*/ */
public void setOnChange(String javascriptCode) { public void setOnChange(String javascriptCode) {
setAttribute(Widget.ON_CHANGE,javascriptCode); setAttribute(Widget.ON_CHANGE,javascriptCode);
@ -182,6 +189,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ON_KEY_UP</tt> attribute for the HTML tags that compose * Sets the <tt>ON_KEY_UP</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
**/ **/
public void setOnKeyUp(String javascriptCode) { public void setOnKeyUp(String javascriptCode) {
@ -191,6 +199,7 @@ public class Option extends BlockStylable {
/** /**
* Sets the <tt>ONCLICK</tt> attribute for the HTML tags that compose * Sets the <tt>ONCLICK</tt> attribute for the HTML tags that compose
* this element. * this element.
* @param javascriptCode
*/ */
public void setOnClick(String javascriptCode) { public void setOnClick(String javascriptCode) {
setAttribute(Widget.ON_CLICK,javascriptCode); setAttribute(Widget.ON_CLICK,javascriptCode);
@ -217,11 +226,9 @@ public class Option extends BlockStylable {
if (optionValue == null || selectedValues == null) { if (optionValue == null || selectedValues == null) {
return false; return false;
} }
for (Object selectedValue : selectedValues) {
for (int i=0; i<selectedValues.length; i++) { if (selectedValue != null
if (selectedValues[i] != null && && optionValue.equalsIgnoreCase(selectedValue.toString())) {
optionValue.equalsIgnoreCase(selectedValues[i].toString())
) {
return true; return true;
} }
} }
@ -229,7 +236,10 @@ public class Option extends BlockStylable {
} }
/** /**
* Generate XML depending on what OptionGroup we belong to. * Generate XML depending on what OptionGr.
*
* @param s
* @param e
*/ */
@Override @Override
public void generateXML(PageState s, Element e) { public void generateXML(PageState s, Element e) {
@ -258,9 +268,9 @@ public class Option extends BlockStylable {
/** /**
* Kludge to live with the fact that options don't do their own * Kludge to live with the fact that options don't do their own
* printing. Don't use this method, it will go away ! * printing. Don't use this method, it will go away !
*
* @deprecated Will be removed without replacement once option handling * @deprecated Will be removed without replacement once option handling
* has been refactored. * has been refactored.
*
*/ */
final void generateAttributes(Element target) { final void generateAttributes(Element target) {
exportAttributes(target); exportAttributes(target);

View File

@ -52,6 +52,8 @@ public class Submit extends Widget {
* *
* @param name the button's name and label * @param name the button's name and label
* @pre name != null * @pre name != null
* @deprecated use Submit(GlobalizedMessage) or even better
* Submit(name, GlobalizedMessage) instead
*/ */
public Submit(String name) { public Submit(String name) {
// To pacify the com.arsdigita.web.ParameterMap#validateName(String) // To pacify the com.arsdigita.web.ParameterMap#validateName(String)
@ -64,6 +66,7 @@ public class Submit extends Widget {
* *
* @param name the button's name * @param name the button's name
* @param label the label displayed on the button * @param label the label displayed on the button
* @deprecated use Submit(name, GlobalizedMessage instead
*/ */
public Submit(String name, String label) { public Submit(String name, String label) {
super(name); super(name);

View File

@ -26,7 +26,7 @@ import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.arsdigita.bebop.BlockStylable; import com.arsdigita.bebop.DescriptiveComponent;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormModel; import com.arsdigita.bebop.FormModel;
@ -70,8 +70,8 @@ import com.arsdigita.xml.Element;
* @author Rory Solomon * @author Rory Solomon
* @version $Id: Widget.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $ * @version $Id: Widget.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $
*/ */
public abstract class Widget extends BlockStylable implements Cloneable, public abstract class Widget extends DescriptiveComponent
BebopConstants { implements Cloneable, BebopConstants {
private static final Logger s_log = Logger.getLogger(Widget.class); private static final Logger s_log = Logger.getLogger(Widget.class);
@ -81,7 +81,8 @@ public abstract class Widget extends BlockStylable implements Cloneable,
private PrintListener m_printListener; private PrintListener m_printListener;
private Form m_form; private Form m_form;
/** The optional (localized) label (or title) of this widget. */ /** The optional (localized) label (or title) of this widget. */
private GlobalizedMessage m_label; // Use parent's class' instead
// private GlobalizedMessage m_label;
private ValidationGuard m_guard = null; private ValidationGuard m_guard = null;
@ -95,6 +96,32 @@ public abstract class Widget extends BlockStylable implements Cloneable,
static final String ON_CHANGE = "onChange"; static final String ON_CHANGE = "onChange";
static final String ON_KEY_UP = "onKeyUp"; static final String ON_KEY_UP = "onKeyUp";
/**
* Constructor, creates a new widget.
*
* @param name of the widget, used to address the instance.
*/
protected Widget(String name) {
this(new StringParameter(name));
}
/**
* Constructor, creates a new widget.
*
* <p>
* Each new widget is associated with a ParameterModel describing the
* data object(s) submitted from the widget.
*
* @param model
*/
protected Widget(ParameterModel model) {
Assert.exists(model, ParameterModel.class);
m_parameterModel = model;
}
/** /**
* Returns true if the widget consists of multiple HTML elements. * Returns true if the widget consists of multiple HTML elements.
* *
@ -110,30 +137,6 @@ public abstract class Widget extends BlockStylable implements Cloneable,
*/ */
protected abstract String getType(); protected abstract String getType();
/**
* Constructs a new widget.
*
* @param name
*/
protected Widget(String name) {
this(new StringParameter(name));
}
/**
* Constructs a new widget.
*
* <p>
* Each new widget is associated with a ParameterModel describing the
* data object(s) submitted from the widget.
*
* @param model
*/
protected Widget(ParameterModel model) {
Assert.exists(model, ParameterModel.class);
m_parameterModel = model;
}
/** /**
* *
* @return * @return
@ -267,8 +270,10 @@ public abstract class Widget extends BlockStylable implements Cloneable,
} }
/** /**
* Registers the ParameterModel of this Widget with the containing Form. This method is used by * Registers the ParameterModel of this Widget with the containing Form.
* the Bebop framework and should not be used by application developers. * This method is used by the Bebop framework and should not be used by
* application developers.
*
* @param form * @param form
* @param model * @param model
*/ */
@ -413,28 +418,32 @@ public abstract class Widget extends BlockStylable implements Cloneable,
* *
* @param hint * @param hint
*/ */
public void setHint(GlobalizedMessage hint) { // Use parent's class method instead
Assert.isUnlocked(this); // @Override
setAttribute("hint", (String) hint.localize()); // public void setHint(GlobalizedMessage hint) {
} // Assert.isUnlocked(this);
// setAttribute("hint", (String) hint.localize());
// }
/** /**
* Sets a Label for the widget. * Sets a Label for the widget.
* *
* @param label * @param label
*/ */
public void setLabel(GlobalizedMessage label) { // Use parent's class method instead
m_label = label; // public void setLabel(GlobalizedMessage label) {
} // m_label = label;
// }
/** /**
* Sets a Label for the widget. * Sets a Label for the widget.
* *
* @return * @return
*/ */
public GlobalizedMessage getLabel() { // Use parent's class method instead
return m_label; // public GlobalizedMessage getLabel() {
} // return m_label;
// }
/** /**
* Gets the default value in the parameter model for this element. * Gets the default value in the parameter model for this element.
@ -527,13 +536,14 @@ public abstract class Widget extends BlockStylable implements Cloneable,
* </p> * </p>
* *
* <p> * <p>
* <code>&lt;bebop:formErrors message=...> * <code>&lt;bebop:formErrors message=...&lt;/bebop:formErrors></code>
* &lt;/bebop:formErrors></code>
* </p> * </p>
* *
* <p> * <p>
* <code>&lt;bebop:formWidget name=... type=... value=... [onXXX=...]> * <code>
* &lt;/bebop:formWidget></code> * &lt;bebop:formWidget name=... type=... label=... value=...
* [hint=...] [onXXX=...] &lt;/bebop:formWidget>
* </code>
* </p> * </p>
* *
* @param state * @param state
@ -578,25 +588,28 @@ public abstract class Widget extends BlockStylable implements Cloneable,
} }
/** /**
* Generates the DOM for the given widget. * Generates the DOM for the given widget on a per request basis.
* <p> * <p>
* Generates DOM fragment: * Generates DOM fragment:
* <p> * <p>
* <code>&lt;bebop:formWidget name=... type=... value=... [onXXX=...]> * <code>&lt;bebop:formWidget name=... type=... value=... [onXXX=...]>
* &lt;/bebop:formWidget></code> * &lt;/bebop:formWidget></code>
*
* @param state * @param state
* @param parent * @param parent
*/ */
protected void generateWidget(PageState state, Element parent) { protected void generateWidget(PageState state, Element parent) {
Element widget = parent.newChildElement(getElementTag(), BEBOP_XML_NS); Element widget = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
widget.addAttribute("type", getType()); widget.addAttribute("type", getType());
widget.addAttribute("name", getName()); widget.addAttribute("name", getName());
widget.addAttribute("class", getName().replace(".", " ")); widget.addAttribute("class", getName().replace(".", " "));
if (m_label != null) { generateDescriptionXML(state,widget);
widget.addAttribute("label", // if (m_label != null) {
(String) m_label.localize(state.getRequest())); // widget.addAttribute("label",
} // (String) m_label.localize(state.getRequest()));
// }
exportAttributes(widget); exportAttributes(widget);
String value = null; String value = null;
ParameterData p = getParameterData(state); ParameterData p = getParameterData(state);

View File

@ -43,7 +43,9 @@ public abstract class DefineContainer extends DefineComponent {
* so we get the text here in several discrete chunks separated * so we get the text here in several discrete chunks separated
* by our child component tags, instead of in one big chunk at the * by our child component tags, instead of in one big chunk at the
* end. * end.
* @return
*/ */
@Override
public int doAfterBody() { public int doAfterBody() {
if (bodyContent == null) { if (bodyContent == null) {
return SKIP_BODY; return SKIP_BODY;
@ -76,6 +78,8 @@ public abstract class DefineContainer extends DefineComponent {
/** /**
* adds a component to the container represented by this tag. * adds a component to the container represented by this tag.
*
* @param c
*/ */
public void addComponent(Component c) { public void addComponent(Component c) {
((Container)this.getComponent()).add(c); ((Container)this.getComponent()).add(c);

View File

@ -43,8 +43,10 @@ package com.arsdigita.bebop.util;
* *
* @author Jim Parsons * @author Jim Parsons
* @version $Id: Color.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: Color.java 287 2005-02-22 00:29:02Z sskracic $
* @deprecated without replacement. Bebop must never directly specify design
* properties but semantic properties. tjhe theme engine
* decides about the design and the display!
*/ */
public class Color { public class Color {
private int m_red = 255; private int m_red = 255;
@ -101,6 +103,9 @@ public class Color {
* @param green the amount of green. Must be an int in the range of 0 to * @param green the amount of green. Must be an int in the range of 0 to
* 255. * 255.
* @param blue the amount of blue. Must be an int in the range of 0 to 255. * @param blue the amount of blue. Must be an int in the range of 0 to 255.
* @deprecated without replacement. Bebop must never directly specify design
* properties but semantic properties. tjhe theme engine
* decides about the design and the display!
*/ */
public Color(int redValue, int greenValue, int blueValue) { public Color(int redValue, int greenValue, int blueValue) {
if (redValue >= 0 && redValue < 256) { if (redValue >= 0 && redValue < 256) {

View File

@ -0,0 +1,103 @@
/*
* Copyright (C) 2014 Peter Boy, University of Bremen. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.bebop.util;
/**
* An interface that contains positional constraints used by the panel classes
* (BoxPanel, ColumnPanel and GridPanel) in generating the output XML.
*
* Used by some other classes as well which have to position box elements (e.g.
* c.ad.bebop.form.ImageSubmit)
*
* @author Peter Boy (pb@zes.uni-bremen.de)
* @version $Id: PanelConstraints.java 1224 2014-06-18 22:28:30Z $
*/
public interface PanelConstraints {
/**
* Left-align a component.
*/
public static final int LEFT = 1 ; // << 0;
/**
* Center a component.
*/
public static final int CENTER = 1 << 1;
/**
* Right-align a component.
*/
public static final int RIGHT = 1 << 2;
/**
* Align the top of a component.
*/
public static final int TOP = 1 << 3;
/**
* Align the middle of a component.
*/
public static final int MIDDLE = 1 << 4;
/**
* Align the bottom of a component.
*/
public static final int BOTTOM = 1 << 5;
/**
* Lay out a component across the full width of the panel.
*/
public static final int FULL_WIDTH = 1 << 6;
/**
* Insert the child component assuming it is printed in a table with the
* same number of columns.
*/
public static final int INSERT = 1 << 7;
/**
* Constant for specifying ABSMIDDLE alignment of this image input. See the
* <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.
*/
public static final int ABSMIDDLE = 1 << 8;
/**
* Constant for specifying ABSBOTTOM alignment of this image input. See the
* <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.
*/
public static final int ABSBOTTOM = 1 << 9;
/**
* Constant for specifying ABSBOTTOM alignment of this image input. See the
* <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.
*/
public static final int TEXTTOP = 1 << 10;
/**
* Constant for specifying ABSBOTTOM alignment of this image input. See the
* <a href="http://www.w3.org/TR/html4/present/graphics.html#alignment">
* W3C HTML 4.01 Specification</a> for a description of this attribute.
*/
public static final int BASELINE = 1 << 11;
}

View File

@ -26,12 +26,14 @@ import com.arsdigita.util.servlet.HttpHost;
import com.arsdigita.web.Host; import com.arsdigita.web.Host;
import com.arsdigita.web.ParameterMap; import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URLDecoder; import java.net.URLDecoder;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -51,6 +53,8 @@ import org.apache.log4j.Logger;
* {@link CacheTable#remove(String)} invocations, no hash code is produced, and * {@link CacheTable#remove(String)} invocations, no hash code is produced, and
* peer caches will remove this item unconditionally. </p> * peer caches will remove this item unconditionally. </p>
* *
* Activated and referenced via web.xml!
*
* @author Matthew Booth * @author Matthew Booth
* @author Sebastian Skracic * @author Sebastian Skracic
* *
@ -71,7 +75,10 @@ public class CacheServlet extends HttpServlet {
/** /**
* This is executed when foreign server asked us to drop an entry * This is executed when foreign server asked us to drop an entry
* from our cache. Make sure that we don't end up in recursion. * from our cache. Make sure that we don't end up in recursion.
* @param req
* @param res
*/ */
@Override
protected void doGet( HttpServletRequest req, HttpServletResponse res ) { protected void doGet( HttpServletRequest req, HttpServletResponse res ) {
String id = req.getParameter( ID ); String id = req.getParameter( ID );
String key = req.getParameter( KEY ); String key = req.getParameter( KEY );
@ -295,6 +302,7 @@ public class CacheServlet extends HttpServlet {
m_url = url; m_url = url;
} }
@Override
public void run() { public void run() {
try { try {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {

View File

@ -146,6 +146,7 @@ public class HttpHost {
* @return <code>getName() + ":" + getPort()</code> or simply * @return <code>getName() + ":" + getPort()</code> or simply
* <code>getName()</code> if the port is 80 * <code>getName()</code> if the port is 80
*/ */
@Override
public String toString() { public String toString() {
final StringBuffer buffer = new StringBuffer(24); final StringBuffer buffer = new StringBuffer(24);

View File

@ -33,9 +33,9 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* This page checks to make sure that the database is still working * This page checks to make sure that the database is still working properly.
* properly. If it is, the page contains the word "success". If it * If it is, the page contains the word "success". If it is not then
* is not then it returned the word "failed". * it returned the word "failed".
* *
* To use this, simply map it to a URL in one of your dispatchers. * To use this, simply map it to a URL in one of your dispatchers.
* You can then point the correct keepalive script to point at the page * You can then point the correct keepalive script to point at the page
@ -49,8 +49,16 @@ public class DBTestServlet extends HttpServlet {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(DBTestServlet.class); Logger.getLogger(DBTestServlet.class);
private Date m_date = new Date(); private final Date m_date = new Date();
/**
*
* @param sreq
* @param sresp
* @throws ServletException
* @throws IOException
*/
@Override
public final void service(final HttpServletRequest sreq, public final void service(final HttpServletRequest sreq,
final HttpServletResponse sresp) final HttpServletResponse sresp)
throws ServletException, IOException { throws ServletException, IOException {

View File

@ -123,7 +123,6 @@
<servlet-class>com.arsdigita.ui.permissions.PermissionsServlet</servlet-class> <servlet-class>com.arsdigita.ui.permissions.PermissionsServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>webdevsupport</servlet-name> <servlet-name>webdevsupport</servlet-name>
<servlet-class>com.arsdigita.webdevsupport.WebDevSupportServlet</servlet-class> <servlet-class>com.arsdigita.webdevsupport.WebDevSupportServlet</servlet-class>

View File

@ -153,7 +153,8 @@ public class CreateDocLinkPane extends SimpleContainer
m_paginator.setHiddenIfSinglePage(false); m_paginator.setHiddenIfSinglePage(false);
m_mainContainer.add(bottom); m_mainContainer.add(bottom);
m_errorMessages = new Label(""); m_errorMessages = new Label("");
m_errorMessages.setColor(Color.red); // DEPRECATED! The theme decides how to display a error message.
// m_errorMessages.setColor(Color.red);
m_mainContainer.add(m_errorMessages); m_mainContainer.add(m_errorMessages);
//Add Search Results table //Add Search Results table

View File

@ -37,6 +37,8 @@ import com.arsdigita.bebop.form.RadioGroup;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.parameters.ArrayParameter; import com.arsdigita.bebop.parameters.ArrayParameter;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import static com.arsdigita.bebop.util.PanelConstraints.FULL_WIDTH;
import static com.arsdigita.bebop.util.PanelConstraints.RIGHT;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.forum.DailySubscription; import com.arsdigita.forum.DailySubscription;
import com.arsdigita.forum.Forum; import com.arsdigita.forum.Forum;

View File

@ -13,11 +13,9 @@
* *
*/ */
package com.arsdigita.coventry.cms.contenttypes; package com.arsdigita.london.contenttypes;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;

View File

@ -13,17 +13,9 @@
* *
*/ */
package com.arsdigita.coventry.cms.contenttypes; package com.arsdigita.london.contenttypes;
import com.arsdigita.cms.contenttypes.*;import com.arsdigita.cms.ContentType; import com.arsdigita.cms.contenttypes.*;
import com.arsdigita.db.*;
import com.arsdigita.persistence.pdl.*;
import com.arsdigita.runtime.*;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.persistence.DataObject;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -34,21 +26,19 @@ import org.apache.log4j.Logger;
* @version $Id: CouncillorInitializer.java 1489 2007-03-19 11:39:58Z apevec $ * @version $Id: CouncillorInitializer.java 1489 2007-03-19 11:39:58Z apevec $
*/ */
public class CouncillorInitializer extends ContentTypeInitializer { public class CouncillorInitializer extends ContentTypeInitializer {
public final static String versionId =
"$Id: CouncillorInitializer.java 1489 2007-03-19 11:39:58Z apevec $" +
"$Author: apevec $" +
"$DateTime: 2004/03/03 22:35:47 $";
private static final Logger s_log = Logger.getLogger(CouncillorInitializer.class); private static final Logger s_log = Logger.getLogger(CouncillorInitializer.class);
public CouncillorInitializer() { public CouncillorInitializer() {
super("ccm-ldn-coventry-councillor.pdl.mf", Councillor.BASE_DATA_OBJECT_TYPE); super("ccm-ldn-types-councillor.pdl.mf", Councillor.BASE_DATA_OBJECT_TYPE);
} }
@Override
public String getTraversalXML() { public String getTraversalXML() {
return "WEB-INF/traversal-adapters/com/arsdigita/coventry/cms/contenttypes/Councillor.xml"; return "WEB-INF/traversal-adapters/com/arsdigita/london/contenttypes/Councillor.xml";
} }
@Override
public String[] getStylesheets() { public String[] getStylesheets() {
return new String[] { "/__ccm__/themes/coventry/types/Councillor.xsl" }; return new String[] { "/__ccm__/themes/coventry/types/Councillor.xsl" };
} }

View File

@ -13,10 +13,10 @@
* *
*/ */
package com.arsdigita.coventry.cms.contenttypes; package com.arsdigita.london.contenttypes;
import com.arsdigita.cms.TextAsset; import com.arsdigita.cms.TextAsset;
import com.arsdigita.cms.TextPage; // import com.arsdigita.cms.TextPage;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;

View File

@ -13,13 +13,12 @@
* *
*/ */
package com.arsdigita.coventry.cms.contenttypes.ui; package com.arsdigita.london.contenttypes.ui;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;

View File

@ -20,13 +20,20 @@ package com.arsdigita.portalserver.permissions;
import com.arsdigita.bebop.*; import com.arsdigita.bebop.*;
import com.arsdigita.bebop.event.*; import com.arsdigita.bebop.event.*;
import com.arsdigita.bebop.util.Color;
/**
*
*
*/
class ErrorMessageDisplay extends Label { class ErrorMessageDisplay extends Label {
public ErrorMessageDisplay(final RequestLocal errorMessageRL) { public ErrorMessageDisplay(final RequestLocal errorMessageRL) {
setColor(Color.red); // deprecated / forbidden"
// Bebop must not specify design properties but just logical / semantic
// porperties. The theme decides how to display an error messages.
// setColor(Color.red);
setClassAttr("pageErrorDisplay"); setClassAttr("pageErrorDisplay");
addPrintListener(new PrintListener() { addPrintListener(new PrintListener() {
@Override
public void prepare(PrintEvent ev) { public void prepare(PrintEvent ev) {
Label target = (Label)ev.getTarget(); Label target = (Label)ev.getTarget();
String errMsg = String errMsg =

View File

@ -55,17 +55,18 @@ import com.arsdigita.util.Assert;
import org.apache.log4j.Category; import org.apache.log4j.Category;
/**
*
* @version $Id: ObjectPermissionEdit.java#3 $
*/
public class ObjectPermissionEdit extends CompoundComponent { public class ObjectPermissionEdit extends CompoundComponent {
public static final String versionId =
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/permissions/ObjectPermissionEdit.java#3 $" +
"$Author: dennis $" +
"$DateTime: 2004/08/17 23:19:25 $";
private static Category s_log = Category.getInstance private static Category s_log = Category.getInstance
(ObjectPermissionEdit.class.getName()); (ObjectPermissionEdit.class.getName());
// Heavily-reused per-request label for renderer getComponent calls // Heavily-reused per-request label for renderer getComponent calls
private final static RequestLocal s_dynamicLabel = new RequestLocal() { private final static RequestLocal s_dynamicLabel = new RequestLocal() {
@Override
public Object initialValue(PageState ps) { public Object initialValue(PageState ps) {
return new Label(); return new Label();
} }
@ -555,7 +556,10 @@ public class ObjectPermissionEdit extends CompoundComponent {
} }
} }
}; };
noMatchLabel.setColor(Color.red); // @deprecated bebop must not specify design properties, just
// logical properties.
// TODO: add as error condition to the widget.
// noMatchLabel.setColor(Color.red);
otherSearch.add(noMatchLabel); otherSearch.add(noMatchLabel);
// Label to display when too many matches are found. // Label to display when too many matches are found.
@ -575,7 +579,11 @@ public class ObjectPermissionEdit extends CompoundComponent {
} }
} }
}; };
tooManyLabel.setColor(Color.red); // @deprecated bebop must not specify design properties, just
// logical properties.
// TODO: add as error condition to the widget.
// noMatchLabel.setColor(Color.red);
// tooManyLabel.setColor(Color.red);
otherSearch.add(tooManyLabel); otherSearch.add(tooManyLabel);

View File

@ -48,7 +48,6 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.toolbox.ui.DataQueryBuilder; import com.arsdigita.toolbox.ui.DataQueryBuilder;
@ -61,7 +60,6 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.simplesurvey.Survey; import com.arsdigita.simplesurvey.Survey;
import com.arsdigita.simplesurvey.ui.SurveySelectionModel; import com.arsdigita.simplesurvey.ui.SurveySelectionModel;
import java.math.BigDecimal;
import java.math.BigDecimal; import java.math.BigDecimal;
public class AnswerValuesPanel extends SimpleContainer { public class AnswerValuesPanel extends SimpleContainer {
@ -300,11 +298,14 @@ public class AnswerValuesPanel extends SimpleContainer {
int column) { int column) {
Label label = new Label(GlobalizationUtil.globalize((String) value)); Label label = new Label(GlobalizationUtil.globalize((String) value));
label.setVerticalAlignment(CENTER); // Removed. Is is the responsibility of the theme to position Labels
// appropriately. We have to check for side effects in older themes!
// label.setVerticalAlignment(CENTER);
return label; return label;
} }
} }
private class QuestionTextRenderer implements TableCellRenderer { private class QuestionTextRenderer implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, int row, boolean isSelected, Object key, int row,
int column) { int column) {
@ -322,6 +323,7 @@ public class AnswerValuesPanel extends SimpleContainer {
} }
private class EditLinkRenderer implements TableCellRenderer { private class EditLinkRenderer implements TableCellRenderer {
@Override
public Component getComponent(Table table, PageState ps, Object value, public Component getComponent(Table table, PageState ps, Object value,
boolean isSelected, Object key, int row, boolean isSelected, Object key, int row,
int column) { int column) {

View File

@ -33,6 +33,8 @@ import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.DateParameter; import com.arsdigita.bebop.parameters.DateParameter;
import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import static com.arsdigita.bebop.util.PanelConstraints.RIGHT;
import static com.arsdigita.bebop.util.PanelConstraints.TOP;
// import com.arsdigita.categorization.Category; // import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.categorization.CategoryCollection;
import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.ContentBundle;