| 1 | // Copyright 2004-2007 Jean-Francois Poilpret |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package net.sourceforge.hivegui.menu; |
| 16 | |
| 17 | import java.util.ArrayList; |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.apache.hivemind.impl.BaseLocatable; |
| 21 | import org.apache.hivemind.util.ToStringBuilder; |
| 22 | |
| 23 | /** |
| 24 | * @author Jean-Francois Poilpret |
| 25 | */ |
| 26 | public class MenuContribution extends BaseLocatable |
| 27 | { |
| 28 | public void setId(String id) |
| 29 | { |
| 30 | _id = id; |
| 31 | } |
| 32 | public String getId() |
| 33 | { |
| 34 | return _id; |
| 35 | } |
| 36 | |
| 37 | public void setOrder(int order) |
| 38 | { |
| 39 | _order = order; |
| 40 | } |
| 41 | public int getOrder() |
| 42 | { |
| 43 | return _order; |
| 44 | } |
| 45 | |
| 46 | public void setPopup(boolean popup) |
| 47 | { |
| 48 | _popup = popup; |
| 49 | } |
| 50 | public boolean isPopup() |
| 51 | { |
| 52 | return _popup; |
| 53 | } |
| 54 | |
| 55 | public void addItem(String item) |
| 56 | { |
| 57 | _items.add(item); |
| 58 | } |
| 59 | public String[] getItems() |
| 60 | { |
| 61 | return _items.toArray(new String[_items.size()]); |
| 62 | } |
| 63 | |
| 64 | @Override public String toString() |
| 65 | { |
| 66 | ToStringBuilder builder = new ToStringBuilder(this); |
| 67 | builder.append("id", _id); |
| 68 | builder.append("order", _order); |
| 69 | builder.append("popup", _popup); |
| 70 | return builder.toString(); |
| 71 | } |
| 72 | |
| 73 | private String _id; |
| 74 | private int _order; |
| 75 | private boolean _popup; |
| 76 | private List<String> _items = new ArrayList<String>(); |
| 77 | } |