KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > internal > swt > ComboObservableList


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.internal.databinding.internal.swt;
12
13 import org.eclipse.jface.databinding.swt.SWTObservables;
14 import org.eclipse.swt.widgets.Combo;
15
16 /**
17  * @since 3.2
18  *
19  */

20 public class ComboObservableList extends SWTObservableList {
21
22     private final Combo combo;
23
24     /**
25      * @param combo
26      */

27     public ComboObservableList(Combo combo) {
28         super(SWTObservables.getRealm(combo.getDisplay()));
29         this.combo = combo;
30     }
31
32     protected int getItemCount() {
33         return combo.getItemCount();
34     }
35
36     protected void setItems(String JavaDoc[] newItems) {
37         combo.setItems(newItems);
38     }
39
40     protected String JavaDoc[] getItems() {
41         return combo.getItems();
42     }
43
44     protected String JavaDoc getItem(int index) {
45         return combo.getItem(index);
46     }
47
48     protected void setItem(int index, String JavaDoc string) {
49         combo.setItem(index, string);
50     }
51 }
52
Popular Tags