001/*
002 * JGrapes Event Driven Framework
003 * Copyright (C) 2017-2018 Michael N. Lipp
004 * 
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Affero General Public License as published by 
007 * the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 * 
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU Affero General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jgrapes.portal.base;
020
021import java.util.Arrays;
022import java.util.HashSet;
023import java.util.Set;
024
025/**
026 * This interface provides portlet related constants. Portlets
027 * need not implement this interface, not even as a marker interface.
028 * They only have to expose a specific response behavior to certain
029 * events. An overview of the event sequences is provided by the
030 * package description. Make sure to read this description first.
031 */
032public interface Portlet {
033
034    /**
035     * The render modes.
036     */
037    enum RenderMode {
038        Preview, DeleteablePreview, View, Edit, Help;
039
040        /**
041         * Utility method that creates a {@link Set} of render modes
042         * from anumerated values.
043         *
044         * @param modes the modes
045         * @return the sets the
046         */
047        public static Set<RenderMode> asSet(RenderMode... modes) {
048            return new HashSet<>(Arrays.asList(modes));
049        }
050    }
051
052}