01: /*******************************************************************************
02: * Copyright (c) 2007 MyGWT and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Darrell Meyer <darrell@mygwt.net> - initial API and implementation
10: *******************************************************************************/package net.mygwt.ui.client.viewer;
11:
12: import java.util.List;
13:
14: /**
15: * A basic <code>IStructuredContentProvider</code> that supports arrays and
16: * lists.
17: */
18: public class DefaultContentProvider implements
19: IStructuredContentProvider {
20:
21: public void getElements(Object input, IAsyncContentCallback callback) {
22: if (input instanceof Object[]) {
23: callback.setElements((Object[]) input);
24: } else if (input instanceof List) {
25: callback.setElements(((List) input).toArray());
26: }
27: }
28:
29: public void inputChanged(Viewer viewer, Object oldInput,
30: Object newInput) {
31: }
32:
33: }
|