All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pekinsoft.framework.GlobalActionSystem Maven / Gradle / Ivy

/*
 * Copyright (C) 2024 PekinSOFT Systems
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 *
 * *****************************************************************************
 *  Project    :   application-framework-api
 *  Class      :   GlobalActionSystem.java
 *  Author     :   Sean Carrick
 *  Created    :   Jul 14, 2024
 *  Modified   :   Jul 14, 2024
 *
 *  Purpose: See class JavaDoc for explanation
 *
 *  Revision History:
 *
 *  WHEN          BY                   REASON
 *  ------------  -------------------  -----------------------------------------
 *  Jul 14, 2024  Sean Carrick         Initial creation.
 * *****************************************************************************
 */
package com.pekinsoft.framework;

import java.util.List;
import javax.swing.*;

/**
 * {@code GlobalActionSystem} is a static utility class that exposes two methods
 * that allow an {@link Application} to automatically generate its
 * {@link javax.swing.JMenuBar JMenuBar} and a {@link java.util.List List} of
 * {@link javax.swing.JToolBar JToolBars} that may be used to provide the user
 * the ability to interact with the {@code Application} through the UI.
 * 

* The {@code GlobalActionSystem} generation computations are based upon the * {@link ActionX} instances contained in the automatically (and lazily) created * {@link ActionMapX} instances. Because of the {@link AppAction} annotation * parameters, this generator is able to place the actions into the appropriate * menus and toolbars. * * @status TESTED: Good to Go * * @author Sean Carrick <sean at pekinsoft dot com> * * @version 2.4 * @since 1.5 */ public class GlobalActionSystem { /** * Automatically generates a {@link java.util.List List} of * {@link javax.swing.JToolBar JToolBars} for an {@link Application}. These * toolbars may be installed easily into a {@link View}. *

* If the specified list of {@link javax.swing.ActionMap ActionMaps} does * not contain any {@link ActionX} instances, then an empty list is * returned. This generator only works with {@code ActionX} instances. * * @param ctx the {@link ApplicationContext} in which we are running * @param actionMaps a list of {@code ActionMap}s containing {@code ActionX} * instances * * @return a list of {@code JToolBar}s, or an empty list */ public static List createToolBars(ApplicationContext ctx, List actionMaps) { return ToolBarGenerator.createToolBars(ctx, actionMaps); } /** * Automatically generates the {@link Application Application's} * {@link javax.swing.JMenuBar menuBar} from the specified list of * {@link javax.swing.ActionMap ActionMaps}. *

* If the list of {@code ActionMap}s do not contain any {@link ActionX} * instances, the returned menu bar will be empty. This generator only works * with {@code ActionX} actions. * * @param ctx the {@link ApplicationContext} in which we are running * @param actionMaps a list of {@code ActionMap}s containing {@code ActionX} * instances * * @return an automatically generated menu bar, or an empty menu bar */ public static JMenuBar createMenuBar(ApplicationContext ctx, List actionMaps) { return MenuGenerator.createMenuSystem(ctx, actionMaps); } private GlobalActionSystem() { // No instantiation necessary. } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy