RSS

Search Engine

Friday, July 2, 2010

Model

Create the following model class.

   
package de.vogella.dnd.jface.model;

public class Todo {
private String shortDescription;
private String longDescription;

public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getLongDescription() {
return longDescription;
}
public void setLongDescription(String longDescription) {
this.longDescription = longDescription;
}
}

Create the following content providers (Singletons).

   
package de.vogella.dnd.jface.model;

import java.util.ArrayList;
import java.util.List;

public enum ContentProvider {
INSTANCE;

public List getModel(){
List list = new ArrayList();
Todo todo = new Todo("Java", "Learn the Closure proposal");
list.add(todo);
todo = new Todo("Eclipse", "Learn more about the RCP platform");
list.add(todo);
return list;
}
}

   
package de.vogella.dnd.jface.model;

import java.util.ArrayList;
import java.util.List;

public enum ContentProviderTree {
INSTANCE;
List list = new ArrayList();

private ContentProviderTree() {
list.add("Branch1");
list.add("Branch1");
}

public List getModel(){
return list;
}
}

0 comments:

Post a Comment