@@ -0,0 +1,2448 @@
+/*******************************************************************************%0A * Mission Control Technologies, Copyright (c) 2009-2012, United States Government%0A * as represented by the Administrator of the National Aeronautics and Space %0A * Administration. All rights reserved.%0A *%0A * The MCT platform is licensed under the Apache License, Version 2.0 (the %0A * %22License%22); you may not use this file except in compliance with the License. %0A * You may obtain a copy of the License at %0A * http://www.apache.org/licenses/LICENSE-2.0.%0A *%0A * Unless required by applicable law or agreed to in writing, software %0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT %0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the %0A * License for the specific language governing permissions and limitations under %0A * the License.%0A *%0A * MCT includes source code licensed under additional open source licenses. See %0A * the MCT Open Source Licenses file included with this distribution or the About %0A * MCT Licenses dialog available at runtime from the MCT Help menu for additional %0A * information. %0A *******************************************************************************/%0Apackage gov.nasa.arc.mct.scenario.component;%0A%0Aimport gov.nasa.arc.mct.components.AbstractComponent;%0Aimport gov.nasa.arc.mct.platform.spi.PersistenceProvider;%0Aimport gov.nasa.arc.mct.platform.spi.PlatformAccess;%0Aimport gov.nasa.arc.mct.services.component.ComponentRegistry;%0Aimport gov.nasa.arc.mct.services.component.CreateWizardUI;%0A%0Aimport java.util.Collections;%0A%0Aimport javax.swing.JButton;%0Aimport javax.swing.JComponent;%0A%0Apublic class RepositoryWizardDecorator extends CreateWizardUI %7B%0A%09private CreateWizardUI wizard;%0A%09private String repositoryID;%0A%09%0A%09public AbstractComponent createComp(ComponentRegistry comp,%0A%09%09%09AbstractComponent parentComp) %7B%0A%09%09AbstractComponent created = wizard.createComp(comp, parentComp);%0A%09%09%0A%09%09// Also persist the created component to the designated repository%0A%09%09PersistenceProvider persistence = PlatformAccess.getPlatform().getPersistenceProvider();%0A%09%09AbstractComponent repository = persistence.getComponent(repositoryID);%0A%09%09repository.addDelegateComponent(created);%0A%09%09repository.save();%0A%09%09persistence.persist(Collections.singleton(repository));%0A%09%09%0A%09%09return created;%0A%09%7D%0A%0A%09public JComponent getUI(JButton create) %7B%0A%09%09return wizard.getUI(create);%0A%09%7D%0A%0A%09public String toString() %7B%0A%09%09return wizard.toString();%0A%09%7D%0A%7D%0A

Add decorator for repository save