Package de.timefinder.core.ui.command

Source Code of de.timefinder.core.ui.command.OpenAllViews

/*
*  Copyright 2009 Peter Karich.
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*  under the License.
*/
package de.timefinder.core.ui.command;

import org.springframework.richclient.application.ApplicationServicesLocator;
import org.springframework.richclient.application.ApplicationWindow;
import org.springframework.richclient.application.ViewDescriptor;
import org.springframework.richclient.application.ViewDescriptorRegistry;
import org.springframework.richclient.command.support.ApplicationWindowAwareCommand;

/**
* Opens all available views.
*
* @see org.springframework.richclient.command.support.ShowViewMenu
* @author Peter Karich
*/
public class OpenAllViews extends ApplicationWindowAwareCommand {

    public static final String ID = "openAllViewsCommand";

    public OpenAllViews() {
        super(ID);
    }

    public OpenAllViews(ApplicationWindow window) {
        setApplicationWindow(window);
    }

    @Override
    protected void doExecuteCommand() {
        ViewDescriptorRegistry viewDescriptorRegistry = (ViewDescriptorRegistry)
                ApplicationServicesLocator.services().getService(ViewDescriptorRegistry.class);

        ViewDescriptor[] views = viewDescriptorRegistry.getViewDescriptors();
        for (int i = 0; i < views.length; i++) {
            ViewDescriptor view = views[i];
            view.createShowViewCommand(getApplicationWindow()).execute();
        }
    }
}
TOP

Related Classes of de.timefinder.core.ui.command.OpenAllViews

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.