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
[26/51] [abbrv] libraries/ compiling
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/MigLayout.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/MigLayout.java b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/MigLayout.java
new file mode 100644
index 0000000..bde68df
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/MigLayout.java
@@ -0,0 +1,701 @@
+package net.miginfocom.swing;
+/*
+ * License (BSD):
+ * ==============
+ *
+ * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
+ * 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 MiG InfoCom AB 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.
+ *
+ * @version 1.0
+ * @author Mikael Grev, MiG InfoCom AB
+ * Date: 2006-sep-08
+ */
+
+import net.miginfocom.layout.*;
+
+import javax.swing.*;
+import javax.swing.Timer;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.*;
+import java.util.*;
+
+/** A very flexible layout manager.
+ * <p>
+ * Read the documentation that came with this layout manager for information on usage.
+ */
+public final class MigLayout implements LayoutManager2, Externalizable
+{
+ // ******** Instance part ********
+
+ /** The component to string constraints mappings.
+ */
+ private final Map<Component, Object> scrConstrMap = new IdentityHashMap<Component, Object>(8);
+
+ /** Hold the serializable text representation of the constraints.
+ */
+ private Object layoutConstraints = "", colConstraints = "", rowConstraints = ""; // Should never be null!
+
+ // ******** Transient part ********
+
+ private transient ContainerWrapper cacheParentW = null;
+
+ private transient final Map<ComponentWrapper, CC> ccMap = new HashMap<ComponentWrapper, CC>(8);
+ private transient javax.swing.Timer debugTimer = null;
+
+ private transient LC lc = null;
+ private transient AC colSpecs = null, rowSpecs = null;
+ private transient Grid grid = null;
+ private transient int lastModCount = PlatformDefaults.getModCount();
+ private transient int lastHash = -1;
+ private transient Dimension lastInvalidSize = null;
+ private transient boolean lastWasInvalid = false; // Added in 3.7.1. May have regressions
+ private transient Dimension lastParentSize = null;
+
+ private transient ArrayList<LayoutCallback> callbackList = null;
+
+ private transient boolean dirty = true;
+
+ /** Constructor with no constraints.
+ */
+ public MigLayout()
+ {
+ this("", "", "");
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as "".
+ */
+ public MigLayout(String layoutConstraints)
+ {
+ this(layoutConstraints, "", "");
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as "".
+ * @param colConstraints The constraints for the columns in the grid. <code>null</code> will be treated as "".
+ */
+ public MigLayout(String layoutConstraints, String colConstraints)
+ {
+ this(layoutConstraints, colConstraints, "");
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as "".
+ * @param colConstraints The constraints for the columns in the grid. <code>null</code> will be treated as "".
+ * @param rowConstraints The constraints for the rows in the grid. <code>null</code> will be treated as "".
+ */
+ public MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)
+ {
+ setLayoutConstraints(layoutConstraints);
+ setColumnConstraints(colConstraints);
+ setRowConstraints(rowConstraints);
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as an empty constraint.
+ */
+ public MigLayout(LC layoutConstraints)
+ {
+ this(layoutConstraints, null, null);
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as an empty constraint.
+ * @param colConstraints The constraints for the columns in the grid. <code>null</code> will be treated as an empty constraint.
+ */
+ public MigLayout(LC layoutConstraints, AC colConstraints)
+ {
+ this(layoutConstraints, colConstraints, null);
+ }
+
+ /** Constructor.
+ * @param layoutConstraints The constraints that concern the whole layout. <code>null</code> will be treated as an empty constraint.
+ * @param colConstraints The constraints for the columns in the grid. <code>null</code> will be treated as an empty constraint.
+ * @param rowConstraints The constraints for the rows in the grid. <code>null</code> will be treated as an empty constraint.
+ */
+ public MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)
+ {
+ setLayoutConstraints(layoutConstraints);
+ setColumnConstraints(colConstraints);
+ setRowConstraints(rowConstraints);
+ }
+
+ /** Returns layout constraints either as a <code>String</code> or {@link net.miginfocom.layout.LC} depending what was sent in
+ * to the constructor or set with {@link #setLayoutConstraints(Object)}.
+ * @return The layout constraints either as a <code>String</code> or {@link net.miginfocom.layout.LC} depending what was sent in
+ * to the constructor or set with {@link #setLayoutConstraints(Object)}. Never <code>null</code>.
+ */
+ public Object getLayoutConstraints()
+ {
+ return layoutConstraints;
+ }
+
+ /** Sets the layout constraints for the layout manager instance as a String.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param constr The layout constraints as a String representation. <code>null</code> is converted to <code>""</code> for storage.
+ * @throws RuntimeException if the constraint was not valid.
+ */
+ public void setLayoutConstraints(Object constr)
+ {
+ if (constr == null || constr instanceof String) {
+ constr = ConstraintParser.prepare((String) constr);
+ lc = ConstraintParser.parseLayoutConstraint((String) constr);
+ } else if (constr instanceof LC) {
+ lc = (LC) constr;
+ } else {
+ throw new IllegalArgumentException("Illegal constraint type: " + constr.getClass().toString());
+ }
+ layoutConstraints = constr;
+ dirty = true;
+ }
+
+ /** Returns the column layout constraints either as a <code>String</code> or {@link net.miginfocom.layout.AC}.
+ * @return The column constraints either as a <code>String</code> or {@link net.miginfocom.layout.LC} depending what was sent in
+ * to the constructor or set with {@link #setLayoutConstraints(Object)}. Never <code>null</code>.
+ */
+ public Object getColumnConstraints()
+ {
+ return colConstraints;
+ }
+
+ /** Sets the column layout constraints for the layout manager instance as a String.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param constr The column layout constraints as a String representation. <code>null</code> is converted to <code>""</code> for storage.
+ * @throws RuntimeException if the constraint was not valid.
+ */
+ public void setColumnConstraints(Object constr)
+ {
+ if (constr == null || constr instanceof String) {
+ constr = ConstraintParser.prepare((String) constr);
+ colSpecs = ConstraintParser.parseColumnConstraints((String) constr);
+ } else if (constr instanceof AC) {
+ colSpecs = (AC) constr;
+ } else {
+ throw new IllegalArgumentException("Illegal constraint type: " + constr.getClass().toString());
+ }
+ colConstraints = constr;
+ dirty = true;
+ }
+
+ /** Returns the row layout constraints as a String representation. This string is the exact string as set with {@link #setRowConstraints(Object)}
+ * or sent into the constructor.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @return The row layout constraints as a String representation. Never <code>null</code>.
+ */
+ public Object getRowConstraints()
+ {
+ return rowConstraints;
+ }
+
+ /** Sets the row layout constraints for the layout manager instance as a String.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param constr The row layout constraints as a String representation. <code>null</code> is converted to <code>""</code> for storage.
+ * @throws RuntimeException if the constraint was not valid.
+ */
+ public void setRowConstraints(Object constr)
+ {
+ if (constr == null || constr instanceof String) {
+ constr = ConstraintParser.prepare((String) constr);
+ rowSpecs = ConstraintParser.parseRowConstraints((String) constr);
+ } else if (constr instanceof AC) {
+ rowSpecs = (AC) constr;
+ } else {
+ throw new IllegalArgumentException("Illegal constraint type: " + constr.getClass().toString());
+ }
+ rowConstraints = constr;
+ dirty = true;
+ }
+
+ /** Returns a shallow copy of the constraints map.
+ * @return A shallow copy of the constraints map. Never <code>null</code>.
+ */
+ public Map<Component, Object> getConstraintMap()
+ {
+ return new IdentityHashMap<Component, Object>(scrConstrMap);
+ }
+
+ /** Sets the constraints map.
+ * @param map The map. Will be copied.
+ */
+ public void setConstraintMap(Map<Component, Object> map)
+ {
+ scrConstrMap.clear();
+ ccMap.clear();
+ for (Map.Entry<Component, Object> e : map.entrySet())
+ setComponentConstraintsImpl(e.getKey(), e.getValue(), true);
+ }
+
+ /** Returns the component constraints as a String representation. This string is the exact string as set with {@link #setComponentConstraints(java.awt.Component, Object)}
+ * or set when adding the component to the parent component.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param comp The component to return the constraints for.
+ * @return The component constraints as a String representation or <code>null</code> if the component is not registered
+ * with this layout manager. The returned values is either a String or a {@link net.miginfocom.layout.CC}
+ * depending on what constraint was sent in when the component was added. May be <code>null</code>.
+ */
+ public Object getComponentConstraints(Component comp)
+ {
+ synchronized(comp.getParent().getTreeLock()) {
+ return scrConstrMap.get(comp);
+ }
+ }
+
+ /** Sets the component constraint for the component that already must be handled by this layout manager.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param constr The component constraints as a String or {@link net.miginfocom.layout.CC}. <code>null</code> is ok.
+ * @param comp The component to set the constraints for.
+ * @throws RuntimeException if the constraint was not valid.
+ * @throws IllegalArgumentException If the component is not handling the component.
+ */
+ public void setComponentConstraints(Component comp, Object constr)
+ {
+ setComponentConstraintsImpl(comp, constr, false);
+ }
+
+ /** Sets the component constraint for the component that already must be handled by this layout manager.
+ * <p>
+ * See the class JavaDocs for information on how this string is formatted.
+ * @param constr The component constraints as a String or {@link net.miginfocom.layout.CC}. <code>null</code> is ok.
+ * @param comp The component to set the constraints for.
+ * @param noCheck Doe not check if the component is handled if true
+ * @throws RuntimeException if the constraint was not valid.
+ * @throws IllegalArgumentException If the component is not handling the component.
+ */
+ private void setComponentConstraintsImpl(Component comp, Object constr, boolean noCheck)
+ {
+ Container parent = comp.getParent();
+ synchronized(parent != null ? parent.getTreeLock() : new Object()) { // 3.7.2. No sync if not added to a hierarchy. Defeats a NPE.
+ if (noCheck == false && scrConstrMap.containsKey(comp) == false)
+ throw new IllegalArgumentException("Component must already be added to parent!");
+
+ ComponentWrapper cw = new SwingComponentWrapper(comp);
+
+ if (constr == null || constr instanceof String) {
+ String cStr = ConstraintParser.prepare((String) constr);
+
+ scrConstrMap.put(comp, constr);
+ ccMap.put(cw, ConstraintParser.parseComponentConstraint(cStr));
+
+ } else if (constr instanceof CC) {
+
+ scrConstrMap.put(comp, constr);
+ ccMap.put(cw, (CC) constr);
+
+ } else {
+ throw new IllegalArgumentException("Constraint must be String or ComponentConstraint: " + constr.getClass().toString());
+ }
+
+ dirty = true;
+ }
+ }
+
+ /** Returns if this layout manager is currently managing this component.
+ * @param c The component to check. If <code>null</code> then <code>false</code> will be returned.
+ * @return If this layout manager is currently managing this component.
+ */
+ public boolean isManagingComponent(Component c)
+ {
+ return scrConstrMap.containsKey(c);
+ }
+
+ /** Adds the callback function that will be called at different stages of the layout cylce.
+ * @param callback The callback. Not <code>null</code>.
+ */
+ public void addLayoutCallback(LayoutCallback callback)
+ {
+ if (callback == null)
+ throw new NullPointerException();
+
+ if (callbackList == null)
+ callbackList = new ArrayList<LayoutCallback>(1);
+
+ callbackList.add(callback);
+ }
+
+ /** Removes the callback if it exists.
+ * @param callback The callback. May be <code>null</code>.
+ */
+ public void removeLayoutCallback(LayoutCallback callback)
+ {
+ if (callbackList != null)
+ callbackList.remove(callback);
+ }
+
+ /** Sets the debugging state for this layout manager instance. If debug is turned on a timer will repaint the last laid out parent
+ * with debug information on top.
+ * <p>
+ * Red fill and dashed red outline is used to indicate occupied cells in the grid. Blue dashed outline indicate
+ * component bounds set.
+ * <p>
+ * Note that debug can also be set on the layout constraints. There it will be persisted. The value set here will not. See the class
+ * JavaDocs for information.
+ * @param parentW The parent to set debug for.
+ * @param b <code>true</code> means debug is turned on.
+ */
+ private void setDebug(final ComponentWrapper parentW, boolean b)
+ {
+ if (b && (debugTimer == null || debugTimer.getDelay() != getDebugMillis())) {
+ if (debugTimer != null)
+ debugTimer.stop();
+
+ ContainerWrapper pCW = parentW.getParent();
+ final Component parent = pCW != null ? (Component) pCW.getComponent() : null;
+
+ debugTimer = new Timer(getDebugMillis(), new MyDebugRepaintListener());
+
+ if (parent != null) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ Container p = parent.getParent();
+ if (p != null) {
+ if (p instanceof JComponent) {
+ ((JComponent) p).revalidate();
+ } else {
+ parent.invalidate();
+ p.validate();
+ }
+ }
+ }
+ });
+ }
+
+ debugTimer.setInitialDelay(100);
+ debugTimer.start();
+
+ } else if (!b && debugTimer != null) {
+ debugTimer.stop();
+ debugTimer = null;
+ }
+ }
+
+ /** Returns the current debugging state.
+ * @return The current debugging state.
+ */
+ private boolean getDebug()
+ {
+ return debugTimer != null;
+ }
+
+ /** Returns the debug millis. Combines the value from {@link net.miginfocom.layout.LC#getDebugMillis()} and {@link net.miginfocom.layout.LayoutUtil#getGlobalDebugMillis()}
+ * @return The combined value.
+ */
+ private int getDebugMillis()
+ {
+ int globalDebugMillis = LayoutUtil.getGlobalDebugMillis();
+ return globalDebugMillis > 0 ? globalDebugMillis : lc.getDebugMillis();
+ }
+
+ /** Check if something has changed and if so recreate it to the cached objects.
+ * @param parent The parent that is the target for this layout manager.
+ */
+ private void checkCache(Container parent)
+ {
+ if (parent == null)
+ return;
+
+ if (dirty)
+ grid = null;
+
+ // Check if the grid is valid
+ int mc = PlatformDefaults.getModCount();
+ if (lastModCount != mc) {
+ grid = null;
+ lastModCount = mc;
+ }
+
+ if (parent.isValid() == false) {
+ if (lastWasInvalid == false) {
+ lastWasInvalid = true;
+
+ int hash = 0;
+ boolean resetLastInvalidOnParent = false; // Added in 3.7.3 to resolve a timing regression introduced in 3.7.1
+ for (ComponentWrapper wrapper : ccMap.keySet()) {
+ Object component = wrapper.getComponent();
+ if (component instanceof JTextArea || component instanceof JEditorPane)
+ resetLastInvalidOnParent = true;
+ hash ^= wrapper.getLayoutHashCode();
+ hash += 285134905;
+ }
+ if (resetLastInvalidOnParent)
+ resetLastInvalidOnParent(parent);
+
+ if (hash != lastHash) {
+ grid = null;
+ lastHash = hash;
+ }
+
+ Dimension ps = parent.getSize();
+ if (lastInvalidSize == null || !lastInvalidSize.equals(ps)) {
+ if (grid != null)
+ grid.invalidateContainerSize();
+ lastInvalidSize = ps;
+ }
+ }
+ } else {
+ lastWasInvalid = false;
+ }
+
+ ContainerWrapper par = checkParent(parent);
+
+ setDebug(par, getDebugMillis() > 0);
+
+ if (grid == null)
+ grid = new Grid(par, lc, rowSpecs, colSpecs, ccMap, callbackList);
+
+ dirty = false;
+ }
+
+ /**
+ * @since 3.7.3
+ */
+ private void resetLastInvalidOnParent(Container parent)
+ {
+ while (parent != null) {
+ LayoutManager layoutManager = parent.getLayout();
+ if (layoutManager instanceof MigLayout) {
+ ((MigLayout) layoutManager).lastWasInvalid = false;
+ }
+ parent = parent.getParent();
+ }
+ }
+
+ private ContainerWrapper checkParent(Container parent)
+ {
+ if (parent == null)
+ return null;
+
+ if (cacheParentW == null || cacheParentW.getComponent() != parent)
+ cacheParentW = new SwingContainerWrapper(parent);
+
+ return cacheParentW;
+ }
+
+ private long lastSize = 0;
+
+ public void layoutContainer(final Container parent)
+ {
+ synchronized(parent.getTreeLock()) {
+ checkCache(parent);
+
+ Insets i = parent.getInsets();
+ int[] b = new int[] {
+ i.left,
+ i.top,
+ parent.getWidth() - i.left - i.right,
+ parent.getHeight() - i.top - i.bottom
+ };
+
+ if (grid.layout(b, lc.getAlignX(), lc.getAlignY(), getDebug(), true)) {
+ grid = null;
+ checkCache(parent);
+ grid.layout(b, lc.getAlignX(), lc.getAlignY(), getDebug(), false);
+ }
+
+ long newSize = grid.getHeight()[1] + (((long) grid.getWidth()[1]) << 32);
+ if (lastSize != newSize) {
+ lastSize = newSize;
+ final ContainerWrapper containerWrapper = checkParent(parent);
+ Window win = ((Window) SwingUtilities.getAncestorOfClass(Window.class, (Component)containerWrapper.getComponent()));
+ if (win != null) {
+ if (win.isVisible()) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ adjustWindowSize(containerWrapper);
+ }
+ });
+ } else {
+ adjustWindowSize(containerWrapper);
+ }
+ }
+ }
+ lastInvalidSize = null;
+ }
+ }
+
+ /** Checks the parent window if its size is within parameters as set by the LC.
+ * @param parent The parent who's window to possibly adjust the size for.
+ */
+ private void adjustWindowSize(ContainerWrapper parent)
+ {
+ BoundSize wBounds = lc.getPackWidth();
+ BoundSize hBounds = lc.getPackHeight();
+
+ if (wBounds == null && hBounds == null)
+ return;
+
+ Window win = ((Window) SwingUtilities.getAncestorOfClass(Window.class, (Component) parent.getComponent()));
+ if (win == null)
+ return;
+
+ Dimension prefSize = win.getPreferredSize();
+ int targW = constrain(checkParent(win), win.getWidth(), prefSize.width, wBounds);
+ int targH = constrain(checkParent(win), win.getHeight(), prefSize.height, hBounds);
+
+ int x = Math.round(win.getX() - ((targW - win.getWidth()) * (1 - lc.getPackWidthAlign())));
+ int y = Math.round(win.getY() - ((targH - win.getHeight()) * (1 - lc.getPackHeightAlign())));
+
+ win.setBounds(x, y, targW, targH);
+ }
+
+ private int constrain(ContainerWrapper parent, int winSize, int prefSize, BoundSize constrain)
+ {
+ if (constrain == null)
+ return winSize;
+
+ int retSize = winSize;
+ UnitValue wUV = constrain.getPreferred();
+ if (wUV != null)
+ retSize = wUV.getPixels(prefSize, parent, parent);
+
+ retSize = constrain.constrain(retSize, prefSize, parent);
+
+ return constrain.getGapPush() ? Math.max(winSize, retSize) : retSize;
+ }
+
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ synchronized(parent.getTreeLock()) {
+ return getSizeImpl(parent, LayoutUtil.MIN);
+ }
+ }
+
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ synchronized(parent.getTreeLock()) {
+ if (lastParentSize == null || !parent.getSize().equals(lastParentSize)) {
+ for (ComponentWrapper wrapper : ccMap.keySet()) {
+ Component c = (Component) wrapper.getComponent();
+ if (c instanceof JTextArea || c instanceof JEditorPane || (c instanceof JComponent && Boolean.TRUE.equals(((JComponent)c).getClientProperty("migLayout.dynamicAspectRatio")))) {
+ layoutContainer(parent);
+ break;
+ }
+ }
+ }
+
+ lastParentSize = parent.getSize();
+ return getSizeImpl(parent, LayoutUtil.PREF);
+ }
+ }
+
+ public Dimension maximumLayoutSize(Container parent)
+ {
+ return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
+ }
+
+ // Implementation method that does the job.
+ private Dimension getSizeImpl(Container parent, int sizeType)
+ {
+ checkCache(parent);
+
+ Insets i = parent.getInsets();
+
+ int w = LayoutUtil.getSizeSafe(grid != null ? grid.getWidth() : null, sizeType) + i.left + i.right;
+ int h = LayoutUtil.getSizeSafe(grid != null ? grid.getHeight() : null, sizeType) + i.top + i.bottom;
+
+ return new Dimension(w, h);
+ }
+
+ public float getLayoutAlignmentX(Container parent)
+ {
+ return lc != null && lc.getAlignX() != null ? lc.getAlignX().getPixels(1, checkParent(parent), null) : 0;
+ }
+
+ public float getLayoutAlignmentY(Container parent)
+ {
+ return lc != null && lc.getAlignY() != null ? lc.getAlignY().getPixels(1, checkParent(parent), null) : 0;
+ }
+
+ public void addLayoutComponent(String s, Component comp)
+ {
+ addLayoutComponent(comp, s);
+ }
+
+ public void addLayoutComponent(Component comp, Object constraints)
+ {
+ synchronized(comp.getParent().getTreeLock()) {
+ setComponentConstraintsImpl(comp, constraints, true);
+ }
+ }
+
+ public void removeLayoutComponent(Component comp)
+ {
+ synchronized(comp.getParent().getTreeLock()) {
+ scrConstrMap.remove(comp);
+ ccMap.remove(new SwingComponentWrapper(comp));
+ }
+ }
+
+ public void invalidateLayout(Container target)
+ {
+// if (lc.isNoCache()) // Commented for 3.5 since there was too often that the "nocache" was needed and the user did not know.
+ dirty = true;
+
+ // the validity of components is maintained automatically.
+ }
+
+ // ************************************************
+ // Persistence Delegate and Serializable combined.
+ // ************************************************
+
+ private Object readResolve() throws ObjectStreamException
+ {
+ return LayoutUtil.getSerializedObject(this);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ if (getClass() == MigLayout.class)
+ LayoutUtil.writeAsXML(out, this);
+ }
+
+ private class MyDebugRepaintListener implements ActionListener
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (grid != null) {
+ Component comp = (Component) grid.getContainer().getComponent();
+ if (comp.isShowing()) {
+ grid.paintDebug();
+ return;
+ }
+ }
+ debugTimer.stop();
+ debugTimer = null;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingComponentWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingComponentWrapper.java b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingComponentWrapper.java
new file mode 100644
index 0000000..f802ee4
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingComponentWrapper.java
@@ -0,0 +1,459 @@
+package net.miginfocom.swing;
+/*
+ * License (BSD):
+ * ==============
+ *
+ * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
+ * 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 MiG InfoCom AB 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.
+ *
+ * @version 1.0
+ * @author Mikael Grev, MiG InfoCom AB
+ * Date: 2006-sep-08
+ */
+import net.miginfocom.layout.ComponentWrapper;
+import net.miginfocom.layout.ContainerWrapper;
+import net.miginfocom.layout.PlatformDefaults;
+
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+import java.awt.geom.Rectangle2D;
+import java.lang.reflect.Method;
+import java.util.IdentityHashMap;
+
+/**
+ */
+public class SwingComponentWrapper implements ComponentWrapper
+{
+ private static boolean maxSet = false;
+
+ private static boolean vp = true;
+
+ /** Debug color for component bounds outline.
+ */
+ private static final Color DB_COMP_OUTLINE = new Color(0, 0, 200);
+
+ private final Component c;
+ private int compType = TYPE_UNSET;
+ private Boolean bl = null;
+ private boolean prefCalled = false;
+
+ public SwingComponentWrapper(Component c)
+ {
+ this.c = c;
+ }
+
+ public final int getBaseline(int width, int height)
+ {
+ if (BL_METHOD == null)
+ return -1;
+
+ try {
+ Object[] args = new Object[] {
+ width < 0 ? c.getWidth() : width,
+ height < 0 ? c.getHeight() : height
+ };
+
+ return (Integer) BL_METHOD.invoke(c, args);
+ } catch (Exception e) {
+ return -1;
+ }
+ }
+
+ public final Object getComponent()
+ {
+ return c;
+ }
+
+ /** Cache.
+ */
+ private final static IdentityHashMap<FontMetrics, Point.Float> FM_MAP = new IdentityHashMap<FontMetrics, Point.Float>(4);
+ private final static Font SUBST_FONT = new Font("sansserif", Font.PLAIN, 11);
+
+ public final float getPixelUnitFactor(boolean isHor)
+ {
+ switch (PlatformDefaults.getLogicalPixelBase()) {
+ case PlatformDefaults.BASE_FONT_SIZE:
+ Font font = c.getFont();
+ FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT);
+ Point.Float p = FM_MAP.get(fm);
+ if (p == null) {
+ Rectangle2D r = fm.getStringBounds("X", c.getGraphics());
+ p = new Point.Float(((float) r.getWidth()) / 6f, ((float) r.getHeight()) / 13.27734375f);
+ FM_MAP.put(fm, p);
+ }
+ return isHor ? p.x : p.y;
+
+ case PlatformDefaults.BASE_SCALE_FACTOR:
+
+ Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
+ if (s != null)
+ return s;
+ return (isHor ? getHorizontalScreenDPI() : getVerticalScreenDPI()) / (float) PlatformDefaults.getDefaultDPI();
+
+ default:
+ return 1f;
+ }
+ }
+
+// /** Cache.
+// */
+// private final static IdentityHashMap<FontMetrics, Point.Float> FM_MAP2 = new IdentityHashMap<FontMetrics, Point.Float>(4);
+// private final static Font SUBST_FONT2 = new Font("sansserif", Font.PLAIN, 11);
+//
+// public float getDialogUnit(boolean isHor)
+// {
+// Font font = c.getFont();
+// FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT2);
+// Point.Float dluP = FM_MAP2.get(fm);
+// if (dluP == null) {
+// float w = fm.charWidth('X') / 4f;
+// int ascent = fm.getAscent();
+// float h = (ascent > 14 ? ascent : ascent + (15 - ascent) / 3) / 8f;
+//
+// dluP = new Point.Float(w, h);
+// FM_MAP2.put(fm, dluP);
+// }
+// return isHor ? dluP.x : dluP.y;
+// }
+
+ public final int getX()
+ {
+ return c.getX();
+ }
+
+ public final int getY()
+ {
+ return c.getY();
+ }
+
+ public final int getHeight()
+ {
+ return c.getHeight();
+ }
+
+ public final int getWidth()
+ {
+ return c.getWidth();
+ }
+
+ public final int getScreenLocationX()
+ {
+ Point p = new Point();
+ SwingUtilities.convertPointToScreen(p, c);
+ return p.x;
+ }
+
+ public final int getScreenLocationY()
+ {
+ Point p = new Point();
+ SwingUtilities.convertPointToScreen(p, c);
+ return p.y;
+ }
+
+ public final int getMinimumHeight(int sz)
+ {
+ if (prefCalled == false) {
+ c.getPreferredSize(); // To defeat a bug where the minimum size is different before and after the first call to getPreferredSize();
+ prefCalled = true;
+ }
+ return c.getMinimumSize().height;
+ }
+
+ public final int getMinimumWidth(int sz)
+ {
+ if (prefCalled == false) {
+ c.getPreferredSize(); // To defeat a bug where the minimum size is different before and after the first call to getPreferredSize();
+ prefCalled = true;
+ }
+ return c.getMinimumSize().width;
+ }
+ public final int getPreferredHeight(int sz)
+ {
+ // If the component has not gotten size yet and there is a size hint, trick Swing to return a better height.
+ if (c.getWidth() == 0 && c.getHeight() == 0 && sz != -1)
+ c.setBounds(c.getX(), c.getY(), sz, 1);
+
+ return c.getPreferredSize().height;
+ }
+
+ public final int getPreferredWidth(int sz)
+ {
+ // If the component has not gotten size yet and there is a size hint, trick Swing to return a better height.
+ if (c.getWidth() == 0 && c.getHeight() == 0 && sz != -1)
+ c.setBounds(c.getX(), c.getY(), 1, sz);
+
+ return c.getPreferredSize().width;
+ }
+
+ public final int getMaximumHeight(int sz)
+ {
+ if (!isMaxSet(c))
+ return Short.MAX_VALUE;
+
+ return c.getMaximumSize().height;
+ }
+
+ public final int getMaximumWidth(int sz)
+ {
+ if (!isMaxSet(c))
+ return Short.MAX_VALUE;
+
+ return c.getMaximumSize().width;
+ }
+
+
+ private boolean isMaxSet(Component c)
+ {
+ if (IMS_METHOD != null) {
+ try {
+ return (Boolean) IMS_METHOD.invoke(c, (Object[]) null);
+ } catch (Exception e) {
+ IMS_METHOD = null; // So we do not try every time.
+ }
+ }
+ return isMaxSizeSetOn1_4();
+ }
+
+ public final ContainerWrapper getParent()
+ {
+ Container p = c.getParent();
+ return p != null ? new SwingContainerWrapper(p) : null;
+ }
+
+ public final int getHorizontalScreenDPI()
+ {
+ return PlatformDefaults.getDefaultDPI();
+ }
+
+ public final int getVerticalScreenDPI()
+ {
+ return PlatformDefaults.getDefaultDPI();
+ }
+
+ public final int getScreenWidth()
+ {
+ try {
+ return c.getToolkit().getScreenSize().width;
+ } catch (HeadlessException ex) {
+ return 1024;
+ }
+ }
+
+ public final int getScreenHeight()
+ {
+ try {
+ return c.getToolkit().getScreenSize().height;
+ } catch (HeadlessException ex) {
+ return 768;
+ }
+ }
+
+ public final boolean hasBaseline()
+ {
+ if (bl == null) {
+ try {
+ if (BL_RES_METHOD == null || BL_RES_METHOD.invoke(c).toString().equals("OTHER")) {
+ bl = Boolean.FALSE;
+ } else {
+ Dimension d = c.getMinimumSize();
+ bl = getBaseline(d.width, d.height) > -1;
+ }
+ } catch (Throwable ex) {
+ bl = Boolean.FALSE;
+ }
+ }
+ return bl;
+ }
+
+ public final String getLinkId()
+ {
+ return c.getName();
+ }
+
+ public final void setBounds(int x, int y, int width, int height)
+ {
+ c.setBounds(x, y, width, height);
+ }
+
+ public boolean isVisible()
+ {
+ return c.isVisible();
+ }
+
+ public final int[] getVisualPadding()
+ {
+ if (vp && c instanceof JTabbedPane) {
+ if (UIManager.getLookAndFeel().getClass().getName().endsWith("WindowsLookAndFeel"))
+ return new int[] {-1, 0, 2, 2};
+ }
+
+ return null;
+ }
+
+ public static boolean isMaxSizeSetOn1_4()
+ {
+ return maxSet;
+ }
+
+ public static void setMaxSizeSetOn1_4(boolean b)
+ {
+ maxSet = b;
+ }
+
+ public static boolean isVisualPaddingEnabled()
+ {
+ return vp;
+ }
+
+ public static void setVisualPaddingEnabled(boolean b)
+ {
+ vp = b;
+ }
+
+ public final void paintDebugOutline()
+ {
+ if (c.isShowing() == false)
+ return;
+
+ Graphics2D g = (Graphics2D) c.getGraphics();
+ if (g == null)
+ return;
+
+ g.setPaint(DB_COMP_OUTLINE);
+ g.setStroke(new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10f, new float[] {2f, 4f}, 0));
+ g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
+ }
+
+ public int getComponetType(boolean disregardScrollPane)
+ {
+ if (compType == TYPE_UNSET)
+ compType = checkType(disregardScrollPane);
+
+ return compType;
+ }
+
+ public int getLayoutHashCode()
+ {
+ Dimension d = c.getMaximumSize();
+ int hash = d.width + (d.height << 5);
+
+ d = c.getPreferredSize();
+ hash += (d.width << 10) + (d.height << 15);
+
+ d = c.getMinimumSize();
+ hash += (d.width << 20) + (d.height << 25);
+
+ if (c.isVisible())
+ hash += 1324511;
+
+ String id = getLinkId();
+ if (id != null)
+ hash += id.hashCode();
+
+ return hash;
+ }
+
+ private int checkType(boolean disregardScrollPane)
+ {
+ Component c = this.c;
+
+ if (disregardScrollPane) {
+ if (c instanceof JScrollPane) {
+ c = ((JScrollPane) c).getViewport().getView();
+ } else if (c instanceof ScrollPane) {
+ c = ((ScrollPane) c).getComponent(0);
+ }
+ }
+
+ if (c instanceof JTextField || c instanceof TextField) {
+ return TYPE_TEXT_FIELD;
+ } else if (c instanceof JLabel || c instanceof Label) {
+ return TYPE_LABEL;
+ } else if (c instanceof JToggleButton || c instanceof Checkbox) {
+ return TYPE_CHECK_BOX;
+ } else if (c instanceof AbstractButton || c instanceof Button) {
+ return TYPE_BUTTON;
+ } else if (c instanceof JComboBox || c instanceof Choice) {
+ return TYPE_LABEL;
+ } else if (c instanceof JTextComponent || c instanceof TextComponent) {
+ return TYPE_TEXT_AREA;
+ } else if (c instanceof JPanel || c instanceof Canvas) {
+ return TYPE_PANEL;
+ } else if (c instanceof JList || c instanceof List) {
+ return TYPE_LIST;
+ } else if (c instanceof JTable) {
+ return TYPE_TABLE;
+ } else if (c instanceof JSeparator) {
+ return TYPE_SEPARATOR;
+ } else if (c instanceof JSpinner) {
+ return TYPE_SPINNER;
+ } else if (c instanceof JProgressBar) {
+ return TYPE_PROGRESS_BAR;
+ } else if (c instanceof JSlider) {
+ return TYPE_SLIDER;
+ } else if (c instanceof JScrollPane) {
+ return TYPE_SCROLL_PANE;
+ } else if (c instanceof JScrollBar || c instanceof Scrollbar) {
+ return TYPE_SCROLL_BAR;
+ } else if (c instanceof Container) { // only AWT components is not containers.
+ return TYPE_CONTAINER;
+ }
+ return TYPE_UNKNOWN;
+ }
+
+ public final int hashCode()
+ {
+ return getComponent().hashCode();
+ }
+
+ public final boolean equals(Object o)
+ {
+ if (o instanceof ComponentWrapper == false)
+ return false;
+
+ return getComponent().equals(((ComponentWrapper) o).getComponent());
+ }
+
+ /** Cached method used for getting base line with reflection.
+ */
+ private static Method BL_METHOD = null;
+ private static Method BL_RES_METHOD = null;
+ static {
+ try {
+ BL_METHOD = Component.class.getDeclaredMethod("getBaseline", new Class[] {int.class, int.class});
+ BL_RES_METHOD = Component.class.getDeclaredMethod("getBaselineResizeBehavior"); // 3.7.2: Removed Class<?> null since that made the method inaccessible.
+ } catch (Throwable e) { // No such method or security exception
+ }
+ }
+
+ private static Method IMS_METHOD = null;
+ static {
+ try {
+ IMS_METHOD = Component.class.getDeclaredMethod("isMaximumSizeSet", (Class[]) null);
+ } catch (Throwable e) { // No such method or security exception
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingContainerWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingContainerWrapper.java b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingContainerWrapper.java
new file mode 100644
index 0000000..2798c2b
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/net/miginfocom/swing/SwingContainerWrapper.java
@@ -0,0 +1,109 @@
+package net.miginfocom.swing;
+/*
+ * License (BSD):
+ * ==============
+ *
+ * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
+ * 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 MiG InfoCom AB 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.
+ *
+ * @version 1.0
+ * @author Mikael Grev, MiG InfoCom AB
+ * Date: 2006-sep-08
+ */
+
+import net.miginfocom.layout.ComponentWrapper;
+import net.miginfocom.layout.ContainerWrapper;
+
+import java.awt.*;
+
+/**
+ */
+public final class SwingContainerWrapper extends SwingComponentWrapper implements ContainerWrapper
+{
+ /** Debug color for cell outline.
+ */
+ private static final Color DB_CELL_OUTLINE = new Color(255, 0, 0);
+
+ public SwingContainerWrapper(Container c)
+ {
+ super(c);
+ }
+
+ public ComponentWrapper[] getComponents()
+ {
+ Container c = (Container) getComponent();
+ ComponentWrapper[] cws = new ComponentWrapper[c.getComponentCount()];
+ for (int i = 0; i < cws.length; i++)
+ cws[i] = new SwingComponentWrapper(c.getComponent(i));
+ return cws;
+ }
+
+ public int getComponentCount()
+ {
+ return ((Container) getComponent()).getComponentCount();
+ }
+
+ public Object getLayout()
+ {
+ return ((Container) getComponent()).getLayout();
+ }
+
+ public final boolean isLeftToRight()
+ {
+ return ((Container) getComponent()).getComponentOrientation().isLeftToRight();
+ }
+
+ public final void paintDebugCell(int x, int y, int width, int height)
+ {
+ Component c = (Component) getComponent();
+ if (c.isShowing() == false)
+ return;
+
+ Graphics2D g = (Graphics2D) c.getGraphics();
+ if (g == null)
+ return;
+
+ g.setStroke(new BasicStroke(1f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10f, new float[] {2f, 3f}, 0));
+ g.setPaint(DB_CELL_OUTLINE);
+ g.drawRect(x, y, width - 1, height - 1);
+ }
+
+ public int getComponetType(boolean disregardScrollPane)
+ {
+ return TYPE_CONTAINER;
+ }
+
+ // Removed for 2.3 because the parent.isValid() in MigLayout will catch this instead.
+ public int getLayoutHashCode()
+ {
+ long n = System.nanoTime();
+ int h = super.getLayoutHashCode();
+
+ if (isLeftToRight())
+ h += 416343;
+
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionBuilderHelper.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
new file mode 100644
index 0000000..0b25076
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
@@ -0,0 +1,241 @@
+/*
+ * 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.action;
+
+import java.awt.Component;
+import java.util.Collection;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+
+
+class ActionBuilderHelper {
+
+ protected <T> T createGroup( MenuAdapter<T> menu, Collection<Action> actions ) {
+ int item = 1; // has to be 1 to compare to size
+ int size = actions.size();
+ for( Action a: actions ) {
+ createAction( menu, a, item++ == size );
+ }
+ return menu.get();
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T createAction( MenuAdapter<T> menu, Action a, boolean isLast ) {
+
+ if ( a instanceof Collection ) {
+
+ if ( isCollapsed(a)) {
+ JMenu m = createGroup( new JMenuAdapter(new JMenu(a)), (Collection<Action>)a );
+ menu.add(m);
+ } else {
+ menu.addSeparator();
+ createGroup( menu, (Collection<Action>)a );
+ if ( !isLast ) menu.addSeparator();
+ }
+
+ } else {
+
+ if ( Actions.isSeparator(a)) {
+ if ( !isLast ) menu.addSeparator();
+ } else {
+
+ if ( isCheckAction(a)) {
+ menu.add(new JCheckBoxMenuItem(prepareCheckAction(a)));
+ } else if ( isRadioAction(a)) {
+ JMenuItem item = menu.add(new JRadioButtonMenuItem(prepareCheckAction(a)));
+ menu.getButtonGroup().add( item );
+ } else {
+ menu.add(new JMenuItem(a));
+ }
+ }
+
+ }
+
+ return menu.get();
+
+ }
+
+ private Action prepareCheckAction( Action a ) {
+ if ( a.getValue(Action.SELECTED_KEY) == null ) {
+ a.putValue(Action.SELECTED_KEY, Boolean.FALSE);
+ }
+ return a;
+ }
+
+ private boolean isCheckAction( Action a ) {
+ return a.getClass().getAnnotation(CheckAction.class) != null;
+ }
+
+ private boolean isRadioAction( Action a ) {
+ return a.getClass().getAnnotation(RadioAction.class) != null;
+ }
+
+ private boolean isCollapsed( Action a ) {
+ return a instanceof ActionGroup && ((ActionGroup)a).isCollapsed();
+ }
+
+
+ /////// ADAPTERS ///////////////////////////////////////////////////////////////////////
+
+ abstract class MenuAdapter<T> {
+
+ protected T target;
+ private ButtonGroup bg;
+
+ public MenuAdapter( T target ) {
+ this.target = target;
+ }
+
+ public T get() { return target; }
+
+ public void addSeparator() {}
+
+ public ButtonGroup getButtonGroup() {
+ if (bg == null) {
+ bg = new ButtonGroup();
+ }
+ return bg;
+ }
+
+ public abstract JMenuItem add( JMenuItem menuItem );
+
+
+
+ }
+
+ class JMenuBarAdapter extends MenuAdapter<JMenuBar>{
+
+ public JMenuBarAdapter( JMenuBar mb ) {
+ super( mb );
+ }
+
+ @Override
+ public JMenuItem add(JMenuItem menuItem) {
+
+ Component c = target.add(menuItem);
+ if ( c instanceof JMenu ) {
+ ((JMenu)c).setIcon(null);
+ }
+ return menuItem;
+
+ }
+
+ }
+
+ class JToolBarAdapter extends MenuAdapter<JToolBar>{
+
+ public JToolBarAdapter( JToolBar tb ) {
+ super( tb );
+ }
+
+ @Override
+ public JMenuItem add(JMenuItem menuItem) {
+ Action action = menuItem.getAction();
+// Action action = menuItem instanceof JMenu? new ActionDropDownMenu((ActionGroup) menuAction): menuAction;
+
+ AbstractButton b = add( action, menuItem );
+ b.setHorizontalTextPosition(SwingConstants.LEADING);
+ b.putClientProperty("hideActionText", action.getValue(Action.SMALL_ICON) != null);
+ return menuItem;
+ }
+
+ private AbstractButton add( Action action, JMenuItem item ) {
+
+ if ( item instanceof JCheckBoxMenuItem || item instanceof JRadioButtonMenuItem ) {
+ return (AbstractButton) target.add( new JToggleButton( action ));
+ } else if ( item instanceof JMenu ) {
+ return target.add( new ActionDropDownMenu((ActionGroup) action) );
+ } else {
+ return target.add( action );
+ }
+
+ }
+
+
+ }
+
+ class JPopupMenuAdapter extends MenuAdapter<JPopupMenu>{
+
+ public JPopupMenuAdapter( JPopupMenu menu ) {
+ super( menu );
+ }
+
+ @Override
+ public JMenuItem add(JMenuItem menuItem) {
+ target.add(menuItem);
+ return menuItem;
+ }
+
+ @Override
+ public void addSeparator() {
+ int count = target.getComponentCount();
+ boolean canAddSeparator = count != 0 &&
+ target.getComponent(count-1).getClass() != JPopupMenu.Separator.class;
+ if ( canAddSeparator ) target.addSeparator();
+ }
+
+ }
+
+ class JMenuAdapter extends MenuAdapter<JMenu> {
+
+ public JMenuAdapter( JMenu menu ) {
+ super(menu);
+ }
+
+ @Override
+ public JMenuItem add(JMenuItem menuItem) {
+ target.add(menuItem);
+ return menuItem;
+ }
+
+ @Override
+ public void addSeparator() {
+ int count = target.getMenuComponentCount();
+ boolean canAddSeparator = count != 0 &&
+ target.getMenuComponent(count-1).getClass() != JPopupMenu.Separator.class;
+ if ( canAddSeparator ) target.addSeparator();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
new file mode 100644
index 0000000..ab606d5
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
@@ -0,0 +1,89 @@
+/*
+ * 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.action;
+
+import java.util.Collection;
+
+import javax.swing.Action;
+import javax.swing.JMenuBar;
+import javax.swing.JPopupMenu;
+import javax.swing.JToolBar;
+
+public final class ActionContainerBuilderFactory {
+
+ private ActionContainerBuilderFactory() {}
+
+ private static MenuBarBuilder menuBarBuilder = new MenuBarBuilder();
+ private static PopupMenuBuilder popupMenuBuilder = new PopupMenuBuilder();
+ private static ToolBarBuilder toolBarBuilder = new ToolBarBuilder();
+
+ public static IActionContainerBuilder<JMenuBar> getMenuBarBuilder() {
+ return menuBarBuilder;
+ }
+
+ public static IActionContainerBuilder<JPopupMenu> getPopupMenuBuilder() {
+ return popupMenuBuilder;
+ }
+
+ public static IActionContainerBuilder<JToolBar> getToolBarBuilder() {
+ return toolBarBuilder;
+ }
+}
+
+class MenuBarBuilder extends ActionBuilderHelper implements IActionContainerBuilder<JMenuBar> {
+
+ @Override
+ public JMenuBar build(Collection<Action> actions) {
+ return createGroup( new JMenuBarAdapter(new JMenuBar()), actions );
+ }
+
+}
+
+class PopupMenuBuilder extends ActionBuilderHelper implements IActionContainerBuilder<JPopupMenu> {
+
+ @Override
+ public JPopupMenu build(Collection<Action> actions) {
+ return createGroup( new JPopupMenuAdapter(new JPopupMenu()), actions );
+ }
+
+}
+
+class ToolBarBuilder extends ActionBuilderHelper implements IActionContainerBuilder<JToolBar> {
+
+ @Override
+ public JToolBar build(Collection<Action> actions) {
+ return createGroup( new JToolBarAdapter(new JToolBar()), actions );
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionDropDownMenu.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
new file mode 100644
index 0000000..b5384c6
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
@@ -0,0 +1,91 @@
+/*
+ * 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.action;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JPopupMenu;
+
+import org.oxbow.swingbits.util.swing.CompoundIcon;
+
+/**
+ * An action representing a drop down menu.
+ * Intended to be used for drop down buttons.
+ * When assigned to the button shows a pop up menu on click.
+ * Also automatically adds "drop down" arrow icon to the right of action's icon.
+ *
+ * @author Eugene Ryzhikov
+ *
+ */
+class ActionDropDownMenu extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+ private static final Icon DROPDOWN_ICON = new ImageIcon( ActionDropDownMenu.class.getResource("dropdown.png"));
+
+ private JPopupMenu menu = null;
+ private final ActionGroup action;
+
+ /**
+ * Action will create a pop up menu out of give ActionGroup
+ * @param actionGroup
+ */
+ public ActionDropDownMenu( ActionGroup actionGroup ) {
+ super( actionGroup.getName(), createIcon(actionGroup));
+ this.action = actionGroup;
+ }
+
+ private static Icon createIcon( ActionGroup action ) {
+ Icon mainIcon = action.getIcon();
+ return mainIcon == null? DROPDOWN_ICON: new CompoundIcon(mainIcon, DROPDOWN_ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ if ( !( e.getSource() instanceof Component ) ||
+ action == null || action.isEmpty() ||
+ !action.isEnabled() ) return;
+
+ if ( menu == null ) {
+ menu = ActionContainerBuilderFactory.getPopupMenuBuilder().build(action);
+ }
+
+ Component cmpt = (Component) e.getSource();
+ menu.show( cmpt , 0, cmpt.getHeight() );
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionGroup.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionGroup.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionGroup.java
new file mode 100644
index 0000000..d829446
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/ActionGroup.java
@@ -0,0 +1,131 @@
+/*
+ * 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.action;
+
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+
+public final class ActionGroup extends AbstractAction implements Collection<Action> {
+
+ private static final long serialVersionUID = -8373261802979340928L;
+
+ private final List<Action> actions = new ArrayList<Action>();
+ private boolean collapsed = true;
+
+
+ protected ActionGroup( String name, Icon icon ) {
+ super( name, icon );
+ }
+
+ public ActionGroup actions( Collection<Action> actions ) {
+ addAll(actions);
+ return this;
+ }
+
+ public ActionGroup actions( Action... actions ) {
+ return actions( Arrays.asList(actions));
+ }
+
+ public ActionGroup collapsed( boolean collapsed ) {
+ this.collapsed = collapsed;
+ return this;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {}
+
+ public boolean isCollapsed() {
+ return collapsed;
+ }
+
+ protected void setCollapsed(boolean collapsed) {
+ this.collapsed = collapsed;
+ }
+
+ public String getName() {
+ return (String) getValue(Action.NAME);
+ }
+
+ public Icon getIcon() {
+ return (Icon) getValue(Action.SMALL_ICON);
+ }
+
+ /// Collection methods
+
+ @Override
+ public int size() { return actions.size(); }
+
+ @Override
+ public boolean isEmpty() { return actions.isEmpty(); }
+
+ @Override
+ public boolean contains(Object o) { return actions.contains(o); }
+
+ @Override
+ public Iterator<Action> iterator() { return actions.iterator(); }
+
+ @Override
+ public Object[] toArray() { return actions.toArray(); }
+
+ @Override
+ public <T> T[] toArray(T[] a) { return actions.toArray(a); }
+
+ @Override
+ public boolean add(Action a) { return actions.add(a); }
+
+ @Override
+ public boolean remove(Object o) { return actions.remove(o); }
+
+ @Override
+ public boolean containsAll(Collection<?> c) { return actions.containsAll(c);}
+
+ @Override
+ public boolean addAll(Collection<? extends Action> c) { return actions.addAll(c); }
+
+ @Override
+ public boolean removeAll(Collection<?> c) { return actions.removeAll(c); }
+
+ @Override
+ public boolean retainAll(Collection<?> c) { return actions.retainAll(c); }
+
+ @Override
+ public void clear() { actions.clear(); }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/Actions.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/Actions.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/Actions.java
new file mode 100644
index 0000000..4585553
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/Actions.java
@@ -0,0 +1,83 @@
+/*
+ * 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.action;
+
+import java.awt.event.ActionEvent;
+import java.util.Arrays;
+import java.util.Collection;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+
+public final class Actions {
+
+ private static final Action SEPARATOR = new AbstractAction() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {}
+
+ };
+
+
+ private Actions() {}
+
+ public static final Action separator() { return SEPARATOR; }
+
+ public static final boolean isSeparator(Action a) {
+ return SEPARATOR == a;
+ }
+
+ public static final ActionGroup collapsedGroup( String name, Icon icon ) {
+ return new ActionGroup(name, icon ).collapsed(true);
+ }
+
+ public static final ActionGroup collapsedGroup( String name) {
+ return collapsedGroup(name,null);
+ }
+
+ public static final ActionGroup expandedGroup( String name, Icon icon ) {
+ return new ActionGroup(name, icon ).collapsed(false);
+ }
+
+ public static final ActionGroup expandedGroup( String name) {
+ return expandedGroup(name, null);
+ }
+
+ public static final Collection<Action> actions( Action... actions ) {
+ return Arrays.asList(actions);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/CheckAction.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/CheckAction.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/CheckAction.java
new file mode 100644
index 0000000..3f15b8d
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/CheckAction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.action;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CheckAction {
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/IActionContainerBuilder.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
new file mode 100644
index 0000000..1c5f915
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
@@ -0,0 +1,43 @@
+/*
+ * 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.action;
+
+import java.util.Collection;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+
+public interface IActionContainerBuilder<T extends JComponent> {
+
+ T build( Collection<Action> actions );
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/RadioAction.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/RadioAction.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/RadioAction.java
new file mode 100644
index 0000000..5fb93c0
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/RadioAction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.action;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RadioAction {
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/dropdown.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/dropdown.png b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/dropdown.png
new file mode 100644
index 0000000..8db7022
Binary files /dev/null and b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/action/dropdown.png differ
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/CommandLink.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/CommandLink.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/CommandLink.java
new file mode 100644
index 0000000..c555156
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/CommandLink.java
@@ -0,0 +1,104 @@
+/*
+ * 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 javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.oxbow.swingbits.dialog.task.TaskDialog.CommandTag;
+
+public class CommandLink implements TaskDialog.Command {
+
+ private final String instruction;
+ private final String text;
+ private final Icon icon;
+
+ public CommandLink( Icon icon, String instruction, String text ) {
+ this.instruction = instruction;
+ this.text = text;
+ this.icon = icon;
+ }
+
+ public CommandLink( String instruction, String text ) {
+ this( null, instruction, text );
+ }
+
+ public String getInstruction() {
+ return instruction;
+ }
+
+ public String getText() {
+ return text;
+ };
+
+ public Icon getIcon() {
+ return icon;
+ }
+
+
+
+ @Override
+ public String getTitle() {
+ return instruction;
+ }
+
+ @Override
+ public CommandTag getTag() {
+ return null;
+ }
+
+ @Override
+ public String getDescription() {
+ return text;
+ }
+
+ @Override
+ public boolean isClosing() {
+ return true;
+ }
+
+ @Override
+ public int getWaitInterval() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEnabled(boolean validationResult) {
+ return true;
+ }
+
+ @Override
+ public KeyStroke getKeyStroke() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
new file mode 100644
index 0000000..e60a71a
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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 org.oxbow.swingbits.dialog.task.design.DefaultContentDesign;
+import org.oxbow.swingbits.dialog.task.design.LinuxContentDesign;
+import org.oxbow.swingbits.dialog.task.design.MacOsContentDesign;
+import org.oxbow.swingbits.dialog.task.design.WindowsContentDesign;
+import org.oxbow.swingbits.util.OperatingSystem;
+
+public class ContentDesignFactory {
+
+ private ContentDesignFactory() {}
+
+ public static final IContentDesign getDesignByOperatingSystem() {
+
+ switch( OperatingSystem.getCurrent() ) {
+ case MACOS : return new MacOsContentDesign();
+ case LINUX : return new LinuxContentDesign();
+ case WINDOWS: return new WindowsContentDesign();
+ default : return new DefaultContentDesign();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
new file mode 100644
index 0000000..2f0b183
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
@@ -0,0 +1,43 @@
+/*
+ * 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.Graphics;
+
+import javax.swing.JComponent;
+
+public interface ICommandLinkPainter {
+
+ void prepareSource( JComponent source );
+ void paint(Graphics g, JComponent source );
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4c3a7698/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/IContentDesign.java b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
new file mode 100644
index 0000000..bdfd1df
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
@@ -0,0 +1,127 @@
+/*
+ * 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 org.oxbow.swingbits.dialog.task.design.TaskDialogContent;
+
+public interface IContentDesign {
+
+
+ static final String ICON_INFO = "OptionPane.informationIcon";
+ static final String ICON_QUESTION = "OptionPane.questionIcon";
+ static final String ICON_WARNING = "OptionPane.warningIcon";
+ static final String ICON_ERROR = "OptionPane.errorIcon";
+
+
+ /**
+ * UIDefaults key for task dialog "fewer details" icon
+ */
+ static final String ICON_FEWER_DETAILS = "TaskDialog.fewerDetailsIcon";
+
+
+ /**
+ * UIDefaults key for task dialog "more details" icon
+ */
+ static final String ICON_MORE_DETAILS = "TaskDialog.moreDetailsIcon";
+
+
+ /**
+ * UIDefaults key for task dialog command link icon
+ */
+ static final String ICON_COMMAND_LINK = "TaskDialog.commandLinkIcon";
+
+
+ /**
+ * UIDefaults key for task dialog message background color
+ */
+ static final String COLOR_MESSAGE_BACKGROUND = "TaskDialog.messageBackground";
+
+
+ /**
+ * UIDefaults key for task dialog instruction foreground color
+ */
+ static final String COLOR_INSTRUCTION_FOREGROUND = "TaskDialog.instructionForeground";
+
+
+ /**
+ * UIDefaults key for task dialog instruction font
+ */
+ static final String FONT_INSTRUCTION = "TaskDialog.instructionFont";
+
+
+ /**
+ * UIDefaults key for task dialog text font
+ */
+ static final String FONT_TEXT = "TaskDialog.textFont";
+
+
+ /**
+ * UIDefaults key for "More Details" label
+ */
+ static final String TEXT_MORE_DETAILS = "TaskDialog.moreDetailsText";
+
+
+ /**
+ * UIDefaults key for "Fewer Details" label
+ */
+ static final String TEXT_FEWER_DETAILS = "TaskDialog.fewerDetailsText";
+
+
+
+
+ /**
+ * Updates UIDefaults with appropriate design settings
+ */
+ void updateUIDefaults();
+
+
+ /**
+ * Builds and returns contents of task dialog
+ * @return
+ */
+ TaskDialogContent buildContent();
+
+
+ /**
+ * Returns true if command buttons are locked ( should have the same size )
+ * @return
+ */
+ boolean isCommandButtonSizeLocked();
+
+
+ /**
+ * Returns command link painter
+ * @return
+ */
+ ICommandLinkPainter getCommandLinkPainter();
+
+}