Package es.java.otro.view

Source Code of es.java.otro.view.EntryTableContentProvider

/**
*
*/
package es.java.otro.view;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Observable;
import java.util.Observer;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

import es.java.otro.model.Feed;

/**
* @author jaime
*
*/
public class EntryTableContentProvider implements IStructuredContentProvider,
    PropertyChangeListener, Observer {

  private Viewer viewer;

  public EntryTableContentProvider() {

  }

  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
   * .lang.Object)
   */
  @Override
  public Object[] getElements(Object inputElement) {
    if (inputElement instanceof Feed) {
      Feed feed = (Feed) inputElement;
      return feed.getEntries().toArray();
    } else {
      return new Object[0];
    }
  }

  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.viewers.IContentProvider#dispose()
   */
  @Override
  public void dispose() {
    // TODO Auto-generated method stub

  }

  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
   * .viewers.Viewer, java.lang.Object, java.lang.Object)
   */
  @Override
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    this.viewer = viewer;
    this.viewer.refresh();
  }

  @Override
  public void propertyChange(PropertyChangeEvent arg0) {
    viewer.refresh();
  }

  @Override
  public void update(Observable arg0, Object arg1) {
    viewer.refresh();
  }

 
}
TOP

Related Classes of es.java.otro.view.EntryTableContentProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.