net.java.truelicense.swing.LicenseWizard Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truelicense-swing Show documentation
Show all versions of truelicense-swing Show documentation
The TrueLicense Swing module provides a graphical user interface for
consuming license keys.
/*
* 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);
}
}