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.publishqueue;
029
030import org.opencms.ui.A_CmsUI;
031import org.opencms.ui.CmsVaadinUtils;
032import org.opencms.ui.FontOpenCms;
033import org.opencms.ui.apps.A_CmsWorkplaceApp;
034import org.opencms.ui.apps.Messages;
035import org.opencms.ui.components.CmsToolBar;
036import org.opencms.util.CmsStringUtil;
037
038import java.util.LinkedHashMap;
039import java.util.List;
040
041import com.vaadin.ui.Button;
042import com.vaadin.ui.Button.ClickEvent;
043import com.vaadin.ui.Button.ClickListener;
044import com.vaadin.ui.Component;
045import com.vaadin.v7.ui.TextField;
046
047/**
048 *Class for the Publish queue app.<p>
049 */
050public class CmsPublishQueue extends A_CmsWorkplaceApp {
051
052    /** The file table filter input. */
053    private TextField m_siteTableFilter;
054
055    /** Reload button. */
056    private Button m_refreshButton;
057
058    /**
059     * Creates a new instance.
060     */
061    public CmsPublishQueue() {
062
063        super();
064        m_refreshButton = CmsToolBar.createButton(
065            FontOpenCms.RESET,
066            CmsVaadinUtils.getMessageText(Messages.GUI_APP_RELOAD_0));
067        m_refreshButton.addClickListener(new ClickListener() {
068
069            private static final long serialVersionUID = 1L;
070
071            public void buttonClick(ClickEvent event) {
072
073                A_CmsUI.get().getPage().reload();
074
075            }
076        });
077    }
078
079    /**
080     * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getBreadCrumbForState(java.lang.String)
081     */
082    @Override
083    protected LinkedHashMap<String, String> getBreadCrumbForState(String state) {
084
085        LinkedHashMap<String, String> crumbs = new LinkedHashMap<String, String>();
086
087        // Check if state is empty -> start
088        if (CmsStringUtil.isEmptyOrWhitespaceOnly(state)) {
089            crumbs.put("", CmsVaadinUtils.getMessageText(Messages.GUI_PQUEUE_TITLE_0));
090            return crumbs;
091        }
092        return new LinkedHashMap<String, String>(); //size==1 & state was not empty -> state doesn't match to known path
093    }
094
095    /**
096     * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getComponentForState(java.lang.String)
097     */
098    @Override
099    protected Component getComponentForState(String state) {
100
101        m_uiContext.addToolbarButton(m_refreshButton);
102        //default ->
103        if (CmsStringUtil.isEmptyOrWhitespaceOnly(state)) {
104            m_rootLayout.setMainHeightFull(true);
105            return new CmsQueuedTable(this);
106        }
107        return null;
108    }
109
110    /**
111     * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getSubNavEntries(java.lang.String)
112     */
113    @Override
114    protected List<NavEntry> getSubNavEntries(String state) {
115
116        return null;
117
118    }
119}