Skip to content
Snippets Groups Projects
Commit 5aa1064b authored by Raphael GIRARDOT's avatar Raphael GIRARDOT Committed by Patrick MADELA
Browse files

IViewFactory can customize view icons, title, etc...

ViewFactory becomes AbstractViewFactory
parent 308cb80c
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,12 @@ import fr.soleil.docking.action.ViewAction; ...@@ -22,12 +22,12 @@ import fr.soleil.docking.action.ViewAction;
* *
* @author girardot * @author girardot
*/ */
public class ViewFactory implements IViewFactory { public abstract class AbstractViewFactory implements IViewFactory {
protected final Map<Object, IView> views; protected final Map<Object, IView> views;
protected final PropertyChangeSupport support; protected final PropertyChangeSupport support;
public ViewFactory() { public AbstractViewFactory() {
super(); super();
views = new ConcurrentHashMap<Object, IView>(); views = new ConcurrentHashMap<Object, IView>();
support = new PropertyChangeSupport(this); support = new PropertyChangeSupport(this);
......
package fr.soleil.docking.view; package fr.soleil.docking.view;
import java.awt.Component;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
...@@ -9,6 +10,8 @@ import java.util.List; ...@@ -9,6 +10,8 @@ import java.util.List;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
/** /**
* A factory that takes care of initializing dockable components and transmitting models. * A factory that takes care of initializing dockable components and transmitting models.
...@@ -75,6 +78,19 @@ public interface IViewFactory { ...@@ -75,6 +78,19 @@ public interface IViewFactory {
public IView addView(IView view); public IView addView(IView view);
/**
* Creates an {@link IView} for a given {@link Component}, adds it in the list of views, and
* tries to put it in a docking area
*
* @param title The {@link IView} title
* @param icon The {@link IView} {@link Icon}
* @param component The concerned {@link Component}
* @param id The {@link IView} id
* @param dockingArea The docking area
* @return The {@link IView} if it was successfully created and added, <code>null</code> otherwise
*/
public IView addView(String title, Icon icon, Component component, Object id, JComponent dockingArea);
public boolean removeView(IView view); public boolean removeView(IView view);
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment