001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (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.ui.apps.datesearch; 029 030import org.opencms.main.CmsLog; 031import org.opencms.ui.A_CmsUI; 032import org.opencms.ui.apps.A_CmsWorkplaceApp; 033import org.opencms.ui.apps.CmsFileExplorer; 034import org.opencms.ui.apps.I_CmsAppUIContext; 035import org.opencms.ui.apps.Messages; 036import org.opencms.ui.components.CmsComponentState; 037import org.opencms.util.CmsStringUtil; 038 039import java.util.LinkedHashMap; 040import java.util.List; 041 042import org.apache.commons.logging.Log; 043 044import com.vaadin.server.Sizeable.Unit; 045import com.vaadin.ui.Component; 046import com.vaadin.ui.HorizontalSplitPanel; 047 048/** 049 * Date search Vaadin app.<p> 050 */ 051public class CmsDateSearchApp extends A_CmsWorkplaceApp { 052 053 /** The log object for this class. */ 054 static final Log LOG = CmsLog.getLog(CmsDateSearchApp.class); 055 056 /** The date search component */ 057 private CmsDateSearchComposite m_dateSearchComposite; 058 059 /** 060 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#initUI(org.opencms.ui.apps.I_CmsAppUIContext) 061 */ 062 @Override 063 public void initUI(I_CmsAppUIContext context) { 064 065 context.addPublishButton(changed -> { 066 if (m_dateSearchComposite != null) { 067 m_dateSearchComposite.search(false, false); 068 } 069 }); 070 super.initUI(context); 071 } 072 073 /** 074 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getBreadCrumbForState(java.lang.String) 075 */ 076 @Override 077 protected LinkedHashMap<String, String> getBreadCrumbForState(String state) { 078 079 LinkedHashMap<String, String> crumbs = new LinkedHashMap<>(); 080 crumbs.put("", Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.GUI_DATE_SEARCH_TITLE_0)); 081 return crumbs; 082 } 083 084 /** 085 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getComponentForState(java.lang.String) 086 */ 087 @Override 088 protected Component getComponentForState(String state) { 089 090 m_rootLayout.setMainHeightFull(true); 091 HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); 092 splitPanel.setSizeFull(); 093 m_dateSearchComposite = new CmsDateSearchComposite(); 094 splitPanel.setFirstComponent(m_dateSearchComposite.getFilterComponent()); 095 splitPanel.setSecondComponent(m_dateSearchComposite.getResultComponent()); 096 splitPanel.setSplitPosition(CmsFileExplorer.LAYOUT_SPLIT_POSITION, Unit.PIXELS); 097 m_infoLayout.addComponents(m_dateSearchComposite.getResultFilterComponent()); 098 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(state)) { 099 CmsComponentState componentState = new CmsComponentState(state); 100 m_dateSearchComposite.setState(componentState); 101 m_dateSearchComposite.search(false, false); 102 } 103 return splitPanel; 104 } 105 106 /** 107 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getSubNavEntries(java.lang.String) 108 */ 109 @Override 110 protected List<NavEntry> getSubNavEntries(String state) { 111 112 return null; 113 } 114}