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

org.valkyriercp.widget.Widget Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package org.valkyriercp.widget;

import org.valkyriercp.application.PageComponentContext;
import org.valkyriercp.command.support.AbstractCommand;

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

/**
 * Widget specifies the interface for Swing component factories
 *
 * General usage of implementations:
 * 
    *
  1. Instantiate the widget
  2. *
  3. Set specific parameters for the widget or use overloaded constructors * to combine this step and the previous one
  4. *
  5. Get the component using {@link #getComponent()}
  6. *
*/ public interface Widget { static Widget EMPTY_WIDGET = new AbstractWidget(){ public JComponent getComponent() { return new JPanel(); } @Override public String getId() { return "emptyWidget"; } }; static WidgetProvider EMPTY_WIDGET_PROVIDER = new WidgetProvider(){ @Override public Widget getWidget() { return EMPTY_WIDGET; } }; /** * @return A not null graphical component built using the * parameters held in the widget instance. */ public JComponent getComponent(); /** * Hook method called before showing the component on screen. */ public void onAboutToShow(); /** * Hook method called before moving the component to the background (=hiding) */ public void onAboutToHide(); /** * Encompasses the status of the widget between onAboutToShow() and onAboutToHide(). * A component does not know when it's active, even if there is an isShowing() method * in it's API (due to tab panels or scroll panes). * * @return true if the widget is shown in the foreground. */ public boolean isShowing(); /** * Checks whether this component can be closed visually, for example when there * are no unsaved changes. * * @return true if the widget can be closed without problems. */ public boolean canClose(); /** * Returns a list of commands for this widget. */ public List getCommands(); public String getId(); public void registerLocalCommandExecutors(PageComponentContext context); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy