Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Icons] Implement getAsset in component providers

This removes usages of constructor calls for
ComponentTypeInfo and ViewInfo which involve
elements that have been moved to
ComponentProvider.getAsset. (Specifically,
these are icons and creation wizards.)

Where appropriate, these have been replaced
with appropriate getAsset implementations in
those component providers. In some cases
the icons present do not match up with
current icon implementations and have been
removed entirely.
  • Loading branch information...
commit 3b17a86157e98c5001fd891b42ff616e5f93476c 1 parent ec0fd3a
@VWoeltjen VWoeltjen authored
Showing with 357 additions and 210 deletions.
  1. +1 −5 ImportExportProvider/src/main/java/gov/nasa/arc/mct/importExport/provider/ImportExportProvider.java
  2. +61 −49 canvas/src/main/java/gov/nasa/arc/mct/canvas/provider/CanvasComponentProvider.java
  3. +24 −12 collectionComponent/src/main/java/gov/nasa/arc/mct/collection/CollectionComponentProvider.java
  4. +41 −25 dynamicGraphics/src/main/java/gov/nasa/arc/mct/graphics/GraphicalComponentProvider.java
  5. +24 −7 evaluatorComponent/src/main/java/gov/nasa/arc/mct/evaluator/component/EvaluatorComponentProvider.java
  6. +14 −4 evaluatorComponent/src/main/java/gov/nasa/arc/mct/evaluator/component/MultiComponentProvider.java
  7. +52 −27 exampleplugin/src/main/java/org/acme/example/component/ExampleComponentProvider.java
  8. +26 −10 executableButtons/src/main/java/gov/nasa/jsc/mct/executable/buttons/ExecutableButtonComponentProvider.java
  9. +29 −18 fastPlotViews/src/main/java/gov/nasa/arc/mct/fastplot/PlotViewProvider.java
  10. +24 −16 limits/src/main/java/gov/nasa/arc/mct/limits/LimitLineComponentProvider.java
  11. +21 −6 mctCoreTaxonomyProvider/src/main/java/gov/nasa/arc/mct/core/provider/CoreComponentProvider.java
  12. +1 −1  mctcore/src/main/java/gov/nasa/arc/mct/registry/ExternalComponentRegistryImpl.java
  13. +2 −8 nonTimePlots/src/main/java/gov/nasa/arc/mct/nontimeplot/NonTimePlotComponentProvider.java
  14. +10 −4 platform/src/main/java/gov/nasa/arc/mct/defaults/view/DefaultViewProvider.java
  15. +27 −18 tableViews/src/main/java/gov/nasa/arc/mct/table/TableViewProvider.java
View
6 ImportExportProvider/src/main/java/gov/nasa/arc/mct/importExport/provider/ImportExportProvider.java
@@ -33,8 +33,6 @@
import java.util.List;
import java.util.ResourceBundle;
-import javax.swing.ImageIcon;
-
/**
* The <code>ImportExportProvider</code> provides menu items to import data into a
* taxonomy node to the MCT directory and export data from a node.
@@ -54,9 +52,7 @@ public ImportExportProvider() {
* EventsCollection.class, false),
*/
new ComponentTypeInfo(bundle.getString("display_name"), bundle
- .getString("description"), ImportExportComponent.class, false,
- new ImageIcon(ImportExportComponent.class
- .getResource("/icons/legacyCollection.png"))));
+ .getString("description"), ImportExportComponent.class, false));
assert componentTypes != null;
}
View
110 canvas/src/main/java/gov/nasa/arc/mct/canvas/provider/CanvasComponentProvider.java
@@ -21,65 +21,68 @@
*******************************************************************************/
package gov.nasa.arc.mct.canvas.provider;
-import gov.nasa.arc.mct.canvas.policy.CanvasFilterViewPolicy;
-import gov.nasa.arc.mct.canvas.policy.EmbeddedCanvasViewsAreNotWriteable;
-import gov.nasa.arc.mct.canvas.view.CanvasManifestation;
-import gov.nasa.arc.mct.canvas.view.ChangeGridSizeAction;
-import gov.nasa.arc.mct.canvas.view.ChangeSnapAction;
-import gov.nasa.arc.mct.canvas.view.PanelInspector;
-import gov.nasa.arc.mct.canvas.view.ReTileAction;
-import gov.nasa.arc.mct.canvas.view.WindowChangeGridSizeAction;
-import gov.nasa.arc.mct.canvas.view.WindowChangeSnapAction;
-import gov.nasa.arc.mct.canvas.view.WindowReTileAction;
-import gov.nasa.arc.mct.gui.MenuItemInfo;
+import gov.nasa.arc.mct.canvas.policy.CanvasFilterViewPolicy;
+import gov.nasa.arc.mct.canvas.policy.EmbeddedCanvasViewsAreNotWriteable;
+import gov.nasa.arc.mct.canvas.view.CanvasManifestation;
+import gov.nasa.arc.mct.canvas.view.ChangeGridSizeAction;
+import gov.nasa.arc.mct.canvas.view.ChangeSnapAction;
+import gov.nasa.arc.mct.canvas.view.PanelInspector;
+import gov.nasa.arc.mct.canvas.view.ReTileAction;
+import gov.nasa.arc.mct.canvas.view.WindowChangeGridSizeAction;
+import gov.nasa.arc.mct.canvas.view.WindowChangeSnapAction;
+import gov.nasa.arc.mct.canvas.view.WindowReTileAction;
+import gov.nasa.arc.mct.gui.MenuItemInfo;
import gov.nasa.arc.mct.gui.MenuItemInfo.MenuItemType;
-import gov.nasa.arc.mct.menu.AlignBottomAction;
-import gov.nasa.arc.mct.menu.AlignHorizontalCenterAction;
-import gov.nasa.arc.mct.menu.AlignLeftAction;
-import gov.nasa.arc.mct.menu.AlignRightAction;
-import gov.nasa.arc.mct.menu.AlignTopAction;
-import gov.nasa.arc.mct.menu.AlignVerticalCenterAction;
-import gov.nasa.arc.mct.menu.AlignmentMenu;
-import gov.nasa.arc.mct.menu.BorderStylesAction;
-import gov.nasa.arc.mct.menu.BorderStylesMenu;
-import gov.nasa.arc.mct.menu.BordersAllOrNoneAction;
-import gov.nasa.arc.mct.menu.BordersBottomAction;
-import gov.nasa.arc.mct.menu.BordersLeftAction;
-import gov.nasa.arc.mct.menu.BordersMenu;
-import gov.nasa.arc.mct.menu.BordersRightAction;
-import gov.nasa.arc.mct.menu.BordersTopAction;
-import gov.nasa.arc.mct.menu.BringToFrontAction;
+import gov.nasa.arc.mct.menu.AlignBottomAction;
+import gov.nasa.arc.mct.menu.AlignHorizontalCenterAction;
+import gov.nasa.arc.mct.menu.AlignLeftAction;
+import gov.nasa.arc.mct.menu.AlignRightAction;
+import gov.nasa.arc.mct.menu.AlignTopAction;
+import gov.nasa.arc.mct.menu.AlignVerticalCenterAction;
+import gov.nasa.arc.mct.menu.AlignmentMenu;
+import gov.nasa.arc.mct.menu.BorderStylesAction;
+import gov.nasa.arc.mct.menu.BorderStylesMenu;
+import gov.nasa.arc.mct.menu.BordersAllOrNoneAction;
+import gov.nasa.arc.mct.menu.BordersBottomAction;
+import gov.nasa.arc.mct.menu.BordersLeftAction;
+import gov.nasa.arc.mct.menu.BordersMenu;
+import gov.nasa.arc.mct.menu.BordersRightAction;
+import gov.nasa.arc.mct.menu.BordersTopAction;
+import gov.nasa.arc.mct.menu.BringToFrontAction;
import gov.nasa.arc.mct.menu.ChangeViewAction;
-import gov.nasa.arc.mct.menu.ExportPanelAsImageAction;
-import gov.nasa.arc.mct.menu.GridMenu;
-import gov.nasa.arc.mct.menu.PanelTitleBarAction;
-import gov.nasa.arc.mct.menu.RemovePanelAction;
-import gov.nasa.arc.mct.menu.SelectAllAction;
-import gov.nasa.arc.mct.menu.SendToBackAction;
-import gov.nasa.arc.mct.menu.WindowGridMenu;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-import gov.nasa.arc.mct.services.component.ViewType;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.ResourceBundle;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.menu.ExportPanelAsImageAction;
+import gov.nasa.arc.mct.menu.GridMenu;
+import gov.nasa.arc.mct.menu.PanelTitleBarAction;
+import gov.nasa.arc.mct.menu.RemovePanelAction;
+import gov.nasa.arc.mct.menu.SelectAllAction;
+import gov.nasa.arc.mct.menu.SendToBackAction;
+import gov.nasa.arc.mct.menu.WindowGridMenu;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+import gov.nasa.arc.mct.services.component.ViewType;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.ResourceBundle;
+
+import javax.swing.ImageIcon;
public class CanvasComponentProvider extends AbstractComponentProvider {
- private static ResourceBundle bundle = ResourceBundle.getBundle("CanvasResourceBundle");
+ private static ResourceBundle bundle = ResourceBundle.getBundle("CanvasResourceBundle");
+
+ private static final ImageIcon ICON =
+ new ImageIcon(CanvasComponentProvider.class.getResource("/icons/mct_icon_menu_canvas.png"));
+
private static final Collection<ViewInfo> VIEW_INFOS =
Arrays.asList(
new ViewInfo(CanvasManifestation.class, bundle.getString("Canvas"), "gov.nasa.arc.mct.canvas.view.CanvasView",
- ViewType.OBJECT,
- new ImageIcon(CanvasComponentProvider.class.getResource("/icons/mct_icon_menu_canvas.png"))),
+ ViewType.OBJECT),
new ViewInfo(CanvasManifestation.class, bundle.getString("Canvas"), "gov.nasa.arc.mct.canvas.view.CanvasView",
ViewType.CENTER),
new ViewInfo(CanvasManifestation.class, bundle.getString("Canvas"), "gov.nasa.arc.mct.canvas.view.CanvasView",
- ViewType.EMBEDDED,
- new ImageIcon(CanvasComponentProvider.class.getResource("/icons/mct_icon_menu_canvas.png"))),
+ ViewType.EMBEDDED),
new ViewInfo(PanelInspector.class, "Panel Inspector", ViewType.CENTER_OWNED_INSPECTOR));
@Override
public Collection<MenuItemInfo> getMenuItemInfos() {
@@ -201,5 +204,14 @@
@Override
public Collection<ViewInfo> getViews(String componentTypeId) {
return VIEW_INFOS;
+ }
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class) &&
+ typeInfo.getTypeClass().equals(CanvasManifestation.class)) {
+ return assetClass.cast(ICON);
+ }
+ return super.getAsset(typeInfo, assetClass);
}
}
View
36 collectionComponent/src/main/java/gov/nasa/arc/mct/collection/CollectionComponentProvider.java
@@ -21,16 +21,17 @@
*******************************************************************************/
package gov.nasa.arc.mct.collection;
-import gov.nasa.arc.mct.components.collection.CollectionComponent;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ResourceBundle;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.components.collection.CollectionComponent;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ResourceBundle;
+
+import javax.swing.ImageIcon;
/**
* Provides the MCT Collection Component.
@@ -40,6 +41,8 @@
private static ResourceBundle bundle = ResourceBundle.getBundle("CollectionComponent");
private final ComponentTypeInfo componentTypeInfo;
+
+ private static final ImageIcon ICON = new ImageIcon(CollectionComponent.class.getResource("/icons/Collection.png"));
/**
* Default constructor for a collection component object.
@@ -49,7 +52,7 @@ public CollectionComponentProvider() {
componentTypeInfo = new ComponentTypeInfo(
bundle.getString("display_name"),
bundle.getString("description"),
- CollectionComponent.class, true, new ImageIcon(CollectionComponent.class.getResource("/icons/Collection.png")));
+ CollectionComponent.class, true);
}
@Override
@@ -60,5 +63,14 @@ public CollectionComponentProvider() {
@Override
public Collection<ViewInfo> getViews(String componentTypeId) {
return Collections.<ViewInfo>emptyList();
- }
+ }
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class) &&
+ typeInfo.getTypeClass().equals(CollectionComponent.class)) {
+ return assetClass.cast(ICON);
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
View
66 dynamicGraphics/src/main/java/gov/nasa/arc/mct/graphics/GraphicalComponentProvider.java
@@ -21,35 +21,38 @@
*******************************************************************************/
package gov.nasa.arc.mct.graphics;
-import gov.nasa.arc.mct.graphics.component.GraphicalComponent;
-import gov.nasa.arc.mct.graphics.component.GraphicalComponentWizardUI;
-import gov.nasa.arc.mct.graphics.view.GraphicalManifestation;
-import gov.nasa.arc.mct.graphics.view.StaticGraphicalView;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-import gov.nasa.arc.mct.services.component.ViewType;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.graphics.component.GraphicalComponent;
+import gov.nasa.arc.mct.graphics.component.GraphicalComponentWizardUI;
+import gov.nasa.arc.mct.graphics.view.GraphicalManifestation;
+import gov.nasa.arc.mct.graphics.view.StaticGraphicalView;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.CreateWizardUI;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+import gov.nasa.arc.mct.services.component.ViewType;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.swing.ImageIcon;
public class GraphicalComponentProvider extends AbstractComponentProvider {
private static ResourceBundle bundle = ResourceBundle.getBundle("GraphicsResourceBundle");
final Collection<PolicyInfo> policyInfos;
+
+ private static final ImageIcon VIEW_ICON =
+ new ImageIcon(GraphicalManifestation.class.getResource("/icons/mct_icon_menu_graphical.png"));
private static final List<ViewInfo> VIEW_INFOS = Arrays.asList(
- new ViewInfo(GraphicalManifestation.class, GraphicalManifestation.VIEW_ROLE_NAME, GraphicalManifestation.class.getName(), ViewType.OBJECT,
- new ImageIcon(GraphicalManifestation.class.getResource("/icons/mct_icon_menu_graphical.png"))),
- new ViewInfo(GraphicalManifestation.class, GraphicalManifestation.VIEW_ROLE_NAME, GraphicalManifestation.class.getName(), ViewType.EMBEDDED,
- new ImageIcon(GraphicalManifestation.class.getResource("/icons/mct_icon_menu_graphical.png"))),
+ new ViewInfo(GraphicalManifestation.class, GraphicalManifestation.VIEW_ROLE_NAME, GraphicalManifestation.class.getName(), ViewType.OBJECT),
+ new ViewInfo(GraphicalManifestation.class, GraphicalManifestation.VIEW_ROLE_NAME, GraphicalManifestation.class.getName(), ViewType.EMBEDDED),
new ViewInfo(StaticGraphicalView.class, GraphicalManifestation.VIEW_ROLE_NAME, ViewType.OBJECT),
new ViewInfo(StaticGraphicalView.class, GraphicalManifestation.VIEW_ROLE_NAME, ViewType.EMBEDDED)
);
@@ -74,10 +77,23 @@ public GraphicalComponentProvider(){
return Collections.singleton(
new ComponentTypeInfo(bundle.getString("Component_Name"),
bundle.getString("Component_Description"),
- GraphicalComponent.class,
- new GraphicalComponentWizardUI(),
- null));//new ImageIcon(GraphicalComponentProvider.class.getResource("/icons/importSVG.png"))));
+ GraphicalComponent.class));
}
-
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (typeInfo.getTypeClass().equals(GraphicalManifestation.class) ||
+ typeInfo.getTypeClass().equals(StaticGraphicalView.class)) {
+ return assetClass.cast(VIEW_ICON);
+ }
+ }
+ if (assetClass.isAssignableFrom(CreateWizardUI.class)) {
+ if (typeInfo.getTypeClass().equals(GraphicalComponent.class)) {
+ return assetClass.cast(new GraphicalComponentWizardUI());
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
View
31 evaluatorComponent/src/main/java/gov/nasa/arc/mct/evaluator/component/EvaluatorComponentProvider.java
@@ -31,6 +31,8 @@
import gov.nasa.arc.mct.policy.PolicyInfo;
import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.CreateWizardUI;
+import gov.nasa.arc.mct.services.component.TypeInfo;
import gov.nasa.arc.mct.services.component.ViewInfo;
import gov.nasa.arc.mct.services.component.ViewType;
@@ -48,14 +50,14 @@
private final Collection<ComponentTypeInfo> infos;
private final Collection<PolicyInfo> policies = new ArrayList<PolicyInfo>();
-
+
+ private static final ImageIcon VIEW_ICON = new ImageIcon(ExpressionsViewManifestation.class.getResource("/icons/mct_icon_menu_settings.png"));
public EvaluatorComponentProvider() {
infos = Arrays.asList(new ComponentTypeInfo(
bundle.getString("display_name"),
bundle.getString("description"),
- EvaluatorComponent.class,
- new EvaluatorWizardUI()));
+ EvaluatorComponent.class));
policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EvaluatorViewPolicy.class));
policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EnumeratorViewPolicy.class));
}
@@ -71,10 +73,9 @@ public EvaluatorComponentProvider() {
if (EvaluatorComponent.class.getName().equals(componentTypeId)) {
List<ViewInfo> views = new ArrayList<ViewInfo>();
views.add(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
- views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME, ExpressionsViewManifestation.class.getName(),
- ViewType.OBJECT,
- new ImageIcon(ExpressionsViewManifestation.class.getResource("/icons/mct_icon_menu_settings.png"))));
- views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME, ExpressionsViewManifestation.class.getName(), ViewType.CENTER, null, null, true, EvaluatorComponent.class));
+ views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME,
+ ExpressionsViewManifestation.class.getName(), ViewType.OBJECT));
+ views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME, ExpressionsViewManifestation.class.getName(), ViewType.CENTER, true, EvaluatorComponent.class));
return views;
}
return Collections.singleton(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
@@ -95,5 +96,21 @@ public EvaluatorComponentProvider() {
MenuItemType.NORMAL, PlaceObjectsInEnumAction.class));
}
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (typeInfo.getTypeClass().equals(ExpressionsViewManifestation.class)) {
+ return assetClass.cast(VIEW_ICON);
+ }
+ }
+ if (assetClass.isAssignableFrom(CreateWizardUI.class)) {
+ if (typeInfo.getTypeClass().equals(EvaluatorComponent.class)) {
+ return assetClass.cast(new EvaluatorWizardUI());
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
+
}
View
18 evaluatorComponent/src/main/java/gov/nasa/arc/mct/evaluator/component/MultiComponentProvider.java
@@ -33,6 +33,8 @@
import gov.nasa.arc.mct.policy.PolicyInfo;
import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.CreateWizardUI;
+import gov.nasa.arc.mct.services.component.TypeInfo;
import gov.nasa.arc.mct.services.component.ViewInfo;
import gov.nasa.arc.mct.services.component.ViewType;
@@ -58,8 +60,7 @@ public MultiComponentProvider() {
infos = Arrays.asList(new ComponentTypeInfo(
bundle.getString("display_name"),
bundle.getString("description"),
- MultiComponent.class,
- new MultiWizardUI()));
+ MultiComponent.class));
policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EvaluatorViewPolicy.class));
policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EnumeratorViewPolicy.class));
policies.add(new PolicyInfo(PolicyInfo.CategoryType.CAN_REMOVE_MANIFESTATION_CATEGORY.getKey(), MultiChildRemovalPolicy.class));
@@ -76,9 +77,9 @@ public MultiComponentProvider() {
public Collection<ViewInfo> getViews(String componentTypeId) {
if (MultiComponent.class.getName().equals(componentTypeId)) {
List<ViewInfo> views = new ArrayList<ViewInfo>();
- views.add(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.OBJECT, null, null, false, MultiComponent.class));
+ views.add(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.OBJECT, false, MultiComponent.class));
views.add(new ViewInfo(MultiViewManifestation.class, MultiViewManifestation.VIEW_NAME, ViewType.OBJECT));
- views.add(new ViewInfo(MultiViewManifestation.class, MultiViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.CENTER, null, null, true, MultiComponent.class));
+ views.add(new ViewInfo(MultiViewManifestation.class, MultiViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.CENTER, true, MultiComponent.class));
return views;
}
return Collections.singleton(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
@@ -100,4 +101,13 @@ public MultiComponentProvider() {
}
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(CreateWizardUI.class)) {
+ if (typeInfo.getTypeClass().equals(MultiComponent.class)) {
+ return assetClass.cast(new MultiWizardUI());
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
View
79 exampleplugin/src/main/java/org/acme/example/component/ExampleComponentProvider.java
@@ -21,33 +21,34 @@
*******************************************************************************/
package org.acme.example.component;
-import gov.nasa.arc.mct.gui.MenuItemInfo;
-import gov.nasa.arc.mct.gui.MenuItemInfo.MenuItemType;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-import gov.nasa.arc.mct.services.component.ViewType;
+import gov.nasa.arc.mct.gui.MenuItemInfo;
+import gov.nasa.arc.mct.gui.MenuItemInfo.MenuItemType;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+import gov.nasa.arc.mct.services.component.ViewType;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ResourceBundle;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ResourceBundle;
import javax.swing.ImageIcon;
-import org.acme.example.actions.APICreationAction;
-import org.acme.example.actions.AboutExampleAction;
-import org.acme.example.actions.AddOrRemoveNodeBorderAction;
-import org.acme.example.actions.BeepAction;
-import org.acme.example.actions.SubmenuMenu;
-import org.acme.example.policy.FilterViewPolicy;
-import org.acme.example.telemetry.TelemetryComponent;
-import org.acme.example.view.CenterPanePanel;
-import org.acme.example.view.PrivateInfoView;
-import org.acme.example.view.PublicInfoView;
-import org.acme.example.view.SaveModelStateView;
-import org.acme.example.view.ShowChildrenInTableView;
+import org.acme.example.actions.APICreationAction;
+import org.acme.example.actions.AboutExampleAction;
+import org.acme.example.actions.AddOrRemoveNodeBorderAction;
+import org.acme.example.actions.BeepAction;
+import org.acme.example.actions.SubmenuMenu;
+import org.acme.example.policy.FilterViewPolicy;
+import org.acme.example.telemetry.TelemetryComponent;
+import org.acme.example.view.CenterPanePanel;
+import org.acme.example.view.PrivateInfoView;
+import org.acme.example.view.PublicInfoView;
+import org.acme.example.view.SaveModelStateView;
+import org.acme.example.view.ShowChildrenInTableView;
/**
* The <code>ExampleComponentProvider</code> class exposes the <code>ExampleComponent</code> to MCT.
@@ -59,7 +60,10 @@
private final ComponentTypeInfo exampleComponentType;
private final ComponentTypeInfo telemetryComponentType;
-
+
+ private static final ImageIcon ICON =
+ new ImageIcon(ExampleComponentProvider.class.getResource("/icons/mct_icon_telemetry.png"));
+
public ExampleComponentProvider() {
// this is the component type we are providing. The display name and description are used
// by the MCT menu system for creating new instances and thus should be human readable
@@ -72,8 +76,7 @@ public ExampleComponentProvider() {
bundle.getString("telemetry_display_name"),
bundle.getString("telemetry_description"),
TelemetryComponent.class,
- true,
- new ImageIcon(getClass().getResource("/icons/mct_icon_telemetry.png")));
+ true);
}
@@ -177,5 +180,27 @@ public ExampleComponentProvider() {
* ExecutionResult result =
* policyManager.execute(String categoryKey, PolicyContext context);
*/
- }
+ }
+
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ /*
+ * Relevant "assets" associated with certain types should
+ * be delivered here. Examples of assets include ImageIcons and
+ * CreateWizardUI objects.
+ *
+ * Typically, it is desirable to provide any needed "assets"
+ * here for the ComponentTypeInfos and ViewInfos that are
+ * exposed in the same ComponentProvider. (In principle,
+ * however, this could be used as a way to introduce assets
+ * for types defined in a totally different plug-in.)
+ */
+ if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (typeInfo.getTypeClass().equals(TelemetryComponent.class)) {
+ return assetClass.cast(ICON);
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
View
36 executableButtons/src/main/java/gov/nasa/jsc/mct/executable/buttons/ExecutableButtonComponentProvider.java
@@ -25,6 +25,8 @@
import gov.nasa.arc.mct.gui.MenuItemInfo.MenuItemType;
import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.CreateWizardUI;
+import gov.nasa.arc.mct.services.component.TypeInfo;
import gov.nasa.arc.mct.services.component.ViewInfo;
import gov.nasa.arc.mct.services.component.ViewType;
import gov.nasa.jsc.mct.executable.buttons.view.ExecutableButtonManifestation;
@@ -45,6 +47,9 @@
private static final ResourceBundle bundle = ResourceBundle.getBundle("ResourceBundle");
private final AtomicReference<ComponentTypeInfo> executableButtonComponentType = new AtomicReference<ComponentTypeInfo>();
+
+// private static final ImageIcon VIEW_ICON =
+// new ImageIcon(ExecutableButtonComponent.class.getResource("/icons/executableIcon.png"));
private static final String OBJECTS_CREATE_EXT_PATH = "/objects/creation.ext";
private static final String THIS_EXECUTE_PATH = "/this/additions";
@@ -58,9 +63,7 @@ private ComponentTypeInfo createTypeInfo() {
return new ComponentTypeInfo(
bundle.getString("display_name"),
bundle.getString("description"),
- ExecutableButtonComponent.class,
- new CreateExecutableButtonComponentWizardUI(),
- new ImageIcon(ExecutableButtonComponent.class.getResource("/icons/executableIcon.png"))
+ ExecutableButtonComponent.class
);
}
@@ -74,13 +77,9 @@ private ComponentTypeInfo createTypeInfo() {
if (componentTypeId.equals(ExecutableButtonComponent.class.getName())) {
Collection<ViewInfo> views = new ArrayList<ViewInfo>();
views.add(new ViewInfo(ExecutableButtonManifestation.class, ExecutableButtonManifestation.VIEW_NAME, ExecutableButtonManifestation.class.getName(),
- ViewType.OBJECT,
- new ImageIcon(getClass().getResource("/icons/executableViewButton-OFF.png")),
- new ImageIcon(getClass().getResource("/icons/executableViewButton-ON.png")), false, ExecutableButtonComponent.class));
+ ViewType.OBJECT, false, ExecutableButtonComponent.class));
views.add(new ViewInfo(ExecutableButtonManifestation.class, ExecutableButtonManifestation.VIEW_NAME, ExecutableButtonManifestation.class.getName(),
- ViewType.EMBEDDED,
- new ImageIcon(getClass().getResource("/icons/executableViewButton-OFF.png")),
- new ImageIcon(getClass().getResource("/icons/executableViewButton-ON.png")), false, ExecutableButtonComponent.class));
+ ViewType.EMBEDDED, false, ExecutableButtonComponent.class));
return views;
}
@@ -101,6 +100,23 @@ private ComponentTypeInfo createTypeInfo() {
MenuItemType.NORMAL,
ExecutableButtonThisAction.class)
);
- }
+ }
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (typeInfo.getTypeClass().equals(ExecutableButtonManifestation.class)) {
+ // TODO: Needs new icon
+ // return assetClass.cast(VIEW_ICON);
+ }
+ }
+ if (assetClass.isAssignableFrom(CreateWizardUI.class)) {
+ if (typeInfo.getTypeClass().equals(ExecutableButtonComponent.class)) {
+ return assetClass.cast(new CreateExecutableButtonComponentWizardUI());
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
+
}
View
47 fastPlotViews/src/main/java/gov/nasa/arc/mct/fastplot/PlotViewProvider.java
@@ -21,19 +21,20 @@
*******************************************************************************/
package gov.nasa.arc.mct.fastplot;
-import gov.nasa.arc.mct.fastplot.policy.PlotStringPolicy;
-import gov.nasa.arc.mct.fastplot.policy.PlotViewPolicy;
-import gov.nasa.arc.mct.fastplot.view.PlotViewManifestation;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-import gov.nasa.arc.mct.services.component.ViewType;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.fastplot.policy.PlotStringPolicy;
+import gov.nasa.arc.mct.fastplot.policy.PlotViewPolicy;
+import gov.nasa.arc.mct.fastplot.view.PlotViewManifestation;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+import gov.nasa.arc.mct.services.component.ViewType;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.ImageIcon;
/**
* Factory for PlotViewRole.
@@ -42,6 +43,9 @@
final Collection<PolicyInfo> policyInfos;
private final List<ViewInfo> viewInfos;
+
+ private static final ImageIcon ICON =
+ new ImageIcon(PlotViewProvider.class.getResource("/icons/mct_icon_menu_plot.png"));
public PlotViewProvider() {
policyInfos = Arrays.asList(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), PlotViewPolicy.class),
@@ -49,11 +53,9 @@ public PlotViewProvider() {
);
viewInfos = Arrays.asList(
- new ViewInfo(PlotViewManifestation.class, PlotViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.OBJECT,
- new ImageIcon(getClass().getResource("/icons/mct_icon_menu_plot.png"))),
+ new ViewInfo(PlotViewManifestation.class, PlotViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.OBJECT),
new ViewInfo(PlotViewManifestation.class, PlotViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.CENTER),
- new ViewInfo(PlotViewManifestation.class, PlotViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.EMBEDDED,
- new ImageIcon(getClass().getResource("/icons/mct_icon_menu_plot.png"))));
+ new ViewInfo(PlotViewManifestation.class, PlotViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.EMBEDDED));
}
@Override
@@ -64,5 +66,14 @@ public PlotViewProvider() {
@Override
public Collection<PolicyInfo> getPolicyInfos() {
return policyInfos;
- }
+ }
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class) &&
+ typeInfo.getTypeClass().equals(PlotViewManifestation.class)) {
+ return assetClass.cast(ICON);
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
View
40 limits/src/main/java/gov/nasa/arc/mct/limits/LimitLineComponentProvider.java
@@ -21,32 +21,30 @@
*******************************************************************************/
package gov.nasa.arc.mct.limits;
-import gov.nasa.arc.mct.gui.MenuItemInfo;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ResourceBundle;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.gui.MenuItemInfo;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
+import gov.nasa.arc.mct.services.component.CreateWizardUI;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ResourceBundle;
public class LimitLineComponentProvider extends AbstractComponentProvider {
private static final ResourceBundle bundle = ResourceBundle.getBundle("Limits");
private final ComponentTypeInfo componentTypeInfo;
-
+
public LimitLineComponentProvider() {
componentTypeInfo = new ComponentTypeInfo(
bundle.getString("display_name"),
bundle.getString("description"),
- LimitLineComponent.class,
- new LimitLineCreateWizardUI(),
- new ImageIcon(LimitLineComponent.class.getResource("/icons/limit.png")));
+ LimitLineComponent.class);
}
@Override
@@ -68,5 +66,15 @@ public LimitLineComponentProvider() {
public Collection<PolicyInfo> getPolicyInfos() {
return Collections.emptyList();
}
-
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(CreateWizardUI.class)) {
+ if (typeInfo.getTypeClass().equals(LimitLineComponent.class)) {
+ return assetClass.cast(new LimitLineCreateWizardUI());
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
+
}
View
27 mctCoreTaxonomyProvider/src/main/java/gov/nasa/arc/mct/core/provider/CoreComponentProvider.java
@@ -52,6 +52,7 @@
import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
import gov.nasa.arc.mct.services.component.ComponentTypeInfo;
import gov.nasa.arc.mct.services.component.ProviderDelegate;
+import gov.nasa.arc.mct.services.component.TypeInfo;
import gov.nasa.arc.mct.services.component.ViewInfo;
import gov.nasa.arc.mct.services.component.ViewType;
import gov.nasa.arc.mct.services.internal.component.ComponentInitializer;
@@ -68,17 +69,18 @@
public class CoreComponentProvider extends AbstractComponentProvider implements DefaultComponentProvider {
private static final ResourceBundle resource = ResourceBundle.getBundle("CoreTaxonomyResourceBundle"); // NO18N
-
+
+ private ImageIcon GROUPS_ICON = new ImageIcon(getClass().getResource("/icons/mct_icon_groups.png"));
+ private ImageIcon DROPBOX_ICON = new ImageIcon(getClass().getResource("/icons/mct_icon_dropbox.png"));
+
@Override
public Collection<ComponentTypeInfo> getComponentTypes() {
List<ComponentTypeInfo> compInfos = new ArrayList<ComponentTypeInfo>();
ComponentTypeInfo typeInfo = new ComponentTypeInfo(resource.getString("discipline_component_display_name"), resource
- .getString("discipline_component_description"), TelemetryDisciplineComponent.class, false,
- new ImageIcon(getClass().getResource("/icons/mct_icon_groups.png")));
+ .getString("discipline_component_description"), TelemetryDisciplineComponent.class, false);
compInfos.add(typeInfo);
typeInfo = new ComponentTypeInfo(resource.getString("user_dropbox_component_display_name"), resource
- .getString("user_dropbox_component_description"), TelemetryUserDropBoxComponent.class, false,
- new ImageIcon(getClass().getResource("/icons/mct_icon_dropbox.png")));
+ .getString("user_dropbox_component_description"), TelemetryUserDropBoxComponent.class, false);
compInfos.add(typeInfo);
typeInfo = new ComponentTypeInfo(resource.getString("mine_component_display_name"), resource
.getString("mine_component_description"), MineTaxonomyComponent.class, false);
@@ -195,5 +197,18 @@ public void createDefaultComponents() {
public ProviderDelegate getProviderDelegate() {
return new CoreComponentProviderDelegate();
}
-
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (typeInfo.getTypeClass().equals(TelemetryDisciplineComponent.class)) {
+ return assetClass.cast(GROUPS_ICON);
+ }
+ if (typeInfo.getTypeClass().equals(TelemetryUserDropBoxComponent.class)) {
+ return assetClass.cast(DROPBOX_ICON);
+ }
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
+
}
View
2  mctcore/src/main/java/gov/nasa/arc/mct/registry/ExternalComponentRegistryImpl.java
@@ -326,7 +326,7 @@ public SearchProvider getSearchProvider() {
@Override
public <T> T getAsset(TypeInfo<?> objectType, Class<T> assetType) {
- return null;
+ return provider.getAsset(objectType, assetType);
}
}
View
10 nonTimePlots/src/main/java/gov/nasa/arc/mct/nontimeplot/NonTimePlotComponentProvider.java
@@ -32,8 +32,6 @@
import java.util.Collection;
import java.util.Collections;
-import javax.swing.ImageIcon;
-
public class NonTimePlotComponentProvider extends AbstractComponentProvider {
private Collection<PolicyInfo> policies =
@@ -41,15 +39,11 @@
private Collection<ViewInfo> views =
Arrays.asList(new ViewInfo(NonTimePlotView.class, "Non Time",
"gov.nasa.arc.mct.nontimeplot.NonTimePlotView",
- ViewType.OBJECT,
- new ImageIcon(getClass().getResource("/images/nonTimeViewButton-OFF.png")),
- new ImageIcon(getClass().getResource("/images/nonTimeViewButton-ON.png"))),
+ ViewType.OBJECT),
new ViewInfo(NonTimePlotView.class, "Non Time",
"gov.nasa.arc.mct.nontimeplot.NonTimePlotView",
- ViewType.EMBEDDED,
- new ImageIcon(getClass().getResource("/images/nonTimeViewButton-OFF.png")),
- new ImageIcon(getClass().getResource("/images/nonTimeViewButton-ON.png"))));
+ ViewType.EMBEDDED));
@Override
public Collection<PolicyInfo> getPolicyInfos() {
View
14 platform/src/main/java/gov/nasa/arc/mct/defaults/view/DefaultViewProvider.java
@@ -48,7 +48,9 @@
public class DefaultViewProvider extends AbstractComponentProvider {
private final List<ViewInfo> myViewInfos;
-
+
+ private ImageIcon ICON = new ImageIcon(getClass().getResource("/icons/mct_icon_menu_info.png"));
+
public DefaultViewProvider() {
ResourceBundle bundle = ResourceBundle.getBundle("DefaultView");
@@ -60,8 +62,7 @@ public DefaultViewProvider() {
viewInfos.add(new ViewInfo(LabelViewManifestation.class, bundle.getString("LabelViewRoleName"), ViewType.TITLE));
viewInfos.add(new ViewInfo(InspectionArea.class, InspectionArea.INSPECTION_AREA_VIEW_PROP_KEY, ViewType.RIGHT));
viewInfos.add(new ViewInfo(SwitcherView.class, bundle.getString("SwitcherViewName"), ViewType.VIEW_SWITCHER));
- viewInfos.add(new ViewInfo(InfoView.class, bundle.getString("InfoViewName"), ViewType.OBJECT,
- new ImageIcon(getClass().getResource("/icons/mct_icon_menu_info.png"))));
+ viewInfos.add(new ViewInfo(InfoView.class, bundle.getString("InfoViewName"), ViewType.OBJECT));
myViewInfos = viewInfos;
}
@@ -74,6 +75,9 @@ public DefaultViewProvider() {
@Override
public <T> T getAsset(TypeInfo<?> type, Class<T> assetClass) {
if (assetClass.isAssignableFrom(ImageIcon.class)) {
+ if (InfoView.class.isAssignableFrom(type.getTypeClass())) {
+ return assetClass.cast(ICON);
+ }
int sz = 16;
if (View.class.isAssignableFrom(type.getTypeClass())) {
sz = 9;
@@ -85,5 +89,7 @@ public DefaultViewProvider() {
sz, Color.WHITE));
}
return super.getAsset(type, assetClass);
- }
+ }
+
+
}
View
45 tableViews/src/main/java/gov/nasa/arc/mct/table/TableViewProvider.java
@@ -22,18 +22,19 @@
package gov.nasa.arc.mct.table;
-import gov.nasa.arc.mct.policy.PolicyInfo;
-import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
-import gov.nasa.arc.mct.services.component.ViewInfo;
-import gov.nasa.arc.mct.services.component.ViewType;
-import gov.nasa.arc.mct.table.policy.TableViewPolicy;
-import gov.nasa.arc.mct.table.view.TableViewManifestation;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-import javax.swing.ImageIcon;
+import gov.nasa.arc.mct.policy.PolicyInfo;
+import gov.nasa.arc.mct.services.component.AbstractComponentProvider;
+import gov.nasa.arc.mct.services.component.TypeInfo;
+import gov.nasa.arc.mct.services.component.ViewInfo;
+import gov.nasa.arc.mct.services.component.ViewType;
+import gov.nasa.arc.mct.table.policy.TableViewPolicy;
+import gov.nasa.arc.mct.table.view.TableViewManifestation;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.swing.ImageIcon;
/**
* Factory for TableViewRole.
@@ -42,7 +43,8 @@
final Collection<PolicyInfo> policyInfos;
private final Collection<ViewInfo> viewInfos;
-
+ private static final ImageIcon ICON =
+ new ImageIcon(TableViewProvider.class.getResource("/icons/mct_icon_menu_alpha.png"));
/**
* Creates a new view provider service object. Initializes the set
* of objects that will be provided to the core.
@@ -50,10 +52,8 @@
public TableViewProvider() {
policyInfos = Collections.singleton(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), TableViewPolicy.class));
viewInfos = Arrays.asList(
- new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.OBJECT,
- new ImageIcon(getClass().getResource("/icons/mct_icon_menu_alpha.png"))),
- new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.EMBEDDED,
- new ImageIcon(getClass().getResource("/icons/mct_icon_menu_alpha.png"))));
+ new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.OBJECT),
+ new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.EMBEDDED));
}
@Override
@@ -65,5 +65,14 @@ public TableViewProvider() {
public Collection<PolicyInfo> getPolicyInfos() {
return policyInfos;
}
-
+
+
+ @Override
+ public <T> T getAsset(TypeInfo<?> typeInfo, Class<T> assetClass) {
+ if (assetClass.isAssignableFrom(ImageIcon.class) &&
+ typeInfo.getTypeClass().equals(TableViewManifestation.class)) {
+ return assetClass.cast(ICON);
+ }
+ return super.getAsset(typeInfo, assetClass);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.