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

com.pekinsoft.spi.ToolbarProvider Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2022 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    :   AppFramework
 *  Class      :   ToolbarProvider.java
 *  Author     :   Sean Carrick
 *  Created    :   Dec 13, 2022
 *  Modified   :   Dec 13, 2022
 *  
 *  Purpose: See class JavaDoc for explanation
 *  
 *  Revision History:
 *  
 *  WHEN          BY                   REASON
 *  ------------  -------------------  -----------------------------------------
 *  Dec 13, 2022  Sean Carrick         Initial creation.
 * *****************************************************************************
 */

package com.pekinsoft.spi;

import javax.swing.JToolBar;

/**
 * The {@code ToolbarProvider} interface allows for an {@code Application} developer to provide a 
 * complete {@link javax.swing.JToolBar toolbar} for their application.
 * 
 * How this works is that the {@code org.jdesktop.application.Application Application}
 * instance uses {@link org.openide.util.Lookup Lookup} to find the first
 * implementation of this interface. If the {@code Lookup} returns null, then no
 * {@code ToolbarProvider} was found, so no toolbar is added to the application.
 * 
 * In that instance, the {@code Application} will seek out {@link 
 * com.pekinsoft.spi.ButtonProvider ButtonProvider} implementations and build a
 * toolbar using those.
 * 
 * One {@code ToolbarProvider} or the other {@code ButtonProvider}s must be used
 * to have a toolbar within the application. If neither is used, then the 
 * application's main window will have no toolbar.
 *
 * @author Sean Carrick <sean at pekinsoft dot com>
 * 
 * @version 1.3
 * @since 1.0
 */
public interface ToolbarProvider extends Comparable {
    
    /**
     * Retrieves the {@link javax.swing.JToolBar toolbar} to be used for the
     * {@code org.jdesktop.application.Application Application}.
     * 
     * @return the application's toolbar
     */
    public JToolBar getToolBar();

    /**
     * Retrieves this toolbar's desired position within the application's main
     * toolbar.
     * 
     * @return the desired position
     */
    public int getPosition();

    @Override
    public default int compareTo(ToolbarProvider o) {
        return Integer.compare(getPosition(), o.getPosition());
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy