001 // This file is part of AceWiki.
002 // Copyright 2008-2012, AceWiki developers.
003 //
004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU
005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of
006 // the License, or (at your option) any later version.
007 //
008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010 // Lesser General Public License for more details.
011 //
012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If
013 // not, see http://www.gnu.org/licenses/.
014
015 package ch.uzh.ifi.attempto.preditor;
016
017 import java.util.Comparator;
018 import java.util.List;
019
020 import ch.uzh.ifi.attempto.base.ConcreteOption;
021 import ch.uzh.ifi.attempto.base.NextTokenOptions;
022
023 /**
024 * This interface represents an object that can create the menus for the predictive editor.
025 * {@link DefaultMenuCreator} is the menu creator used by default.
026 *
027 * @author Tobias Kuhn
028 */
029 public interface MenuCreator {
030
031 /**
032 * This method must create and return the menu entry object for the given concrete option.
033 * described by the given next token options.
034 *
035 * @param option The concrete option that represents a possible next token.
036 * @return A new menu entry object for the given option.
037 */
038 public MenuEntry createMenuEntry(ConcreteOption option);
039
040 /**
041 * This method should return the special menu items for the given situation (described by the
042 * next token options).
043 *
044 * @param options The options for the next token.
045 * @return A list of special menu items to be shown.
046 */
047 public List<SpecialMenuItem> createSpecialMenuItems(NextTokenOptions options);
048
049 /**
050 * This method can be used to define the ordering of the menu groups. Menu groups with names
051 * that are not contained in the list returned by this method appear in an undefined order. All
052 * other menu groups appear in the same order as in the list.
053 *
054 * @return A list of menu group names.
055 */
056 public List<String> getMenuGroupOrdering();
057
058 /**
059 * This method should return the shift of the color to be used for the given menu block. A
060 * shift value of 120, for example, means a shift by 120 "degrees" towards violet. A shift of
061 * 360 is a full rotation and result in the original color.
062 *
063 * @param menuBlockName The name of the menu block for which the color shift should be
064 * returned.
065 * @return The color shift value.
066 */
067 public int getColorShift(String menuBlockName);
068
069 /**
070 * This method can return a comparator to define the order of the menu items within each menu
071 * group.
072 *
073 * @return A comparator to compare menu items.
074 */
075 public Comparator<MenuItem> getMenuItemComparator();
076
077 }