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

net.java.truelicense.swing.LicenseWizard Maven / Gradle / Ivy

Go to download

The TrueLicense Swing module provides a graphical user interface for consuming license keys.

There is a newer version: 2.6.6
Show newest version
/*
 * Copyright (C) 2005-2013 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truelicense.swing;

import java.awt.*;
import javax.annotation.CheckForNull;
import net.java.truelicense.core.LicenseConsumerManager;
import static net.java.truelicense.swing.Messages.*;
import net.java.truelicense.swing.nexes.Wizard;

/**
 * This is the internationalized license management wizard class.
 * It can be used to install and verify licenses visually for the
 * application's user.
 *
 * @author Christian Schlichtherle
 */
public class LicenseWizard extends Wizard {

    private WelcomePanel.Descriptor welcome;

    public LicenseWizard(LicenseConsumerManager cm) {
        init(cm);
    }

    public LicenseWizard(
            final LicenseConsumerManager cm,
            final @CheckForNull Dialog owner) {
        super(owner);
        init(cm);
    }

    public LicenseWizard(
            final LicenseConsumerManager cm,
            final @CheckForNull Frame owner) {
        super(owner);
        init(cm);
    }

    private void init(final LicenseConsumerManager cm) {
        super.setDialogTitle(message("LicenseWizard.title",
                cm.subject()).toString());
        final ObservableLicenseConsumerManager
                ocm = new ObservableLicenseConsumerManager(cm);
        super.addPanelDescriptor(welcome = new WelcomePanel.Descriptor(ocm));
        super.addPanelDescriptor(new InstallPanel.Descriptor(ocm));
        super.addPanelDescriptor(new LicensePanel.Descriptor(ocm));
        super.addPanelDescriptor(new UninstallPanel.Descriptor(ocm));
        super.setCurrentPanelDescriptor(welcome);
    }

    /**
     * Returns {@code true} if and only if the uninstall button is visible.
     * By default, this button is not visible.
     */
    public boolean isUninstallButtonVisible() {
        return welcome.isUninstallButtonVisible();
    }

    /** Sets the visibility of the uninstall button. */
    public void setUninstallButtonVisible(boolean visible) {
        welcome.setUninstallButtonVisible(visible);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy