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

some code refactoring

parent b3acd964
Branches
Tags
No related merge requests found
......@@ -14,6 +14,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.prefs.Preferences;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
import fr.soleil.docking.action.ViewAction;
......@@ -111,6 +113,22 @@ public abstract class AbstractViewFactory implements IViewFactory {
return toRemove;
}
@Override
public IView addView(String title, Icon icon, Component component, Object id) {
return addView(title, icon, component, id, null);
}
@Override
public IView addView(String title, Icon icon, Component component, Object id, JComponent dockingArea) {
IView view = createView(title, icon, component, id);
updateViewForDockingArea(view, dockingArea);
return addView(view);
}
protected abstract IView createView(String title, Icon icon, Component component, Object id);
protected abstract void updateViewForDockingArea(IView view, JComponent dockingArea);
@Override
public boolean removeView(IView view) {
boolean result;
......
......@@ -78,6 +78,18 @@ public interface IViewFactory {
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 the 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
* @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);
/**
* 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment