01: /*
02: * CoadunationAdmin: The admin frontend for coadunation.
03: * Copyright (C) 2007 - 2008 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * ObjectsPanel.java
20: */
21:
22: package com.rift.coad.web.admin.client;
23:
24: // imports
25: import com.google.gwt.user.client.ui.AbstractImagePrototype;
26: import com.google.gwt.user.client.ui.Composite;
27: import com.google.gwt.user.client.ui.ImageBundle;
28: import com.google.gwt.user.client.ui.VerticalPanel;
29: import com.google.gwt.user.client.ui.Label;
30: import com.google.gwt.user.client.ui.ListBox;
31: import com.google.gwt.user.client.ui.ChangeListener;
32: import com.google.gwt.user.client.ui.Widget;
33:
34: /**
35: * This panel lists the objects that will be displayed on the frontend.
36: *
37: * @author brett chaldecott
38: */
39: public class MethodsPanel extends Composite implements ChangeListener {
40:
41: // private member variables
42: private MethodsListener listener = null;
43: private ListBox methods = new ListBox();
44:
45: /**
46: * Creates a new instance of ObjectsPanel
47: *
48: * @param listener The reference to the object listening for events on this
49: * object.
50: */
51: public MethodsPanel(MethodsListener listener) {
52: this .listener = listener;
53: VerticalPanel panel = new VerticalPanel();
54: panel.setStyleName("panel-Border");
55: Label objectLabel = new Label("Methods");
56: objectLabel.setStyleName("header-Label");
57: panel.add(objectLabel);
58: methods.setVisibleItemCount(10);
59: methods.setPixelSize(150, 200);
60: methods.addChangeListener(this );
61: panel.add(methods);
62:
63: initWidget(panel);
64: }
65:
66: /**
67: * This method adds the list of objects
68: */
69: public void setMethods(String[] entries) {
70: methods.clear();
71: for (int index = 0; index < entries.length; index++) {
72: methods.addItem(entries[index]);
73: }
74: }
75:
76: /**
77: * Deal with events on the methods panel
78: */
79: public void onChange(Widget sender) {
80: if (sender == methods) {
81: listener.methodSelected(methods.getItemText(methods
82: .getSelectedIndex()));
83: }
84: }
85:
86: }
|