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

com.alee.laf.WebUI Maven / Gradle / Ivy

There is a newer version: 1.2.14
Show newest version
/*
 * This file is part of WebLookAndFeel library.
 *
 * WebLookAndFeel library 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.
 *
 * WebLookAndFeel library 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 WebLookAndFeel library.  If not, see .
 */

package com.alee.laf;

import com.alee.api.annotations.NotNull;

import javax.swing.*;

/**
 * Custom interface that should be implemented by all basic WebLaF UI implementations.
 * This interface must only be implemented by classes that extend {@link javax.swing.plaf.ComponentUI}.
 * Basic implementations are made to replace basic Swing UI implementations to avoid some nasty workarounds and provide better visuals.
 *
 * @param  component type
 * @author Mikle Garin
 */
@SuppressWarnings ( { "unused", "JavadocReference" } )
public interface WebUI
{
    /**
     * Returns component property prefix.
     * This prefix is used by various properties provided within look and feel for the component this UI represents.
     * UI might use this property to unify retrieval of some basic properties (like font) for the component.
     *
     * @return component property prefix
     * @see WebLookAndFeel#initComponentDefaults(UIDefaults)
     */
    @NotNull
    public String getPropertyPrefix ();

    /**
     * Configures the specified component appropriate for the look and feel.
     * This method is invoked when the {@code ComponentUI} instance is being installed as the UI delegate on the specified component.
     * This method should completely configure the component for the look and feel, including the following:
     * 
    *
  1. Install any default property values for color, fonts, borders, * icons, opacity, etc. on the component. Whenever possible, * property values initialized by the client program should not * be overridden. *
  2. Install a {@code LayoutManager} on the component if necessary. *
  3. Create/add any required sub-components to the component. *
  4. Create/install event listeners on the component. *
  5. Create/install a {@code PropertyChangeListener} on the component in order * to detect and respond to component property changes appropriately. *
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component. *
  7. Initialize any appropriate instance data. *
* * @param component the component where this UI delegate is being installed * @see javax.swing.plaf.ComponentUI#installUI(JComponent) * @see #uninstallUI * @see javax.swing.JComponent#setUI * @see javax.swing.JComponent#updateUI */ public void installUI ( @NotNull JComponent component ); /** * Reverses configuration which was done on the specified component during {@code installUI}. * This method is invoked when this {@code UIComponent} instance is being removed as the UI delegate for the specified component. * This method should undo the configuration performed in {@code installUI}, being careful to leave the {@code JComponent} instance * in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). * This should include the following: *
    *
  1. Remove any UI-set borders from the component. *
  2. Remove any UI-set layout managers on the component. *
  3. Remove any UI-added sub-components from the component. *
  4. Remove any UI-added event/property listeners from the component. *
  5. Remove any UI-installed keyboard UI from the component. *
  6. Nullify any allocated instance data objects to allow for GC. *
* * @param component the component from which this UI delegate is being removed; * this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components * @see javax.swing.plaf.ComponentUI#uninstallUI(JComponent) * @see #installUI * @see javax.swing.JComponent#updateUI */ public void uninstallUI ( @NotNull JComponent component ); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy