All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.alantea.swing.tree.SimpleTreeDialog Maven / Gradle / Ivy

package net.alantea.swing.tree;

import java.awt.Frame;

import javax.swing.JLabel;

@SuppressWarnings("serial")
public class SimpleTreeDialog extends TreeDialog
{
   private Class target;
   private String title;
   private ITreeContentProvider contentProvider;

   public SimpleTreeDialog(Frame parentShell, String title, Object root, ITreeContentProvider contentProvider, Class target)
   {
      super(parentShell, root);
      this.contentProvider = contentProvider;
      this.target = target;
      this.title = title;
   }
   
   protected void setContentProvider(ITreeContentProvider contentProvider)
   {
      this.contentProvider = contentProvider;
   }
   
   @Override
   protected void setHeader()
   {
      JLabel label = new JLabel();
      label.setText(title);
   }

   public ITreeContentProvider getTreeContentProvider()
   {
      return contentProvider;
   }

   @Override
   protected boolean validateSelection(Object selection)
   {
       return target.isAssignableFrom(selection.getClass());
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy