001: /*******************************************************************************
002: * Copyright (c) 2002, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal.cheatsheets.data;
011:
012: import java.util.ArrayList;
013: import java.util.Collection;
014:
015: /**
016: *
017: */
018: public class CheatSheet implements ICheatSheet {
019:
020: protected String title;
021: private Item introItem;
022: private ArrayList items;
023: private boolean containsCommandOrAction;
024:
025: /**
026: * Creates a new cheat sheet.
027: *
028: */
029: public CheatSheet() {
030: }
031:
032: /**
033: * This method sets the title of cheat sheet.
034: *
035: * @param title the title of cheat sheet
036: */
037: public void setTitle(String title) {
038: this .title = title;
039: }
040:
041: /**
042: * This method returns the title of the cheat sheet.
043: * @return the title of the cheat sheet
044: */
045: public String getTitle() {
046: return title;
047: }
048:
049: /**
050: * Returns the intro item.
051: */
052: public Item getIntroItem() {
053: return introItem;
054: }
055:
056: /**
057: * Returns the items.
058: */
059: public ArrayList getItems() {
060: return items;
061: }
062:
063: /**
064: * Returns the intro item.
065: */
066: public void setIntroItem(Item intro) {
067: introItem = intro;
068: }
069:
070: /**
071: * Adds an item to the cheat sheet.
072: *
073: * @param item the item to add
074: */
075: public void addItem(Item item) {
076: if (items == null) {
077: items = new ArrayList();
078: }
079: items.add(item);
080: }
081:
082: /**
083: * Adds all the items from the collection to the cheat sheet.
084: *
085: * @param c the collection of items to add
086: */
087: public void addItems(Collection c) {
088: if (items == null) {
089: items = new ArrayList();
090: }
091: items.addAll(c);
092: }
093:
094: public void setContainsCommandOrAction(
095: boolean containsCommandOrAction) {
096: this .containsCommandOrAction = containsCommandOrAction;
097: }
098:
099: public boolean isContainsCommandOrAction() {
100: return containsCommandOrAction;
101: }
102: }
|