You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/02/19 18:04:22 UTC
[41/51] [abbrv] libraries/ compiling
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialog.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialog.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialog.java
deleted file mode 100644
index d1a931e..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialog.java
+++ /dev/null
@@ -1,968 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task;
-
-import java.awt.Component;
-import java.awt.Dialog.ModalityType;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.KeyboardFocusManager;
-import java.awt.Window;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.swing.Icon;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.design.TaskDialogContent;
-import org.oxbow.swingbits.util.Strings;
-import org.oxbow.swingbits.util.swing.EmptyIcon;
-import org.oxbow.swingbits.util.swing.SwingBean;
-
-
-public class TaskDialog extends SwingBean {
-
- private static final String INSTANCE_PROPERTY = "task.dialog.instance";
- private static final String DEBUG_PROPERTY = "task.dialog.debug";
-
- public static final String DESIGN_PROPERTY = "task.dialog.design";
-
- static final String I18N_PREFIX = "@@";
- private static final String LOCALE_BUNDLE_NAME = "task-dialog";
-
- private static IContentDesign design = prepareDesign(); //ContentDesignFactory.getDesignByOperatingSystem();
-
- static {
- getDesign().updateUIDefaults();
- }
-
- private static IContentDesign prepareDesign() {
- String property = System.getProperty(DESIGN_PROPERTY);
- if (property != null) {
- try {
- return (IContentDesign) Class.forName(property).newInstance();
- } catch (Throwable ex) {
- throw new TaskDialogException( "Could not instantiate content design: " + property , ex);
- }
- }
- return ContentDesignFactory.getDesignByOperatingSystem();
- }
-
-
- static final IContentDesign getDesign() {
- return design;
- }
-
- /**
- * Makes resource bundle key based on the provided text
- * @param text
- * @return
- */
- public static final String makeKey( String text ) {
- return I18N_PREFIX + text;
- }
-
- /**
- * Returns task dialog instance associated with source component
- * @param source
- * @return task dialog instance associated with source component or null if none
- */
- public final static TaskDialog getInstance( Component source ) {
-
- Window w = SwingUtilities.getWindowAncestor(source);
- if ( w instanceof JDialog ) {
- JComponent c = (JComponent) ((JDialog)w).getContentPane();
- return (TaskDialog) c.getClientProperty(INSTANCE_PROPERTY);
- }
-
- return null;
-
- }
-
- /**
- * Sets debug mode for task dialog framework.
- * @param debug
- */
- public final static void setDebugMode( boolean debug ) {
-
- if ( debug ) {
- System.setProperty(DEBUG_PROPERTY, "true");
- } else {
- System.clearProperty(DEBUG_PROPERTY);
- }
-
- }
-
- /**
- * True if debug mode is set. In debug mode component bounds and grid cells are outlined.
- * This helps with debugging overall appearance of task dialog UI.
- * @return true if debug mode is set
- */
- public final static boolean isDebugMode() {
- return System.getProperty(DEBUG_PROPERTY) != null;
- }
-
-
- /**
- * Set of standard dialog icons. Look and Feel dependent
- */
- public static enum StandardIcon implements Icon {
-
- INFO ( IContentDesign.ICON_INFO ), // "OptionPane.informationIcon"
- QUESTION( IContentDesign.ICON_QUESTION ), // "OptionPane.questionIcon"
- WARNING ( IContentDesign.ICON_WARNING ), // "OptionPane.warningIcon"
- ERROR ( IContentDesign.ICON_ERROR ); // "OptionPane.errorIcon"
-
- private final String key;
-
- private StandardIcon( String key ) {
- this.key = key;
- }
-
- @Override
- public int getIconHeight() {
- return getIcon().getIconHeight();
- }
-
- @Override
- public int getIconWidth() {
- return getIcon().getIconWidth();
- }
-
- @Override
- public void paintIcon(Component c, Graphics g, int x, int y) {
- getIcon().paintIcon(c, g, x, y);
- }
-
-
- /**
- * Always returns an valid instance of icon.
- * @return
- */
- private synchronized javax.swing.Icon getIcon() {
- Icon icon = UIManager.getIcon(key); // No caching to facilitate LAF switching.
- return icon == null? getEmptyIcon(): icon;
- }
-
- private Icon emptyIcon;
-
- private synchronized Icon getEmptyIcon() {
- if (emptyIcon == null) emptyIcon = EmptyIcon.hidden();
- return emptyIcon;
- }
-
- }
-
-
- private static final KeyStroke KS_ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0);
- private static final KeyStroke KS_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0);
- private static final KeyStroke KS_F1 = KeyStroke.getKeyStroke(KeyEvent.VK_F1,0);
-
- /**
- * Standard Command Tags, correspond directly to button tags in MigLayout
- *
- */
- public static enum CommandTag {
-
- OK("ok", KS_ENTER, true, true ), // OK button
- CANCEL("cancel", KS_ESCAPE, true ), // Cancel button
- HELP("help", KS_F1, false ), // Help button that is normally on the right
- HELP2("help2", "Help", KS_F1, false), // Help button that on some platforms are placed on the left
- YES("yes", KS_ENTER, true, true), // Yes button
- NO("yes", KS_ESCAPE, true), // No button
- APPLY("apply"), // Apply button
- NEXT("next", true, false), // Next or Forward Button
- BACK("back"), // Previous or Back Button
- FINISH("finish", KS_ENTER, true, true), // Finish button
- LEFT("left"), // Button that should normally always be placed on the far left
- RIGHT("right"); // Button that should normally always be placed on the far right
-
-
- private String tag;
- private final String defaultTitle;
- private boolean useValidationResult = false;
- private boolean closing;
- private KeyStroke defaultKeyStroke;
-
- CommandTag( String tag, String defaultTitle, KeyStroke defaultKeyStroke, boolean useValidationResult, boolean closing ) {
- this.tag = "tag " + tag;
- this.defaultTitle = makeKey(Strings.isEmpty(defaultTitle)? Strings.capitalize(tag) :defaultTitle);
- this.useValidationResult = useValidationResult;
- this.closing = closing;
- this.defaultKeyStroke = defaultKeyStroke;
- }
-
- CommandTag( String tag, String defaultTitle, KeyStroke defaultKeyStroke, boolean closing ) {
- this( tag, defaultTitle, defaultKeyStroke, false, closing );
- }
-
- CommandTag( String tag, KeyStroke defaultKeyStroke, boolean closing ) {
- this( tag, null, defaultKeyStroke, false, closing );
- }
-
- CommandTag( String tag, boolean closing ) {
- this( tag, null, closing );
- }
-
- CommandTag( String tag) {
- this( tag, false );
- }
-
- CommandTag( String tag, KeyStroke defaultKeyStroke, boolean useValidationResult, boolean closing ) {
- this( tag, null, defaultKeyStroke, useValidationResult, closing );
- }
-
- CommandTag( String tag, boolean useValidationResult, boolean closing ) {
- this( tag, null, useValidationResult, closing );
- }
-
- public String getDefaultTitle() {
- return defaultTitle;
- }
- @Override
- public String toString() {
- return tag;
- }
-
- public boolean isEnabled( boolean validationResult ) {
- return useValidationResult? validationResult: true;
- }
-
- public boolean isClosing() {
- return closing;
- }
-
- public KeyStroke getDefaultKeyStroke() {
- return defaultKeyStroke;
- }
-
- }
-
- public interface ValidationListener {
-
- void validationFinished( boolean validationResult ); // possibly need a collection of errors/warnings
-
- }
-
- /**
- * Interface to define task dialog commands
- *
- */
- public interface Command {
-
- public String getTitle();
- public CommandTag getTag();
- public String getDescription();
- public boolean isClosing();
- public int getWaitInterval(); // in seconds
- public boolean isEnabled( boolean validationResult );
- public KeyStroke getKeyStroke();
- }
-
-
- /**
- * Set of standard task dialog commands
- */
- public static enum StandardCommand implements Command {
-
- OK ( CommandTag.OK ),
- CANCEL( CommandTag.CANCEL );
-
- private final CommandTag tag;
-
- StandardCommand( CommandTag tag ) {
- this.tag = tag;
- }
-
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public CommandTag getTag() {
- return tag;
- }
-
- @Override
- public String getTitle() {
- return tag.getDefaultTitle();
- }
-
-
- @Override
- public boolean isClosing() {
- return tag.isClosing();
- }
-
- @Override
- public int getWaitInterval() {
- return 0;
- }
-
- public boolean isEnabled( boolean validationResult ) {
- return tag.isEnabled(validationResult);
- }
-
- @Override
- public KeyStroke getKeyStroke() {
- return tag.getDefaultKeyStroke();
- }
-
- /**
- * Creates a copy of the command with specified title
- * @param title new title. Used as key for i18n if starts with I18N_PREFIX
- * @param waitInterval in seconds
- * @return copy of the command
- */
- public Command derive( final String title, final int waitInterval ) {
-
- return new CustomCommand( StandardCommand.this ) {
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- public int getWaitInterval() {
- return waitInterval;
- }
-
- };
-
- }
-
- /**
- * Creates a copy of the command with specified title
- * @param title new title. Used as key for i18n if starts with #I18N_PREFIX
- * @return copy of the command
- */
- public Command derive( final String title ) {
-
- return new CustomCommand( StandardCommand.this ) {
-
- @Override
- public String getTitle() {
- return title;
- }
-
- };
-
- }
-
- }
-
-
- public static abstract class CustomCommand implements Command {
-
- private final StandardCommand command;
-
- public CustomCommand( StandardCommand command ) {
- if ( command == null ) throw new IllegalArgumentException("Command should not be null");
- this.command = command;
- }
-
- @Override
- public String getDescription() {
- return command.getDescription();
- }
-
- @Override
- public CommandTag getTag() {
- return command.getTag();
- }
-
- @Override
- public String getTitle() {
- return command.getTitle();
- }
-
- @Override
- public boolean isClosing() {
- return command.isClosing();
- }
-
- @Override
- public int getWaitInterval() {
- return command.getWaitInterval();
- }
-
- public boolean isEnabled( boolean validationResult ) {
- return command.isEnabled(validationResult);
- }
-
- @Override
- public boolean equals(Object obj) {
- return command.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return command.hashCode();
- }
-
- @Override
- public KeyStroke getKeyStroke() {
- return command.getKeyStroke();
- }
-
-
- }
-
- /**
- * Task Dialog Details
- *
- */
- public interface Details {
-
- /**
- * Return text for collapsed label
- * @return
- */
- String getCollapsedLabel();
-
- /**
- * Sets text for collapsed label
- * @param label
- */
- void setCollapsedLabel( String label );
-
- /**
- * Returns text for expanded label
- * @return
- */
- String getExpandedLabel();
-
- /**
- * Sets text for expanded label
- * @param label
- */
- void setExpandedLabel( String label );
-
- /**
- * Checks if details are in expansion state
- * @return
- */
- boolean isExpanded();
-
- /**
- * Sets expansion state
- * @param expanded
- */
- void setExpanded( boolean expanded );
-
- /**
- * Sets the state always expanded and hide the expand checkbox.
- * @param always
- */
- void setAlwaysExpanded( boolean always );
-
- /**
- * Checks if the details are always expanded.
- * @return
- */
- boolean isAlwaysExpanded();
-
- /**
- * Returns component which becomes visible when details are expanded
- * @return
- */
- JComponent getExpandableComponent();
-
- /**
- * Sets component which becomes visible when details are expanded
- * @param cmpt
- */
- void setExpandableComponent( JComponent cmpt );
-
- }
-
-
- /**
- * Task Dialog Footer
- *
- */
- public interface Footer {
-
-
- /**
- * True if footer's check box is selected (checked)
- * @return
- */
- boolean isCheckBoxSelected();
-
- /**
- * Sets footer's check box selection status
- * @param selected
- */
- void setCheckBoxSelected( boolean selected );
-
-
- /**
- * Returns footer's check box text
- * @return
- */
- String getCheckBoxText();
-
-
- /**
- * Sets footer's check box text. Check box is only visible if it has a text
- * @param text
- */
- void setCheckBoxText( String text );
-
- /**
- * Returns footer's text icon
- * @return
- */
- Icon getIcon();
-
-
- /**
- * Sets footer's text icon. Icon is only visible if corresponding text is not empty
- * @param icon
- */
- void setIcon( Icon icon );
-
-
- /**
- * Returns footer's text
- * @return
- */
- String getText();
-
-
- /**
- * Sets footer's text. The text and corresponding icon are visible if text is not empty
- * @param text
- */
- void setText(String text);
-
-
- }
-
-
- /*----------------------------------------------------------------------------------------------*/
-
-
- private final Property<String> instruction = new Property<String>( "instruction" ) {
- @Override public String get() { return content.getInstruction(); }
- @Override protected void setValue(String instruction) { content.setInstruction(instruction); }
- };
-
- private final Property<String> text = new Property<String>( "text" ) {
- @Override public String get() { return content.getMainText(); }
- @Override protected void setValue(String text) { content.setMainText(text); }
- };
-
- private final Property<Boolean> visible = new Property<Boolean>( "visible" ) {
- @Override public Boolean get() { return dlg.isVisible(); }
- @Override protected void setValue(Boolean visible) {
-
- if ( visible ) {
- // set commands first because they may depend on "visible" property change
- content.setCommands(commands, getDesign().isCommandButtonSizeLocked());
- }
-
- if ( visible ) {
- dlg.pack();
-
- // location is set relative to currently active window or dialog owner if no active window found
- // this way task dialog stays on the same monitor as it's owner
- Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- if ( window == null || !window.isDisplayable() ) {
- window = dlg.getOwner();
- }
- dlg.setLocationRelativeTo( window );
- dlg.setVisible(true);
- } else {
- dlg.dispose(); // releases native resources
- }
-
-
- }
- };
-
- private final Property<Icon> icon = new Property<Icon>( "icon" ) {
- @Override public Icon get() { return content.getMainIcon(); }
- @Override protected void setValue(Icon icon) { content.setMainIcon( icon ); }
- };
-
- private final Property<Command> result = new Property<Command>( "result", true ) {
- private Command value = StandardCommand.CANCEL;
- @Override public Command get() { return value; }
- @Override protected void setValue(Command command ) { value = command; }
- };
-
-
-
- private Locale resourceBundleLocale = null; // has to be null
- private ResourceBundle resourceBundle = null;
-
-
- private final JDialog dlg;
- private final TaskDialogContent content;
-
- private Set<Command> commands = new LinkedHashSet<Command>( Arrays.asList(StandardCommand.OK));
- private final List<ValidationListener> validationListeners = new ArrayList<ValidationListener>();
-
- /**
- * Creates a task dialog.<br/>
- * Automatically pick up currently active window as a parent window
- * @param title
- */
- public TaskDialog( final Window parent, final String title ) {
-
- Window pWnd = parent;
-
- if ( pWnd == null ) {
- // find active visible top level window
- pWnd = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- while (pWnd != null && !pWnd.isVisible() && pWnd.getParent() != null) {
- pWnd = (Window) pWnd.getParent();
- }
- }
-
- dlg = new JDialog( pWnd );
- if ( pWnd != null ) { // make sure parent's icon is used
- dlg.setIconImages(pWnd.getIconImages());
- }
-
- dlg.setMinimumSize( new Dimension(300,150)); //TODO: make constants - should be based on LAF
- setResizable(false);
- setModalityType(JDialog.DEFAULT_MODALITY_TYPE); //TODO explore different modality types
-
- dlg.addWindowListener( new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
- result.set(StandardCommand.CANCEL);
- }
- });
-
- setTitle(title);
- content = design.buildContent();
- dlg.setContentPane( content );
-
- // store task dialog instance
- JComponent c = (JComponent) dlg.getContentPane();
- c.putClientProperty(INSTANCE_PROPERTY, this);
-
- }
-
-
-// /**
-// * This constructor is deprecated and may be removed in the next version.
-// * Use the constructor with parent and title parameters
-// * @param title
-// */
-// @Deprecated()
-// public TaskDialog( String title ) {
-// this( null, title );
-// }
-
- public ModalityType getModalityType() {
- return dlg.getModalityType();
- }
-
- public void setModalityType( ModalityType modalityType ) {
- dlg.setModalityType(modalityType);
- }
-
- public boolean isResizable() {
- return dlg.isResizable();
- }
-
- public void setResizable( boolean resizable ) {
- dlg.setResizable(resizable);
- }
-
- public final void addValidationListener( ValidationListener listener ) {
- if ( listener != null ) {
- validationListeners.add(listener);
- }
- }
-
- public final void removeValidationListener( ValidationListener listener ) {
- if ( listener != null ) {
- validationListeners.remove(listener);
- }
- }
-
- /**
- * Notifies all listeners that validation is finished with given result
- * Listeners are notified in the reverse sequence, meaning that first listener is notified last
- * @param validationResult
- */
- public final void fireValidationFinished( boolean validationResult ) {
-
- // Iterate in reverse sequence so 'newer' listeners get message first
- ListIterator<ValidationListener> iter = validationListeners.listIterator(validationListeners.size());
- while (iter.hasPrevious()) {
- iter.previous().validationFinished(validationResult);
- }
- }
-
-
- /**
- * Gets the Locale object that is associated with this window, if the locale has been set.
- * If no locale has been set, then the default locale is returned.
- * @return the locale that is set for this dialog
- */
- public Locale getLocale() {
- return dlg.getLocale();
- }
-
- /**
- * Sets locale which will be used as dialog's locale
- * @param newLocale null is allowed and will be interpreted as default locale
- */
- public void setLocale( final Locale locale ) {
- dlg.setLocale(locale);
- }
-
- private synchronized final ResourceBundle getLocaleBundle() {
-
- Locale currentLocale = getLocale();
- if ( !currentLocale.equals(resourceBundleLocale)) {
- resourceBundleLocale = currentLocale;
- resourceBundle = ResourceBundle.getBundle(
- LOCALE_BUNDLE_NAME,
- resourceBundleLocale,
- getClass().getClassLoader() );
- }
- return resourceBundle;
-
- }
-
-
- /**
- * Returns a string localized using currently set locale
- * @param key
- * @return
- */
- public String getLocalizedString( String key ) {
- try {
- return getLocaleBundle().getString(key);
- } catch ( MissingResourceException ex ) {
- return String.format("<%s>", key);
- }
- }
-
- /**
- * Tries to use text as a key to get localized text. If not found the text itself is returned
- * @param text
- * @return
- */
- public String getString( String text ) {
- return text.startsWith(I18N_PREFIX)? getLocalizedString(text.substring(I18N_PREFIX.length())) : text;
- }
-
-
- public Object getClientProperty( Object key ) {
- return dlg.getRootPane().getClientProperty(key);
- }
-
- public void putClientProperty( Object key, Object value ) {
- dlg.getRootPane().putClientProperty(key, value);
- }
-
- /**
- * Shows or hides this {@code Dialog} depending on the value of parameter
- * @param visible if true dialog is shown
- */
- public void setVisible( boolean visible ) {
- this.visible.set(visible);
- }
-
- /**
- * Determines whether this component should be visible when its
- * parent is visible.
- * @return true if visible
- */
- public boolean isVisible() {
- return this.visible.get();
- }
-
- public Command getResult() {
- return result.get();
- }
-
- public void setResult( Command result ) {
- this.result.set(result);
- }
-
-
- /**
- * Shows the dialog
- * @return dialog result
- */
- public Command show() {
- setVisible(true);
- return getResult();
- }
-
- @Override
- public String toString() {
- return getTitle();
- }
-
-
- /**
- * Returns the title of the dialog
- * @return
- */
- public String getTitle() {
- return dlg.getTitle();
- }
-
- /**
- * Sets the title of the dialog
- * @param title
- */
- public void setTitle( String title ) {
- dlg.setTitle( getString(title));
- }
-
- /**
- * Sets icon for the dialog
- * @param icon
- */
- public void setIcon( Icon icon) {
- this.icon.set(icon);
- }
-
- /**
- * Returns dialog's icon
- * @return
- */
- public Icon getIcon() {
- return this.icon.get();
- }
-
- /**
- * Sets dialog's instruction
- * @param instruction
- */
- public void setInstruction( String instruction ) {
- this.instruction.set(instruction);
- }
-
- /**
- * Returns dialog instruction
- * @return
- */
- public String getInstruction() {
- return this.instruction.get();
- }
-
- /**
- * Sets dialog text
- * @param text
- */
- public void setText( String text ) {
- this.text.set(text);
- }
-
- /**
- * Returns Dialog text
- * @return
- */
- public String getText() {
- return this.text.get();
- }
-
- /**
- * Sets Dialog component
- * @param c
- */
- public void setFixedComponent( JComponent c ) {
- content.setComponent(c);
- }
-
- /**
- * Returns dialog's component
- * @return
- */
- public JComponent getFixedComponent() {
- return content.getComponent();
- }
-
-
- public TaskDialog.Details getDetails() {
- return content;
- }
-
- public TaskDialog.Footer getFooter() {
- return content;
- }
-
-
- public void setCommands(Collection<TaskDialog.Command> commands) {
- this.commands = new LinkedHashSet<Command>(commands);
- }
-
- public void setCommands( TaskDialog.Command... commands) {
- setCommands( Arrays.asList(commands));
- }
-
-
- public Collection<TaskDialog.Command> getCommands() {
- return commands;
- }
-
- public boolean isCommandsVisible() {
- return content.isCommandsVisible();
- }
-
- public void setCommandsVisible( boolean visible ) {
- content.setCommandsVisible(visible);
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java
deleted file mode 100644
index c97c45b..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task;
-
-public class TaskDialogException extends RuntimeException {
-
- private static final long serialVersionUID = -5131344050183401993L;
-
- public TaskDialogException() {
- }
-
- public TaskDialogException(String message) {
- super(message);
- }
-
- public TaskDialogException(Throwable cause) {
- super(cause);
- }
-
- public TaskDialogException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java
deleted file mode 100644
index 0ad19b1..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Window;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.ButtonGroup;
-import javax.swing.ButtonModel;
-import javax.swing.Icon;
-import javax.swing.JFormattedTextField;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.UIManager;
-import javax.swing.event.AncestorEvent;
-
-import net.miginfocom.swing.MigLayout;
-
-import org.oxbow.swingbits.dialog.task.TaskDialog.StandardCommand;
-import org.oxbow.swingbits.dialog.task.design.CommandLinkButton;
-import org.oxbow.swingbits.dialog.task.design.CommandLinkButtonGroup;
-import org.oxbow.swingbits.list.CheckList;
-import org.oxbow.swingbits.util.Strings;
-import org.oxbow.swingbits.util.swing.AncestorAdapter;
-
-/**
- *
- * A set of methods to simplify creation of task dialogs
- *
- * @author Eugene Ryzhikov
- *
- */
-public final class TaskDialogs {
-
- private TaskDialogs() {}
-
- public static final class TaskDialogBuilder {
-
- private Window parent = null;
- private String title = null;
- private Icon icon = null;
- private String instruction = null;
- private String text = null;
- private Integer inputColumns = null;
-
- private TaskDialogBuilder() {}
-
- /**
- * Sets dialog parent
- * @param title
- * @return
- */
- public TaskDialogBuilder parent( Window parent ) {
- this.parent = parent;
- return TaskDialogBuilder.this;
- }
-
-
- /**
- * Sets dialog title
- * @param title
- * @return
- */
- public TaskDialogBuilder title( String title ) {
- this.title = title;
- return TaskDialogBuilder.this;
- }
-
- /**
- * Sets dialog icon
- * @param icon
- * @return
- */
- public TaskDialogBuilder icon( Icon icon ) {
- this.icon = icon;
- return TaskDialogBuilder.this;
- }
-
- /**
- * Sets instruction test
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @return
- */
- public TaskDialogBuilder instruction( String instruction ) {
- this.instruction = instruction;
- return TaskDialogBuilder.this;
- }
-
- /**
- * Sets dialog text
- * @param text
- * @return
- */
- public TaskDialogBuilder text( String text ) {
- this.text = text;
- return TaskDialogBuilder.this;
- }
-
- /**
- * Sets number of columns in the text field for input dialog
- * @param columns
- * @return
- */
- public TaskDialogBuilder inputColumns( int columns ) {
- this.inputColumns = columns;
- return TaskDialogBuilder.this;
- }
-
- private String getTitle( String defaultTitle ) {
- return title == null? defaultTitle: title;
- }
-
- private Icon getIcon( Icon defaultIcon ) {
- return icon == null? defaultIcon: icon;
- }
-
-
- /**
- * Shows simple message using previously set title, icon and instruction
- */
- public void message() {
- messageDialog(
- parent,
- title,
- icon,
- instruction,
- text).setVisible(true);
- }
-
-
- /**
- * Shows simple information message
- */
- public void inform() {
- messageDialog(
- parent,
- getTitle( TaskDialog.makeKey("Information")),
- getIcon( TaskDialog.StandardIcon.INFO ),
- instruction,
- text).setVisible(true);
- }
-
-
- /**
- * Shows simple error message
- */
- public void error() {
- messageDialog(
- parent,
- getTitle( TaskDialog.makeKey("Error")),
- getIcon( TaskDialog.StandardIcon.ERROR ),
- instruction,
- text).setVisible(true);
- }
-
- /**
- * Shows simple question
- * @return
- */
- public boolean ask() {
- return questionDialog(
- parent,
- getTitle( TaskDialog.makeKey("Question")),
- getIcon( TaskDialog.StandardIcon.QUESTION ),
- instruction,
- text).show().equals(StandardCommand.OK);
- }
-
- /**
- * Shows simple warning message
- * @deprecated use isConfirmed instead
- * @return
- */
- @Deprecated
- public boolean warn() {
- return questionDialog(
- parent,
- getTitle( TaskDialog.makeKey("Warning")),
- getIcon( TaskDialog.StandardIcon.WARNING ),
- instruction,
- text).show().equals(StandardCommand.OK);
- }
-
-
- /**
- * Shows simple warning message
- * @return true if accepted
- */
- public boolean isConfirmed() {
- return questionDialog(
- parent,
- getTitle( TaskDialog.makeKey("Warning")),
- getIcon( TaskDialog.StandardIcon.WARNING ),
- instruction,
- text).show().equals(StandardCommand.OK);
- }
-
-
- /**
- * Show exception dialog
- * @param ex
- */
- public void showException( Throwable ex ) {
-
- TaskDialog dlg = new TaskDialog( parent, getTitle(TaskDialog.makeKey("Exception")));
-
- String msg = ex.getMessage();
- String className = ex.getClass().getName();
- boolean noMessage = Strings.isEmpty(msg);
-
- dlg.setInstruction( noMessage? className: msg );
- dlg.setText( noMessage? "": className );
-
- dlg.setIcon( getIcon( TaskDialog.StandardIcon.ERROR ));
- dlg.setCommands( StandardCommand.CANCEL.derive(TaskDialog.makeKey("Close")));
-
- JTextArea text = new JTextArea();
- text.setEditable(false);
- text.setFont( UIManager.getFont("Label.font"));
- text.setText(Strings.stackStraceAsString(ex));
- text.setCaretPosition(0);
-
- JScrollPane scroller = new JScrollPane( text );
- scroller.setPreferredSize(new Dimension(400,200));
- dlg.getDetails().setExpandableComponent( scroller);
- dlg.getDetails().setExpanded(noMessage);
-
- dlg.setResizable(true);
-
- // Issue 22: Exception can be printed by user if required
- // ex.printStackTrace();
- dlg.setVisible(true);
-
- }
-
- /**
- * Simplifies the presentation of choice based on radio buttons
- * @param defaultChoice initial choice selection
- * @param choices collection of available choices
- * @return selection index or -1 if nothing is selected
- */
- public int radioChoice( int defaultChoice, List<String> choices ) {
-
- TaskDialog dlg = questionDialog( parent, getTitle( TaskDialog.makeKey("Choice")), null, instruction, text);
-
- ButtonGroup bGroup = new ButtonGroup();
- List<ButtonModel> models = new ArrayList<ButtonModel>();
-
- JRadioButton btn;
- JPanel p = new JPanel( new MigLayout(""));
- for( String c: choices ) {
- btn = new JRadioButton(c);
- btn.setOpaque(false);
- models.add( btn.getModel());
- bGroup.add(btn);
- p.add( btn, "dock north");
- }
-
- if ( defaultChoice >= 0 && defaultChoice < choices.size()) {
- bGroup.setSelected(models.get(defaultChoice), true);
- }
- p.setOpaque(false);
-
- dlg.setIcon( getIcon( TaskDialog.StandardIcon.QUESTION));
- dlg.setFixedComponent(p);
-
- TextWithWaitInterval twi = new TextWithWaitInterval(instruction);
- dlg.setCommands( StandardCommand.OK.derive(TaskDialog.makeKey("Select"), twi.getWaitInterval()),
- StandardCommand.CANCEL );
-
- return dlg.show().equals(StandardCommand.OK)? models.indexOf( bGroup.getSelection()) : -1;
-
- }
-
- /**
- * Simplifies the presentation of choice based on radio buttons
- * @param defaultChoice initial choice selection
- * @param choices array of available choices
- * @return selection index or -1 if nothing is selected
- */
- public int radioChoice( int defaultChoice, String... choices ) {
- return radioChoice( defaultChoice, Arrays.asList(choices));
- }
-
- /**
- * Simplifies the presentation of choice based on check boxes
- * Check boxes are wrapped into a scrollable check list if there are more than 7 of them
- * @param choices All available choices presented
- * @param defaultSelection choices checked by default
- * @return collection of checked choices
- */
- public <T> Collection<T> checkChoice( List<T> choices, Collection<T> defaultSelection ) {
-
- TaskDialog dlg = questionDialog( parent, getTitle( TaskDialog.makeKey("Choice")), null, instruction, text);
-
- JList list = new JList();
- CheckList<T> checkList = new CheckList.Builder(list).build();
- checkList.setData(choices);
- checkList.setCheckedItems(defaultSelection);
-
- dlg.setIcon( getIcon(TaskDialog.StandardIcon.QUESTION));
- if ( choices.size() > 7 ) {
- dlg.setFixedComponent( new JScrollPane(list));
- } else {
- // blend list color with dialog
- Color listColor = UIManager.getColor(IContentDesign.COLOR_MESSAGE_BACKGROUND);
- list.setBackground(listColor);
- list.setSelectionBackground(listColor);
- list.setSelectionForeground( list.getForeground());
- dlg.setFixedComponent(list);
- }
-
- TextWithWaitInterval twi = new TextWithWaitInterval(instruction);
- dlg.setCommands( StandardCommand.OK.derive(TaskDialog.makeKey("Select"), twi.getWaitInterval()),
- StandardCommand.CANCEL );
-
- return dlg.show().equals(StandardCommand.OK)? checkList.getCheckedItems() : null;
-
- }
-
- /**
- * Simplifies the presentation of choice based on command links
- * @param defaultChoice initial choice selection
- * @param choices collection of available command links
- * @return selection index or -1 if nothing is selected
- */
- public int choice( final int defaultChoice, List<CommandLink> choices ) {
-
- // NOTE: Task dialog has to be created first to initialize resources
- // Should resource initialization be done somewhere else (like design itself)?
- TaskDialog dlg = questionDialog(
- parent,
- getTitle(TaskDialog.makeKey("Choice")), // localized title
- getIcon(null), // null by default, according to MS ux guidlines
- instruction,
- text);
-
- dlg.setCommands( StandardCommand.CANCEL );
- final CommandLinkButtonGroup bGroup = new CommandLinkButtonGroup();
-
- final List<ButtonModel> models = new ArrayList<ButtonModel>();
- final List<CommandLinkButton> buttons = new ArrayList<CommandLinkButton>();
-
- CommandLinkButton btn;
- JPanel p = new JPanel( new MigLayout(""));
- p.setOpaque(false);
- for( CommandLink link: choices ) {
- btn = new CommandLinkButton(link, TaskDialog.getDesign().getCommandLinkPainter() );
- models.add( btn.getModel());
- buttons.add( btn );
- bGroup.add(btn);
- p.add( btn, "dock north, gapbottom 8");
- }
-
- if ( defaultChoice >= 0 && defaultChoice < choices.size()) {
- bGroup.setSelected(models.get(defaultChoice), true);
-
- // make sure that selected button is focused
- p.addAncestorListener( new AncestorAdapter() {
-
- @Override
- public void ancestorAdded(AncestorEvent event) {
- buttons.get(defaultChoice).requestFocusInWindow();
- }
-
- });
- }
-
- dlg.setFixedComponent(p);
- return choices.indexOf( dlg.show() );
-
- }
-
- /**
- * Simplifies the presentation of choice based on command links
- * @param defaultChoice initial choice selection
- * @param choices array of available command links
- * @return selection index or -1 if nothing is selected
- */
-
- public int choice( int defaultChoice, CommandLink... choices ) {
- return choice( defaultChoice, Arrays.asList(choices));
- }
-
- /**
- * Shows simple input dialog with one JFormattedTextField.
- * @param <T>
- * @param defaultValue
- * @return edited value or null if dialog was canceled
- */
- @SuppressWarnings("unchecked")
- public <T> T input( T defaultValue ) {
-
- TaskDialog dlg = questionDialog( parent, getTitle( TaskDialog.makeKey("Input")), null, instruction, text);
- dlg.setIcon( getIcon( TaskDialog.StandardIcon.INFO ));
-
- JFormattedTextField tfInput = new JFormattedTextField();
- tfInput.setColumns( inputColumns == null? 25: inputColumns );
- tfInput.setValue( defaultValue );
- dlg.setFixedComponent( tfInput );
-
- dlg.setCommands( StandardCommand.OK, StandardCommand.CANCEL );
-
- return (T) (dlg.show().equals(StandardCommand.OK)? tfInput.getValue(): null);
-
- }
-
- }
-
-
- /**
- * Creates task dialog builder
- * @return
- */
- public static TaskDialogBuilder build() {
- return new TaskDialogBuilder();
- }
-
- /**
- * Creates task dialog builder
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- * @return
- */
- public static TaskDialogBuilder build( Window parent, String instruction, String text) {
-// TaskDialogBuilder builder = new TaskDialogBuilder();
-// builder.parent( parent );
-// builder.instruction(instruction);
-// builder.text(text);
-// return builder;
- return build().parent(parent).instruction(instruction).text(text);
- }
-
- /**
- * Shows simple information message
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- */
- public static void inform( Window parent, String instruction, String text ) {
- build( parent, instruction, text ).inform();
- }
-
- /**
- * Shows simple error message
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- */
- public static void error( Window parent, String instruction, String text ) {
- build( parent, instruction, text ).error();
- }
-
- /**
- * Shows simple question
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- * @return
- */
- public static boolean ask( Window parent, String instruction, String text ) {
- return build( parent, instruction, text ).ask();
- }
-
- /**
- * Shows simple warning message
- * @deprecated use isConfirmed instead
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- * @return
- */
- @Deprecated()
- public static boolean warn( Window parent, String instruction, String text ) {
- return build( parent, instruction, text ).warn();
- }
-
- /**
- * Shows simple warning message
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- * @return true if accepted
- */
- public static boolean isConfirmed( Window parent, String instruction, String text ) {
- return build( parent, instruction, text ).isConfirmed();
- }
-
- /**
- * Shows exception with stack trace as expandable component.
- * @param ex
- */
- public static void showException( Throwable ex ) {
- build().showException(ex);
- }
-
- /**
- * Simplifies the presentation of choice based on radio buttons
- * @param instruction instruction text. Wait interval can be added at the end. i.e. "@@10" will wait for 10 sec
- * @param text
- * @param defaultChoice initial choice selection
- * @param choices collection of available choices
- * @return selection index or -1 if nothing is selected
- */
- public static final int radioChoice( Window parent, String instruction, String text, int defaultChoice, List<String> choices ) {
- return build(parent, instruction, text).radioChoice(defaultChoice, choices);
- }
-
-
-
- /**
- * Simplifies the presentation of choice based on radio buttons
- * @param instruction
- * @param text
- * @param defaultChoice
- * @param choices
- * @return
- */
- public static final int radioChoice( Window parent, String instruction, String text, int defaultChoice, String... choices ) {
- return build( parent, instruction, text).radioChoice(defaultChoice, choices);
- }
-
- /**
- * Produces choice dialog based on command links. Task dialog commands are suppressed.
- * @param instruction
- * @param text
- * @param defaultChoice command link index used as default choice. -1 is none is required
- * @param choices collection of command links
- * @return
- */
- public static final int choice( Window parent, String instruction, String text, int defaultChoice, List<CommandLink> choices ) {
- return build(parent, instruction,text).choice( defaultChoice, choices );
- }
-
- /**
- * Produces choice dialog based on command links. Task dialog commands are suppressed.
- * @param instruction
- * @param text
- * @param defaultChoice command link index used as default choice. -1 is none is required
- * @param choices array of command links
- * @return
- */
- public static final int choice( Window parent, String instruction, String text, int defaultChoice, CommandLink... choices ) {
- return build(parent, instruction,text).choice( defaultChoice, choices );
- }
-
- /**
- * Shows simple input dialog with one JFormattedTextField.
- * @param <T>
- * @param defaultValue
- * @return edited value or null if dialog was canceled
- */
- public static final <T> T input( Window parent, String instruction, String text, T defaultValue ) {
- return build(parent, instruction,text).inputColumns(25).input( defaultValue );
- }
-
-
- /*----------------------------------------------------------------------------------------------------------*/
-
- private static class TextWithWaitInterval {
-
- String text;
- int waitInterval = 0;
-
- public TextWithWaitInterval( String text ) {
-
- this.text = text;
- int prefixPos = text.indexOf(TaskDialog.I18N_PREFIX);
- if ( prefixPos >= 0) {
- try {
- waitInterval = Integer.valueOf( text.substring( prefixPos + TaskDialog.I18N_PREFIX.length()));
- } catch( Throwable ex ) {
- waitInterval = 0;
- }
- this.text = text.substring(0, prefixPos);
- }
-
- }
-
- public String getText() {
- return text;
- }
-
- public int getWaitInterval() {
- return waitInterval;
- }
- }
-
-
- /**
- * Creates Task dialog using provided attributes and one "Close" button
- * @param title
- * @param icon
- * @param instruction
- * @param text
- * @return
- */
- private static TaskDialog messageDialog( Window parent, String title, Icon icon, String instruction, String text ) {
-
- TextWithWaitInterval twi = new TextWithWaitInterval(instruction);
-
- TaskDialog dlg = new TaskDialog(parent, title);
- dlg.setInstruction( twi.getText() );
- dlg.setText( text );
- dlg.setIcon( icon );
- dlg.setCommands( StandardCommand.CANCEL.derive(TaskDialog.makeKey("Close"), twi.getWaitInterval()));
- return dlg;
-
- }
-
- /**
- * Creates Task dialog using provided attributes and "Yes" and "No" buttons
- * @param title
- * @param icon
- * @param instruction
- * @param text
- * @return
- */
- private static TaskDialog questionDialog( Window parent, String title, Icon icon, String instruction, String text ) {
-
- TextWithWaitInterval twi = new TextWithWaitInterval(instruction);
-
- TaskDialog dlg = new TaskDialog(parent, title);
- dlg.setInstruction( twi.getText() );
- dlg.setText( text );
- dlg.setIcon( icon );
- dlg.setCommands(
- StandardCommand.OK.derive(TaskDialog.makeKey("Yes"), twi.getWaitInterval()),
- StandardCommand.CANCEL.derive(TaskDialog.makeKey("No")) );
- return dlg;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java
deleted file mode 100644
index 6a89f08..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Component;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-
-import javax.swing.Icon;
-import javax.swing.JToggleButton;
-import javax.swing.SwingConstants;
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.CommandLink;
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-import org.oxbow.swingbits.dialog.task.TaskDialog;
-import org.oxbow.swingbits.util.Markup;
-
-
-public class CommandLinkButton extends JToggleButton {
-
- private static final long serialVersionUID = 1L;
- private static final Insets buttonInsets = new Insets(7, 7, 7, 15);
-
- private final CommandLink link;
- private final ICommandLinkPainter painter;
-
- public CommandLinkButton( CommandLink link, ICommandLinkPainter painter ) {
- super();
- this.link = link;
- this.painter = painter;
-
- setHorizontalAlignment(SwingConstants.LEFT);
- setHorizontalTextPosition(SwingConstants.RIGHT);
- setVerticalAlignment(SwingConstants.TOP);
- setVerticalTextPosition(SwingConstants.TOP);
- setIconTextGap(7);
-
- Icon icon = link.getIcon();
- setIcon( icon == null? UIManager.getIcon( IContentDesign.ICON_COMMAND_LINK ): icon );
- setText(buildText());
-
- setMargin( buttonInsets );
-
- if ( painter != null ) painter.prepareSource(this);
-
- addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusGained(FocusEvent e) {
- setSelected(true);
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- // NOTE: if we really are de-selected is controlled by the
- // ButtonGroup.
- setSelected(false);
- }
-
- });
-
- addActionListener( new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- TaskDialog dlg = TaskDialog.getInstance((Component) e.getSource());
- if ( dlg != null ) {
- dlg.setResult(CommandLinkButton.this.link);
- //dlg.setResult( TaskDialog.StandardCommand.OK );
- dlg.setVisible(false);
- }
-
- }
-
- });
-
- }
-
- private String buildText() {
-
- String txt =
- "<html><head>" +
- "<style type='text/css'>" +
- "p.tdi { %s%s }" +
- "p.tdt { %s%s }" +
- "</style>" +
- "</head>" +
- "<p class=\"tdi\">%s</p>" +
- "<p class=\"tdt\">%s</p>" +
- "</html>";
-
- String instrColorCss = Markup.toCSS(UIManager.getColor( IContentDesign.COLOR_INSTRUCTION_FOREGROUND ));
-
- return String.format(txt,
- Markup.toCSS(UIManager.getFont( IContentDesign.FONT_INSTRUCTION )),
- instrColorCss,
- Markup.toCSS(UIManager.getFont( IContentDesign.FONT_TEXT )),
- instrColorCss,
- Markup.toHTML( link.getInstruction(), false ),
- Markup.toHTML( link.getText(), false ) );
-
- }
-
- @Override
- protected void paintComponent(Graphics g) {
- if ( painter != null ) painter.paint(g, this);
- super.paintComponent(g);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java
deleted file mode 100644
index 288b1f4..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import javax.swing.ButtonGroup;
-import javax.swing.ButtonModel;
-
-public class CommandLinkButtonGroup extends ButtonGroup {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void setSelected(ButtonModel model, boolean selected) {
- if (model == null) return;
- if (selected) {
- super.setSelected(model, selected);
- } else {
- if (isSelected(model)) {
- clearSelection();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java
deleted file mode 100644
index b0eaa2d..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Color;
-import java.awt.GradientPaint;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-
-import javax.swing.AbstractButton;
-import javax.swing.JComponent;
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-
-public class DefaultCommandLinkPainter implements ICommandLinkPainter {
-
- protected enum LinkState {
- SELECTED,
- ARMED,
- ROLLOVER
- }
-
- private Color messageBackground = normalize(
- UIManager.getColor( IContentDesign.COLOR_MESSAGE_BACKGROUND ));
- private Color instructionForeground = normalize(
- UIManager.getColor( IContentDesign.COLOR_INSTRUCTION_FOREGROUND ));
-
-
- private LinkChrome selectedChrome = new LinkChrome(
- Color.LIGHT_GRAY.brighter(),
- Color.GRAY.brighter(),
- Color.LIGHT_GRAY,
- 5, 5 );
-
- private LinkChrome armedChrome = new LinkChrome(
- messageBackground,
- instructionForeground,
- instructionForeground,
- 3, 5 );
-
- private LinkChrome rolloverChrome = new LinkChrome(
- messageBackground,
- instructionForeground,
- instructionForeground,
- 6, 5 );
-
- protected LinkChrome getLinkChrome( LinkState linkState ) {
- switch( linkState ) {
- case SELECTED: return selectedChrome;
- case ARMED : return armedChrome;
- case ROLLOVER: return rolloverChrome;
- default : return selectedChrome;
- }
- }
-
- @Override
- public void prepareSource(JComponent source) {
-
- if ( source instanceof AbstractButton ) {
-
- AbstractButton button = (AbstractButton)source;
-
- button.setOpaque(false);
- button.setBorderPainted(false);
- button.setContentAreaFilled(false);
- button.setFocusPainted(false);
-
- }
- }
-
-
- @Override
- public void paint(Graphics g, JComponent source) {
-
- if ( !(source instanceof AbstractButton) ) return;
-
- Graphics2D g2 = (Graphics2D) g.create();
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
-
- AbstractButton button = (AbstractButton)source;
-
- if ( button.isSelected() ) {
- getLinkChrome(LinkState.SELECTED).draw(button, g2);
- }
- if ( button.getModel().isArmed() ) {
- getLinkChrome(LinkState.ARMED).draw(button, g2);
- } else if ( button.getModel().isRollover()) {
- getLinkChrome(LinkState.ROLLOVER).draw(button, g2);
- }
-
- g2.dispose();
- }
-
- protected Color normalize( Color color ) {
- return color == null ? Color.BLACK: color;
- }
-
- protected static class LinkChrome {
-
- private Color startColor;
- private Color endColor;
- private Color borderColor;
- int gradientHeightFactor;
- int arcSize;
-
- public LinkChrome( Color startColor, Color endColor, Color borderColor, int gradientHeightFactor, int arcSize ) {
- this.startColor = startColor;
- this.endColor = endColor;
- this.borderColor = borderColor;
- this.gradientHeightFactor = gradientHeightFactor;
- this.arcSize = arcSize;
- }
-
- public void draw( AbstractButton button, Graphics2D g ) {
-
- GradientPaint paint = new GradientPaint(
- 0, 0, startColor,
- 0, button.getHeight()*gradientHeightFactor, endColor );
-
- g.setPaint( paint );
- g.fillRoundRect(0,0, button.getWidth()-1, button.getHeight()-1, arcSize, arcSize);
- g.setColor( borderColor );
- g.drawRoundRect(0,0, button.getWidth()-1, button.getHeight()-1, arcSize, arcSize);
-
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java
deleted file mode 100644
index fac641c..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.SystemColor;
-
-import javax.swing.ImageIcon;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-
-import net.miginfocom.swing.MigLayout;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-import org.oxbow.swingbits.dialog.task.TaskDialog;
-
-public class DefaultContentDesign implements IContentDesign {
-
- protected ICommandLinkPainter commandButtonPainter;
-
- @Override
- public void updateUIDefaults() {
-
- UIManager.put( ICON_MORE_DETAILS, createResourceIcon( "moreDetails.png" ));
- UIManager.put( ICON_FEWER_DETAILS, createResourceIcon( "fewerDetails.png" ));
-
- UIManager.put( ICON_COMMAND_LINK, createResourceIcon( "arrowGreenRight.png"));
-
- UIManager.put( COLOR_MESSAGE_BACKGROUND, SystemColor.window );
- UIManager.put( COLOR_INSTRUCTION_FOREGROUND, SystemColor.textHighlight.darker() );
-
- UIManager.put( FONT_INSTRUCTION, deriveFont( "Label.font", null, 1.4f ) );
- UIManager.put( FONT_TEXT, deriveFont( "Label.font", null, 1f ) );
-
- UIManager.put( TEXT_MORE_DETAILS, TaskDialog.makeKey("MoreDetails") );
- UIManager.put( TEXT_FEWER_DETAILS, TaskDialog.makeKey("FewerDetails") );
-
- }
-
-
- public TaskDialogContent buildContent() {
-
- TaskDialogContent content = new TaskDialogContent();
- content.setMinimumSize( new Dimension(200, 70));
-
- content.lbInstruction.setFont( UIManager.getFont(IContentDesign.FONT_INSTRUCTION ));
- content.lbInstruction.setForeground( UIManager.getColor( IContentDesign.COLOR_INSTRUCTION_FOREGROUND ));
-
- content.lbText.setFont( UIManager.getFont(IContentDesign.FONT_TEXT ));
- content.pComponent.setOpaque(false);
-
- content.removeAll();
- content.setLayout( createMigLayout("hidemode 3, fill"));
-
- // message pane
- JPanel pMessage = new JPanel(
- createMigLayout( "ins dialog, gapx 7, hidemode 3", "[][grow]", "[][]10[grow][]"));
- pMessage.setBackground( UIManager.getColor( IContentDesign.COLOR_MESSAGE_BACKGROUND ) );
- pMessage.add( content.lbIcon, "cell 0 0 0 2, aligny top");
- pMessage.add( content.lbInstruction, "cell 1 0, growx, aligny top");
- pMessage.add( content.lbText, "cell 1 1, growx, aligny top");
- pMessage.add( content.pExpandable, "cell 1 2, grow");
- pMessage.add( content.pComponent, "cell 1 3, grow");
-
- content.setBackground( pMessage.getBackground());
- content.add( pMessage, "dock center");
-
- // footer
- content.pFooter.setLayout( createMigLayout("ins dialog"));
- content.pFooter.add( new JSeparator(), "dock north");
- content.pFooter.add( content.lbFooter, "dock center" );
-
- content.add( content.pFooter, "dock south" );
-
- // command pane
- content.pCommandPane.setLayout(
- createMigLayout( "ins dialog, gapy 2, hidemode 3", "[pref!][grow]", "[pref][pref]"));
- content.pCommandPane.add( content.pCommands, "cell 1 0, alignx right" );
- content.pCommandPane.add( content.cbDetails, "cell 0 0");
- content.pCommandPane.add( content.cbFooterCheck, "cell 0 1");
- content.pCommandPane.add( new JSeparator(), "dock north");
-
- content.add( content.pCommandPane, "dock south");
-
- return content;
-
- }
-
- @Override
- public boolean isCommandButtonSizeLocked() {
- return true;
- }
-
- private final static String fixDebug( final String lc ) {
- if ( !TaskDialog.isDebugMode() ) return lc;
- return lc.toLowerCase().indexOf("debug") < 0? "debug," + lc: lc;
- }
-
- protected MigLayout createMigLayout( String layoutConstraints ) {
- return new MigLayout( fixDebug(layoutConstraints));
- }
-
- protected MigLayout createMigLayout( String layoutConstraints, String colConstraints, String rowConstraints ) {
- return new MigLayout( fixDebug(layoutConstraints), colConstraints, rowConstraints );
- }
-
-
- @Override
- public ICommandLinkPainter getCommandLinkPainter() {
- if (commandButtonPainter == null) {
- commandButtonPainter = new DefaultCommandLinkPainter();
- }
- return commandButtonPainter;
- }
-
-
- /**
- * Creates icon from the image file
- * @param name
- * @return
- */
- protected static final Object createResourceIcon( final String name ) {
-
- return new UIDefaults.ActiveValue() {
-
- @Override
- public Object createValue(UIDefaults table) {
- return new ImageIcon( TaskDialog.class.getResource(name));
- }
-
- };
-
- }
-
- /**
- * Derives font from UIDefaults resource
- * @param name resource name
- * @param style font style, if null resource's style is used
- * @param sizeFactor
- * @return
- */
- protected final Object deriveFont( final String name, final Integer style, final float sizeFactor ) {
-
- return new UIDefaults.ActiveValue() {
-
- @Override
- public Object createValue(UIDefaults table) {
- Font font = UIManager.getFont(name);
- float factor = sizeFactor == 0f? 1: sizeFactor;
- if ( style == null && factor == 1f ) return font;
- return font.deriveFont( style == null? font.getStyle(): style, font.getSize2D() * factor );
- }
-
- };
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java
deleted file mode 100644
index 630dc4e..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import javax.swing.JCheckBox;
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-
-class DetailsToggleButton extends JCheckBox {
-
- private static final long serialVersionUID = 1L;
-
- public DetailsToggleButton() {
- super();
- setIcon( UIManager.getIcon( IContentDesign.ICON_MORE_DETAILS ));
- setSelectedIcon( UIManager.getIcon( IContentDesign.ICON_FEWER_DETAILS ));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java
deleted file mode 100644
index a7ad2da..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Font;
-import java.awt.SystemColor;
-
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-
-public class LinuxContentDesign extends DefaultContentDesign {
-
- @Override
- public void updateUIDefaults() {
-
- super.updateUIDefaults();
-
- if ( UIManager.getIcon( ICON_ERROR ) == null ) {
- UIManager.put( ICON_ERROR, createResourceIcon( "linux_error.png" ));
- UIManager.put( ICON_INFO, createResourceIcon( "linux_info.png" ));
- UIManager.put( ICON_QUESTION, createResourceIcon( "linux_question.png" ));
- UIManager.put( ICON_WARNING, createResourceIcon( "linux_warning.png" ));
- }
-
- UIManager.put( COLOR_MESSAGE_BACKGROUND, SystemColor.CONTROL );
- UIManager.put( COLOR_INSTRUCTION_FOREGROUND, SystemColor.textHighlight );
-
-
- UIManager.put( FONT_INSTRUCTION, deriveFont( "Label.font", Font.BOLD, 1.07f ) );
- UIManager.put( FONT_TEXT, deriveFont( "Label.font", Font.PLAIN, .85f ) );
-
-
- }
-
- ICommandLinkPainter commandButtonPainter;
-
- @Override
- public ICommandLinkPainter getCommandLinkPainter() {
- if (commandButtonPainter == null) {
- commandButtonPainter = new MacOsCommandLinkPainter();
- }
- return commandButtonPainter;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java
deleted file mode 100644
index 6e2014a..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Graphics;
-
-import javax.swing.JComponent;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-
-public class MacOsCommandLinkPainter implements ICommandLinkPainter {
-
- @Override
- public void prepareSource(JComponent source) {}
-
- @Override
- public void paint(Graphics g, JComponent source) {}
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java b/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java
deleted file mode 100644
index 3facbc9..0000000
--- a/launchers/lmf-splash/src/main/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2009-2011, EzWare
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.Neither the name of the
- * EzWare nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package org.oxbow.swingbits.dialog.task.design;
-
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.SystemColor;
-
-import javax.swing.BorderFactory;
-import javax.swing.JPanel;
-import javax.swing.UIManager;
-
-import net.miginfocom.swing.MigLayout;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-import org.oxbow.swingbits.dialog.task.TaskDialog;
-
-public class MacOsContentDesign extends DefaultContentDesign {
-
- private ICommandLinkPainter commandButtonPainter;
-
- @Override
- public void updateUIDefaults() {
- super.updateUIDefaults();
-
- UIManager.put( ICON_MORE_DETAILS, createResourceIcon( "moreDetailsMac.png" ));
- UIManager.put( ICON_FEWER_DETAILS, createResourceIcon( "fewerDetailsMac.png" ));
-
- UIManager.put( COLOR_MESSAGE_BACKGROUND, SystemColor.CONTROL );
- UIManager.put( COLOR_INSTRUCTION_FOREGROUND, SystemColor.TEXT_TEXT );
-
- UIManager.put( FONT_INSTRUCTION, deriveFont( "Label.font", Font.BOLD, 1f ) );
- UIManager.put( FONT_TEXT, deriveFont( "Label.font", Font.PLAIN, .85f ) );
-
- UIManager.put( TEXT_MORE_DETAILS, TaskDialog.makeKey("Details") );
- UIManager.put( TEXT_FEWER_DETAILS, TaskDialog.makeKey("Details") );
-
- }
-
- @Override
- public TaskDialogContent buildContent() {
-
- TaskDialogContent content = new TaskDialogContent();
-
- content.setMinimumSize( new Dimension(200, 70));
-
- content.lbInstruction.setFont( UIManager.getFont(IContentDesign.FONT_INSTRUCTION ));
- content.lbInstruction.setForeground( UIManager.getColor( IContentDesign.COLOR_INSTRUCTION_FOREGROUND ));
-
- content.lbText.setFont( UIManager.getFont(IContentDesign.FONT_TEXT ));
-
- content.pComponent.setOpaque(false);
-
- content.removeAll();
- content.setLayout( createMigLayout("ins dialog, hidemode 3, fill", "[]", "[][][]"));
-
- // message pane
- JPanel pMessage = new JPanel( createMigLayout( "ins 0, gapx 7, hidemode 3", "[][grow]", "[][][]"));
- pMessage.setBackground( UIManager.getColor( IContentDesign.COLOR_MESSAGE_BACKGROUND ) );
- pMessage.add( content.lbIcon, "cell 0 0 0 2, aligny top");
- pMessage.add( content.lbInstruction, "cell 1 0, growx, aligny top");
- pMessage.add( content.lbText, "cell 1 1, growx, aligny top");
- pMessage.add( content.pComponent, "cell 1 3, grow");
-
- content.setBackground( pMessage.getBackground());
- content.add( pMessage, "cell 0 0");
-
- // footer
- content.pFooter.setLayout( new MigLayout("ins 0"));
- content.pFooter.add( content.lbFooter, "dock center" );
-
- content.add( content.pFooter, "cell 0 2" );
-
- // command pane
- content.pExpandable.setBorder(
- BorderFactory.createCompoundBorder(
- UIManager.getBorder("InsetBorder.aquaVariant"),
- BorderFactory.createEmptyBorder(7,7,7,7)));
- content.pCommandPane.setLayout(
- createMigLayout("ins 0, hidemode 3", "[pref!][grow]", "[pref!][pref!,grow][pref!][pref!]"));
- content.pCommandPane.add( content.cbDetails, "cell 0 0");
- content.pCommandPane.add( content.pExpandable, "cell 0 1 3 1, grow");
- content.pCommandPane.add( content.pCommands, "cell 2 2, alignx right" );
- content.pCommandPane.add( content.cbFooterCheck, "cell 0 2");
-
- content.add( content.pCommandPane, "cell 0 1, grow");
-
- return content;
-
- }
-
-
- @Override
- public ICommandLinkPainter getCommandLinkPainter() {
- if (commandButtonPainter == null) {
- commandButtonPainter = new MacOsCommandLinkPainter();
- }
- return commandButtonPainter;
- }
-
- @Override
- public boolean isCommandButtonSizeLocked() {
- return false;
- }
-
-
-}