001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (C) Alkacon Software (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.postupload.client.ui; 029 030import org.opencms.gwt.client.property.CmsSimplePropertyEditor; 031import org.opencms.gwt.client.property.I_CmsPropertyEditorHandler; 032import org.opencms.gwt.client.ui.input.form.CmsInfoBoxFormFieldPanel; 033import org.opencms.util.CmsStringUtil; 034import org.opencms.xml.content.CmsXmlContentProperty; 035 036import java.util.Map; 037 038import com.google.gwt.user.client.ui.Label; 039 040/** 041 * A property editor for the upload property dialog.<p> 042 */ 043public class CmsUploadPropertyEditor extends CmsSimplePropertyEditor { 044 045 /** The warning message. */ 046 private String m_warning; 047 048 /** 049 * Creates a new instance.<p> 050 * 051 * @param propConfig the property configuration 052 * @param handler the property editor handler to use 053 */ 054 public CmsUploadPropertyEditor(Map<String, CmsXmlContentProperty> propConfig, I_CmsPropertyEditorHandler handler) { 055 056 super(propConfig, handler); 057 CmsUploadPropertyEditorHandler uploadPropertyHandler = (CmsUploadPropertyEditorHandler)handler; 058 m_warning = uploadPropertyHandler.getWarning(); 059 } 060 061 /** 062 * @see org.opencms.gwt.client.property.CmsSimplePropertyEditor#isAlwaysAllowEmpty(java.lang.String) 063 */ 064 @Override 065 protected boolean isAlwaysAllowEmpty(String name) { 066 067 return false; 068 } 069 070 /** 071 * @see org.opencms.gwt.client.property.CmsSimplePropertyEditor#setupFieldContainer() 072 */ 073 @Override 074 protected void setupFieldContainer() { 075 076 CmsInfoBoxFormFieldPanel panel = new CmsInfoBoxFormFieldPanel(m_handler.getPageInfo()); 077 if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_warning)) { 078 Label warningLabel = new Label(m_warning); 079 warningLabel.addStyleName( 080 org.opencms.ade.postupload.client.ui.css.I_CmsLayoutBundle.INSTANCE.dialogCss().warningBox()); 081 panel.addWidgetAfterListInfo(warningLabel); 082 } 083 m_form.setWidget(panel); 084 } 085 086}