You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/01/10 15:03:24 UTC
[01/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Updated Branches:
refs/heads/develop 0226c44ae -> 60ae655ac
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/EmptyIcon.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/EmptyIcon.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/EmptyIcon.java
deleted file mode 100644
index d2129f4..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/EmptyIcon.java
+++ /dev/null
@@ -1,104 +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.util.swing;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.RenderingHints;
-import java.awt.geom.RoundRectangle2D;
-
-import javax.swing.Icon;
-
-public class EmptyIcon implements Icon {
-
- private final int size;
- private boolean paintImage;
-
- public static final EmptyIcon visible( int size ) {
- return new EmptyIcon(size, true);
- }
-
- public static final EmptyIcon hidden() {
- return new EmptyIcon(0, false);
- }
-
- private EmptyIcon( int size, boolean paintImage ) {
- this.size = Math.abs(size == 0? 1: size); // needs at least 1px to copy images (see Icons class)
- this.paintImage = paintImage;
- }
-
- @Override
- public int getIconHeight() {
- return size;
- }
-
- @Override
- public int getIconWidth() {
- return size;
- }
-
- @Override
- public void paintIcon(Component c, Graphics g, int x, int y) {
-
- if ( paintImage && size > 2 ) {
-
- Graphics2D g2 = (Graphics2D)g;
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-
- int radius = size / 3;
- RoundRectangle2D r = new RoundRectangle2D.Float(x, y, size-1, size-1, radius, radius );
-
- g2.setColor( new Color( 255, 255, 0, 127) );
- g2.fill(r);
-
- g2.setStroke( new BasicStroke(3));
- g2.setColor(Color.RED);
- g2.draw(r);
-
- Point center = new Point( x+size/2, y+size/2 );
-
- int d = size / 4;
- int xad = center.x-d;
- int xsd = center.x+d;
- int yad = center.y+d;
- int ysd = center.y-d;
- g2.drawLine( xad, ysd, xsd, yad );
- g2.drawLine( xad, yad, xsd, ysd );
-
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/Icons.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/Icons.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/Icons.java
deleted file mode 100644
index 1649699..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/Icons.java
+++ /dev/null
@@ -1,98 +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.util.swing;
-
-import java.awt.Image;
-import java.awt.image.BufferedImage;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-/**
- * Utility class for icon manipulation
- *
- * Created on Mar 1, 2010
- * @author Eugene Ryzhikov
- *
- */
-public final class Icons {
-
- private Icons() {}
-
- /**
- * Converts any icon to image
- * @param icon icon to convert
- * @return resulted image
- */
- public static final Image asImage( Icon icon ) {
-
- if ( icon == null ) throw new IllegalArgumentException("The icon should not be null");
-
- if ( icon instanceof ImageIcon ) return ((ImageIcon)icon).getImage();
-
- int w = icon.getIconWidth() == 0? 1: icon.getIconWidth();
- int h = icon.getIconHeight() == 0? 1: icon.getIconHeight();
-
- Image image = new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB);
- icon.paintIcon( null, image.getGraphics(), 0, 0 );
- return image;
-
- }
-
-
- /**
- * Converts any icon to an image with specified width and height
- * @param icon icon to convert
- * @param newWidth new image width
- * @param newHeight new image height
- * @return resulted image
- */
- public static final Image asImage( Icon icon, int newWidth, int newHeight ) {
-
- return asImage( icon ).getScaledInstance( newWidth, newHeight, Image.SCALE_SMOOTH );
- }
-
- /**
- * Scales any icon to specified width and height
- * @param icon icon to scale
- * @param newWidth new icon width
- * @param newHeight new icon height
- * @return resulting icon
- */
- public static final Icon scale( Icon icon, int newWidth, int newHeight ) {
-
- return new ImageIcon( asImage( icon, newWidth, newHeight ));
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/SwingBean.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/SwingBean.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/SwingBean.java
deleted file mode 100644
index 221ad07..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/SwingBean.java
+++ /dev/null
@@ -1,76 +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.util.swing;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-/**
- * Base for all beans not inherited from JComponent
- *
- * Created on Mar 1, 2010
- * * @author Eugene Ryzhikov
- *
- */
-public class SwingBean {
-
- private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
-
-
- public void addPropertyListener( PropertyChangeListener pl ) {
- propertyChangeSupport.addPropertyChangeListener(pl);
- }
-
- public void addPropertyListener( String propertyName, PropertyChangeListener pl ) {
- propertyChangeSupport.addPropertyChangeListener( propertyName, pl );
- }
-
- public void removePropertyListener( PropertyChangeListener pl ) {
- propertyChangeSupport.removePropertyChangeListener(pl);
- }
-
- public void removePropertyListener( String propertyName, PropertyChangeListener pl ) {
- propertyChangeSupport.removePropertyChangeListener( propertyName, pl );
- }
-
-
- protected abstract class Property<T> extends BeanProperty<T> {
- public Property( String propertyName, boolean forceChange ) {
- super( propertyChangeSupport, propertyName, forceChange );
- }
-
- public Property( String propertyName ) {
- super( propertyChangeSupport, propertyName );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/META-INF/LICENSE b/launchers/marmotta-splash/src/ext/resources/META-INF/LICENSE
deleted file mode 100644
index 4b3cfce..0000000
--- a/launchers/marmotta-splash/src/ext/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,208 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-This library bundles the MigLayout java library, which is available under a
-"New BSD" license. For details, see http://www.miglayout.com/.
-
-This library bundles the SwingBits java library, which is available under a
-"New BSD" license. For details, see http://swingbits.sourceforge.net/.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/META-INF/NOTICE b/launchers/marmotta-splash/src/ext/resources/META-INF/NOTICE
deleted file mode 100644
index 22b650e..0000000
--- a/launchers/marmotta-splash/src/ext/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,11 +0,0 @@
-Apache Marmotta LDPath
-Copyright 2012-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
-
- Copyright 2008-2012 Salzburg Research Forschungsgesellschaft mbH
-
-These have been licensed to the Apache Software Foundation under a software grant.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/arrowGreenRight.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/arrowGreenRight.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/arrowGreenRight.png
deleted file mode 100644
index 63b675c..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/arrowGreenRight.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetails.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetails.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetails.png
deleted file mode 100644
index c45d4ac..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetails.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetailsMac.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetailsMac.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetailsMac.png
deleted file mode 100644
index 5f7ec01..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/fewerDetailsMac.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_error.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_error.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_error.png
deleted file mode 100644
index 0344822..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_error.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_info.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_info.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_info.png
deleted file mode 100644
index d8197d6..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_info.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_question.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_question.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_question.png
deleted file mode 100644
index d56ba2c..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_question.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_warning.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_warning.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_warning.png
deleted file mode 100644
index 284e5e3..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/linux_warning.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetails.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetails.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetails.png
deleted file mode 100644
index b8896c7..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetails.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetailsMac.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetailsMac.png b/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetailsMac.png
deleted file mode 100644
index a64f040..0000000
Binary files a/launchers/marmotta-splash/src/ext/resources/org/oxbow/swingbits/dialog/task/moreDetailsMac.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/META-INF/LICENSE b/launchers/marmotta-splash/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 4e55a9f..0000000
--- a/launchers/marmotta-splash/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,284 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
-Apache Marmotta 3rd party source code:
-=====================================
-
-Due some restrictions (artifacts availability, custom patches, etc.), the Apache
-Marmotta project directly includes some code of a number of subcomponents from
-external projects with separate copyright notices and license terms. Your use of
-the code for the these subcomponents is subject to the terms and conditions of
-the following licenses.
-
-For the MigLayout component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2004 MiG InfoCom AB, http://www.migcalendar.com/miglayout
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
-For the SwingBits component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2006 EzWare, http://swingbits.sourceforge.net
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/META-INF/NOTICE b/launchers/marmotta-splash/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index da32381..0000000
--- a/launchers/marmotta-splash/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,11 +0,0 @@
-Apache Marmotta Splash Screen
-Copyright 2012-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were originally based on the following:
-
- Copyright 2008-2012 Salzburg Research Forschungsgesellschaft mbH
-
-These have been licensed to the Apache Software Foundation under a software grant.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog.properties b/launchers/marmotta-splash/src/main/resources/task-dialog.properties
deleted file mode 100644
index b946caa..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-Ok=OK
-Cancel=Cancel
-Close=Close
-Yes=Yes
-No=No
-MoreDetails=More Details
-FewerDetails=Fewer Details
-Details=Details
-Information=Information
-Error=Error
-Question=Question
-Warning=Warning
-Exception=Exception
-Choice=Choice
-Select=Select
-Input=Input
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_de_DE.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_de_DE.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_de_DE.properties
deleted file mode 100644
index 5a138d3..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_de_DE.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-OK=OK
-Cancel=Abbrechen
-Close=Schlie�en
-Yes=Ja
-No=Nein
-MoreDetails=Weitere Details
-FewerDetails=Weniger Details
-Details=Details
-Information=Information
-Error=Fehler
-Question=Frage
-Warning=Warnung
-Exception=Ausnahme
-Choice=Auswahl
-Select=Ausw�hlen
-Input=Eingabe
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_es_ES.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_es_ES.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_es_ES.properties
deleted file mode 100644
index a4af717..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_es_ES.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-Ok=OK
-Cancel=Cancelar
-Close=Cerrar
-Yes=S�
-No=No
-MoreDetails=M�s detalles
-FewerDetails=Menos detalles
-Details=Detalles
-Information=Informaci�n
-Error=Error
-Question=Pregunta
-Warning=Advertencia
-Exception=Excepci�n
-Choice=Elecci�n
-Select=Seleccione
-Input=Input
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_fr_FR.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_fr_FR.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_fr_FR.properties
deleted file mode 100644
index e361751..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_fr_FR.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-OK=OK
-Cancel=Annuler
-Close=Fermer
-Yes=Oui
-No=Non
-MoreDetails=Plus de d�tails
-FewerDetails=Moins de d�tails
-Details=D�tails
-Information=Information
-Error=Erreur
-Question=Question
-Warning=Avertissement
-Exception=Exception
-Choice=Choix
-Select=S�lection
-Input=Entr�e
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_it_IT.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_it_IT.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_it_IT.properties
deleted file mode 100644
index 12a23d7..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_it_IT.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-OK=OK
-Cancel=Annulla
-Close=Chiudi
-Yes=Si
-No=No
-MoreDetails=Pi\u00F9 Dettagli
-FewerDetails=Meno Dettagli
-Details=Dettagli
-Information=Informazione
-Error=Errore
-Question=Domanda
-Warning=Avvertenza
-Exception=Eccezione
-Choice=Scelta
-Select=Seleziona
-Input=Input
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_pl_PL.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_pl_PL.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_pl_PL.properties
deleted file mode 100644
index c61c528..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_pl_PL.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-Ok=OK
-Cancel=Anuluj
-Close=Zamknij
-Yes=Tak
-No=Nie
-MoreDetails=Więcej szczegółów
-FewerDetails=Mniej szczegółów
-Details=Szczegóły
-Information=Informacja
-Error=Błąd
-Question=Pytanie
-Warning=Ostrzeżenie
-Exception=Wyjątek
-Choice=Wybór
-Select=Wybór
-Input=Wprowadzanie
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_BR.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_BR.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_pt_BR.properties
deleted file mode 100644
index 631506d..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_BR.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-Ok=OK
-Cancel=Cancelar
-Close=Fechar
-Yes=Sim
-No=N�o
-MoreDetails=Mais Detalhes
-FewerDetails=Menos Detalhes
-Details=Detalhes
-Information=Informa��o
-Error=Erro
-Question=Pergunta
-Warning=Advert�ncia
-Exception=Exce��o
-Choice=Op��o
-Select=Sele��o
-Input=Entrada
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_PT.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_PT.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_pt_PT.properties
deleted file mode 100644
index 631506d..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_pt_PT.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-Ok=OK
-Cancel=Cancelar
-Close=Fechar
-Yes=Sim
-No=N�o
-MoreDetails=Mais Detalhes
-FewerDetails=Menos Detalhes
-Details=Detalhes
-Information=Informa��o
-Error=Erro
-Question=Pergunta
-Warning=Advert�ncia
-Exception=Exce��o
-Choice=Op��o
-Select=Sele��o
-Input=Entrada
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/main/resources/task-dialog_zh_CN.properties
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/resources/task-dialog_zh_CN.properties b/launchers/marmotta-splash/src/main/resources/task-dialog_zh_CN.properties
deleted file mode 100644
index e42d76a..0000000
--- a/launchers/marmotta-splash/src/main/resources/task-dialog_zh_CN.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-Ok=\u786e\u5b9a
-Cancel=\u653e\u5f03
-Close=\u5173\u95ed
-Yes=\u662f
-No=\u5426
-MoreDetails=\u8be6\u7ec6\u4fe1\u606f
-FewerDetails=\u7b80\u660e\u4fe1\u606f
-Details=\u4fe1\u606f
-Information=\u4fe1\u606f
-Error=\u9519\u8bef
-Question=\u95ee\u9898
-Warning=\u8b66\u544a
-Exception=\u5f02\u5e38
-Choice=\u9009\u9879
-Select=\u9009\u62e9
-Input=\u8f93\u5165
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-webapp-bigdata/src/main/webapp/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp-bigdata/src/main/webapp/META-INF/LICENSE b/launchers/marmotta-webapp-bigdata/src/main/webapp/META-INF/LICENSE
index d80e8d4..fc3920b 100644
--- a/launchers/marmotta-webapp-bigdata/src/main/webapp/META-INF/LICENSE
+++ b/launchers/marmotta-webapp-bigdata/src/main/webapp/META-INF/LICENSE
@@ -2570,78 +2570,6 @@ external projects with separate copyright notices and license terms. Your use of
the code for the these subcomponents is subject to the terms and conditions of
the following licenses.
-For the MigLayout component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2004 MiG InfoCom AB, http://www.migcalendar.com/miglayout
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
-For the SwingBits component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2006 EzWare, http://swingbits.sourceforge.net
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
For the ROME component,
located at:
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-webapp/src/main/webapp/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/webapp/META-INF/LICENSE b/launchers/marmotta-webapp/src/main/webapp/META-INF/LICENSE
index d80e8d4..fc3920b 100644
--- a/launchers/marmotta-webapp/src/main/webapp/META-INF/LICENSE
+++ b/launchers/marmotta-webapp/src/main/webapp/META-INF/LICENSE
@@ -2570,78 +2570,6 @@ external projects with separate copyright notices and license terms. Your use of
the code for the these subcomponents is subject to the terms and conditions of
the following licenses.
-For the MigLayout component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2004 MiG InfoCom AB, http://www.migcalendar.com/miglayout
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
-For the SwingBits component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2006 EzWare, http://swingbits.sourceforge.net
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
For the ROME component,
located at:
[10/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/CC.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/CC.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/CC.java
deleted file mode 100644
index 8ce8067..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/CC.java
+++ /dev/null
@@ -1,1833 +0,0 @@
-package net.miginfocom.layout;
-
-import java.io.*;
-import java.util.ArrayList;
-/*
- * 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
- */
-
-/** A simple value holder for one component's constraint.
- */
-public final class CC implements Externalizable
-{
- private static final BoundSize DEF_GAP = BoundSize.NULL_SIZE; // Only used to denote default wrap/newline gap.
-
- static final String[] DOCK_SIDES = {"north", "west", "south", "east"};
-
- // See the getters and setters for information about the properties below.
-
- private int dock = -1;
-
- private UnitValue[] pos = null; // [x1, y1, x2, y2]
-
- private UnitValue[] padding = null; // top, left, bottom, right
-
- private Boolean flowX = null;
-
- private int skip = 0;
-
- private int split = 1;
-
- private int spanX = 1, spanY = 1;
-
- private int cellX = -1, cellY = 0; // If cellX is -1 then cellY is also considered -1. cellY is never negative.
-
- private String tag = null;
-
- private String id = null;
-
- private int hideMode = -1;
-
- private DimConstraint hor = new DimConstraint();
-
- private DimConstraint ver = new DimConstraint();
-
- private BoundSize newline = null;
-
- private BoundSize wrap = null;
-
- private boolean boundsInGrid = true;
-
- private boolean external = false;
-
- private Float pushX = null, pushY = null;
-
-
- // ***** Tmp cache field
-
- private static final String[] EMPTY_ARR = new String[0];
-
- private transient String[] linkTargets = null;
-
- /** Empty constructor.
- */
- public CC()
- {
- }
-
- String[] getLinkTargets()
- {
- if (linkTargets == null) {
- final ArrayList<String> targets = new ArrayList<String>(2);
-
- if (pos != null) {
- for (int i = 0; i < pos.length ; i++)
- addLinkTargetIDs(targets, pos[i]);
- }
-
- linkTargets = targets.size() == 0 ? EMPTY_ARR : targets.toArray(new String[targets.size()]);
- }
- return linkTargets;
- }
-
- private void addLinkTargetIDs(ArrayList<String> targets, UnitValue uv)
- {
- if (uv != null) {
- String linkId = uv.getLinkTargetId();
- if (linkId != null) {
- targets.add(linkId);
- } else {
- for (int i = uv.getSubUnitCount() - 1; i >= 0; i--) {
- UnitValue subUv = uv.getSubUnitValue(i);
- if (subUv.isLinkedDeep())
- addLinkTargetIDs(targets, subUv);
- }
- }
- }
- }
-
- // **********************************************************
- // Chaining constraint setters
- // **********************************************************
-
- /** Specifies that the component should be put in the end group <code>s</code> and will thus share the same ending
- * coordinate as them within the group.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC endGroupX(String s)
- {
- hor.setEndGroup(s);
- return this;
- }
-
- /** Specifies that the component should be put in the size group <code>s</code> and will thus share the same size
- * as them within the group.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC sizeGroupX(String s)
- {
- hor.setSizeGroup(s);
- return this;
- }
-
- /** The minimum size for the component. The value will override any value that is set on the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC minWidth(String size)
- {
- hor.setSize(LayoutUtil.derive(hor.getSize(), ConstraintParser.parseUnitValue(size, true), null, null));
- return this;
- }
-
- /** The size for the component as a min and/or preferred and/or maximum size. The value will override any value that is set on
- * the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC width(String size)
- {
- hor.setSize(ConstraintParser.parseBoundSize(size, false, true));
- return this;
- }
-
- /** The maximum size for the component. The value will override any value that is set on the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC maxWidth(String size)
- {
- hor.setSize(LayoutUtil.derive(hor.getSize(), null, null, ConstraintParser.parseUnitValue(size, true)));
- return this;
- }
-
-
- /** The horizontal gap before and/or after the component. The gap is towards cell bounds and/or other component bounds.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param before The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @param after The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC gapX(String before, String after)
- {
- if (before != null)
- hor.setGapBefore(ConstraintParser.parseBoundSize(before, true, true));
-
- if (after != null)
- hor.setGapAfter(ConstraintParser.parseBoundSize(after, true, true));
-
- return this;
- }
-
- /** Same functionality as <code>getHorizontal().setAlign(ConstraintParser.parseUnitValue(unitValue, true))</code> only this method
- * returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param align The align keyword or for instance "100px". E.g "left", "right", "leading" or "trailing".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC alignX(String align)
- {
- hor.setAlign(ConstraintParser.parseUnitValueOrAlign(align, true, null));
- return this;
- }
-
- /** The grow priority compared to other components in the same cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The grow priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC growPrioX(int p)
- {
- hor.setGrowPriority(p);
- return this;
- }
-
- /** Grow priority for the component horizontally and optionally vertically.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param widthHeight The new shrink weight and height. 1-2 arguments, never null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC growPrio(int ... widthHeight)
- {
- switch (widthHeight.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length);
- case 2:
- growPrioY(widthHeight[1]);
- case 1:
- growPrioX(widthHeight[0]);
- }
- return this;
- }
-
- /** Grow weight for the component horizontally. It default to weight <code>100</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #growX(float)
- */
- public final CC growX()
- {
- hor.setGrow(ResizeConstraint.WEIGHT_100);
- return this;
- }
-
- /** Grow weight for the component horizontally.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new grow weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC growX(float w)
- {
- hor.setGrow(new Float(w));
- return this;
- }
-
- /** grow weight for the component horizontally and optionally vertically.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param widthHeight The new shrink weight and height. 1-2 arguments, never null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC grow(float ... widthHeight)
- {
- switch (widthHeight.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length);
- case 2:
- growY(widthHeight[1]);
- case 1:
- growX(widthHeight[0]);
- }
- return this;
- }
-
- /** The shrink priority compared to other components in the same cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The shrink priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC shrinkPrioX(int p)
- {
- hor.setShrinkPriority(p);
- return this;
- }
-
- /** Shrink priority for the component horizontally and optionally vertically.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param widthHeight The new shrink weight and height. 1-2 arguments, never null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC shrinkPrio(int ... widthHeight)
- {
- switch (widthHeight.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length);
- case 2:
- shrinkPrioY(widthHeight[1]);
- case 1:
- shrinkPrioX(widthHeight[0]);
- }
- return this;
- }
-
- /** Shrink weight for the component horizontally.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new shrink weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC shrinkX(float w)
- {
- hor.setShrink(new Float(w));
- return this;
- }
-
- /** Shrink weight for the component horizontally and optionally vertically.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param widthHeight The new shrink weight and height. 1-2 arguments, never null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC shrink(float ... widthHeight)
- {
- switch (widthHeight.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length);
- case 2:
- shrinkY(widthHeight[1]);
- case 1:
- shrinkX(widthHeight[0]);
- }
- return this;
- }
-
- /** The end group that this component should be placed in.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The name of the group. If <code>null</code> that means no group (default)
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC endGroupY(String s)
- {
- ver.setEndGroup(s);
- return this;
- }
-
- /** The end group(s) that this component should be placed in.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param xy The end group for x and y respectively. 1-2 arguments, not null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC endGroup(String ... xy)
- {
- switch (xy.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + xy.length);
- case 2:
- endGroupY(xy[1]);
- case 1:
- endGroupX(xy[0]);
- }
- return this;
- }
-
- /** The size group that this component should be placed in.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The name of the group. If <code>null</code> that means no group (default)
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC sizeGroupY(String s)
- {
- ver.setSizeGroup(s);
- return this;
- }
-
- /** The size group(s) that this component should be placed in.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param xy The size group for x and y respectively. 1-2 arguments, not null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC sizeGroup(String ... xy)
- {
- switch (xy.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + xy.length);
- case 2:
- sizeGroupY(xy[1]);
- case 1:
- sizeGroupX(xy[0]);
- }
- return this;
- }
-
- /** The minimum size for the component. The value will override any value that is set on the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC minHeight(String size)
- {
- ver.setSize(LayoutUtil.derive(ver.getSize(), ConstraintParser.parseUnitValue(size, false), null, null));
- return this;
- }
-
- /** The size for the component as a min and/or preferred and/or maximum size. The value will override any value that is set on
- * the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC height(String size)
- {
- ver.setSize(ConstraintParser.parseBoundSize(size, false, false));
- return this;
- }
-
- /** The maximum size for the component. The value will override any value that is set on the component itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The size expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC maxHeight(String size)
- {
- ver.setSize(LayoutUtil.derive(ver.getSize(), null, null, ConstraintParser.parseUnitValue(size, false)));
- return this;
- }
-
- /** The vertical gap before (normally above) and/or after (normally below) the component. The gap is towards cell bounds and/or other component bounds.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param before The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @param after The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC gapY(String before, String after)
- {
- if (before != null)
- ver.setGapBefore(ConstraintParser.parseBoundSize(before, true, false));
-
- if (after != null)
- ver.setGapAfter(ConstraintParser.parseBoundSize(after, true, false));
-
- return this;
- }
-
- /** Same functionality as <code>getVertical().setAlign(ConstraintParser.parseUnitValue(unitValue, true))</code> only this method
- * returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param align The align keyword or for instance "100px". E.g "top" or "bottom".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC alignY(String align)
- {
- ver.setAlign(ConstraintParser.parseUnitValueOrAlign(align, false, null));
- return this;
- }
-
- /** The grow priority compared to other components in the same cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The grow priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC growPrioY(int p)
- {
- ver.setGrowPriority(p);
- return this;
- }
-
- /** Grow weight for the component vertically. Defaults to <code>100</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #growY(Float)
- */
- public final CC growY()
- {
- ver.setGrow(ResizeConstraint.WEIGHT_100);
- return this;
- }
-
- /** Grow weight for the component vertically.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new grow weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC growY(Float w)
- {
- ver.setGrow(w);
- return this;
- }
-
- /** The shrink priority compared to other components in the same cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The shrink priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC shrinkPrioY(int p)
- {
- ver.setShrinkPriority(p);
- return this;
- }
-
- /** Shrink weight for the component horizontally.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new shrink weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC shrinkY(float w)
- {
- ver.setShrink(new Float(w));
- return this;
- }
-
- /** How this component, if hidden (not visible), should be treated.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param mode The mode. Default to the mode in the {@link net.miginfocom.layout.LC}.
- * 0 == Normal. Bounds will be calculated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC hideMode(int mode)
- {
- setHideMode(mode);
- return this;
- }
-
- /** The id used to reference this component in some constraints.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The id or <code>null</code>. May consist of a groupID and an componentID which are separated by a dot: ".". E.g. "grp1.id1".
- * The dot should never be first or last if present.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- */
- public final CC id(String s)
- {
- setId(s);
- return this;
- }
-
- /** Same functionality as {@link #setTag(String tag)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param tag The new tag. May be <code>null</code>.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setTag(String)
- */
- public final CC tag(String tag)
- {
- setTag(tag);
- return this;
- }
-
- /** Set the cell(s) that the component should occupy in the grid. Same functionality as {@link #setCellX(int col)} and
- * {@link #setCellY(int row)} together with {@link #setSpanX(int width)} and {@link #setSpanY(int height)}. This method
- * returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param colRowWidthHeight cellX, cellY, spanX, spanY repectively. 1-4 arguments, not null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setCellX(int)
- * @see #setCellY(int)
- * @see #setSpanX(int)
- * @see #setSpanY(int)
- * @since 3.7.2. Replacing cell(int, int) and cell(int, int, int, int)
- */
- public final CC cell(int ... colRowWidthHeight)
- {
- switch (colRowWidthHeight.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + colRowWidthHeight.length);
- case 4:
- setSpanY(colRowWidthHeight[3]);
- case 3:
- setSpanX(colRowWidthHeight[2]);
- case 2:
- setCellY(colRowWidthHeight[1]);
- case 1:
- setCellX(colRowWidthHeight[0]);
- }
- return this;
- }
-
- /** Same functionality as <code>spanX(cellsX).spanY(cellsY)</code> which means this cell will span cells in both x and y.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * Since 3.7.2 this takes an array/vararg whereas it previously only took two specific values, xSpan and ySpan.
- * @param cells spanX and spanY, when present, and in that order.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setSpanY(int)
- * @see #setSpanX(int)
- * @see #spanY()
- * @see #spanX()
- * @since 3.7.2 Replaces span(int, int).
- */
- public final CC span(int ... cells)
- {
- if (cells == null || cells.length == 0) {
- setSpanX(LayoutUtil.INF);
- setSpanY(1);
- } else if (cells.length == 1) {
- setSpanX(cells[0]);
- setSpanY(1);
- } else {
- setSpanX(cells[0]);
- setSpanY(cells[1]);
- }
- return this;
- }
-
- /** Corresponds exactly to the "gap left right top bottom" keyword.
- * @param args Same as for the "gap" keyword. Length 1-4, never null buf elements can be null.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gap(String ... args)
- {
- switch (args.length) {
- default:
- throw new IllegalArgumentException("Illegal argument count: " + args.length);
- case 4:
- gapBottom(args[3]);
- case 3:
- gapTop(args[2]);
- case 2:
- gapRight(args[1]);
- case 1:
- gapLeft(args[0]);
- }
- return this;
- }
-
- /** Sets the horizontal gap before the component.
- * <p>
- * Note! This is currently same as gapLeft(). This might change in 4.x.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapBefore(String boundsSize)
- {
- hor.setGapBefore(ConstraintParser.parseBoundSize(boundsSize, true, true));
- return this;
- }
-
- /** Sets the horizontal gap after the component.
- * <p>
- * Note! This is currently same as gapLeft(). This might change in 4.x.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapAfter(String boundsSize)
- {
- hor.setGapAfter(ConstraintParser.parseBoundSize(boundsSize, true, true));
- return this;
- }
-
- /** Sets the gap above the component.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapTop(String boundsSize)
- {
- ver.setGapBefore(ConstraintParser.parseBoundSize(boundsSize, true, false));
- return this;
- }
-
- /** Sets the gap to the left the component.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapLeft(String boundsSize)
- {
- hor.setGapBefore(ConstraintParser.parseBoundSize(boundsSize, true, true));
- return this;
- }
-
- /** Sets the gap below the component.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapBottom(String boundsSize)
- {
- ver.setGapAfter(ConstraintParser.parseBoundSize(boundsSize, true, false));
- return this;
- }
-
- /** Sets the gap to the right of the component.
- * @param boundsSize The size of the gap expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px!".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final CC gapRight(String boundsSize)
- {
- hor.setGapAfter(ConstraintParser.parseBoundSize(boundsSize, true, true));
- return this;
- }
-
- /** Same functionality as {@link #setSpanY(int LayoutUtil.INF)} which means this cell will span the rest of the column.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setSpanY(int)
- * @see #spanY()
- */
- public final CC spanY()
- {
- return spanY(LayoutUtil.INF);
- }
-
- /** Same functionality as {@link #setSpanY(int)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells The number of cells to span (i.e. merge).
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setSpanY(int)
- */
- public final CC spanY(int cells)
- {
- setSpanY(cells);
- return this;
- }
-
- /** Same functionality as {@link #setSpanX(int)} which means this cell will span the rest of the row.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setSpanX(int)
- * @see #spanX()
- */
- public final CC spanX()
- {
- return spanX(LayoutUtil.INF);
- }
-
- /** Same functionality as {@link #setSpanX(int)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells The number of cells to span (i.e. merge).
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setSpanY(int)
- */
- public final CC spanX(int cells)
- {
- setSpanX(cells);
- return this;
- }
-
- /** Same functionality as <code>pushX().pushY()</code> which means this cell will push in both x and y dimensions.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushX(Float)
- * @see #setPushX(Float)
- * @see #pushY()
- * @see #pushX()
- */
- public final CC push()
- {
- return pushX().pushY();
- }
-
- /** Same functionality as <code>pushX(weightX).pushY(weightY)</code> which means this cell will push in both x and y dimensions.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param weightX The weight used in the push.
- * @param weightY The weight used in the push.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushY(Float)
- * @see #setPushX(Float)
- * @see #pushY()
- * @see #pushX()
- */
- public final CC push(Float weightX, Float weightY)
- {
- return pushX(weightX).pushY(weightY);
- }
-
- /** Same functionality as {@link #setPushY(Float))} which means this cell will push the rest of the column.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushY(Float)
- */
- public final CC pushY()
- {
- return pushY(ResizeConstraint.WEIGHT_100);
- }
-
- /** Same functionality as {@link #setPushY(Float weight)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param weight The weight used in the push.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushY(Float)
- */
- public final CC pushY(Float weight)
- {
- setPushY(weight);
- return this;
- }
-
- /** Same functionality as {@link #setPushX(Float)} which means this cell will push the rest of the row.
- * This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushX(Float)
- */
- public final CC pushX()
- {
- return pushX(ResizeConstraint.WEIGHT_100);
- }
-
- /** Same functionality as {@link #setPushX(Float weight)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param weight The weight used in the push.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setPushY(Float)
- */
- public final CC pushX(Float weight)
- {
- setPushX(weight);
- return this;
- }
-
- /** Same functionality as {@link #setSplit(int parts)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param parts The number of parts (i.e. component slots) the cell should be divided into.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setSplit(int)
- */
- public final CC split(int parts)
- {
- setSplit(parts);
- return this;
- }
-
- /** Same functionality as split(LayoutUtil.INF), which means split until one of the keywords that breaks the split is found for
- * a component after this one (e.g. wrap, newline and skip).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setSplit(int)
- * @since 3.7.2
- */
- public final CC split()
- {
- setSplit(LayoutUtil.INF);
- return this;
- }
-
- /** Same functionality as {@link #setSkip(int)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells How many cells in the grid that should be skipped <b>before</b> the component that this constraint belongs to
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setSkip(int)
- */
- public final CC skip(int cells)
- {
- setSkip(cells);
- return this;
- }
-
- /** Same functionality as skip(1).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setSkip(int)
- * @since 3.7.2
- */
- public final CC skip()
- {
- setSkip(1);
- return this;
- }
-
- /** Same functionality as {@link #setExternal(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setExternal(boolean)
- */
- public final CC external()
- {
- setExternal(true);
- return this;
- }
-
- /** Same functionality as {@link #setFlowX(Boolean .TRUE)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setFlowX(Boolean)
- */
- public final CC flowX()
- {
- setFlowX(Boolean.TRUE);
- return this;
- }
-
- /** Same functionality as {@link #setFlowX(Boolean .FALSE)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setFlowX(Boolean)
- */
- public final CC flowY()
- {
- setFlowX(Boolean.FALSE);
- return this;
- }
-
-
- /** Same functionality as {@link #growX()} and {@link #growY()}.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #growX()
- * @see #growY()
- */
- public final CC grow()
- {
- growX();
- growY();
- return this;
- }
-
- /** Same functionality as {@link #setNewline(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setNewline(boolean)
- */
- public final CC newline()
- {
- setNewline(true);
- return this;
- }
-
- /** Same functionality as {@link #setNewlineGapSize(BoundSize)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param gapSize The gap size that will override the gap size in the row/colum constraints if <code>!= null</code>. E.g. "5px" or "unrel".
- * If <code>null</code> or <code>""</code> the newline size will be set to the default size and turned on. This is different compared to
- * {@link #setNewlineGapSize(BoundSize)}.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setNewlineGapSize(BoundSize)
- */
- public final CC newline(String gapSize)
- {
- BoundSize bs = ConstraintParser.parseBoundSize(gapSize, true, (flowX != null && flowX == false));
- if (bs != null) {
- setNewlineGapSize(bs);
- } else {
- setNewline(true);
- }
- return this;
- }
-
- /** Same functionality as {@link #setWrap(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setWrap(boolean)
- */
- public final CC wrap()
- {
- setWrap(true);
- return this;
- }
-
- /** Same functionality as {@link #setWrapGapSize(BoundSize)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param gapSize The gap size that will override the gap size in the row/colum constraints if <code>!= null</code>. E.g. "5px" or "unrel".
- * If <code>null</code> or <code>""</code> the wrap size will be set to the default size and turned on. This is different compared to
- * {@link #setWrapGapSize(BoundSize)}.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setWrapGapSize(BoundSize)
- */
- public final CC wrap(String gapSize)
- {
- BoundSize bs = ConstraintParser.parseBoundSize(gapSize, true, (flowX != null && flowX == false));
- if (bs != null) {
- setWrapGapSize(bs);
- } else {
- setWrap(true);
- }
- return this;
- }
-
- /** Same functionality as {@link #setDockSide(int 0)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setDockSide(int)
- */
- public final CC dockNorth()
- {
- setDockSide(0);
- return this;
- }
-
- /** Same functionality as {@link #setDockSide(int 1)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setDockSide(int)
- */
- public final CC dockWest()
- {
- setDockSide(1);
- return this;
- }
-
- /** Same functionality as {@link #setDockSide(int 2)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setDockSide(int)
- */
- public final CC dockSouth()
- {
- setDockSide(2);
- return this;
- }
-
- /** Same functionality as {@link #setDockSide(int 3)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setDockSide(int)
- */
- public final CC dockEast()
- {
- setDockSide(3);
- return this;
- }
-
- /** Sets the x-coordinate for the component. This is used to set the x coordinate position to a specific value. The component
- * bounds is still precalculated to the grid cell and this method should be seen as a way to correct the x position.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param x The x position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- * @see #setBoundsInGrid(boolean)
- */
- public final CC x(String x)
- {
- return corrPos(x, 0);
- }
-
- /** Sets the y-coordinate for the component. This is used to set the y coordinate position to a specific value. The component
- * bounds is still precalculated to the grid cell and this method should be seen as a way to correct the y position.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param y The y position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- * @see #setBoundsInGrid(boolean)
- */
- public final CC y(String y)
- {
- return corrPos(y, 1);
- }
-
- /** Sets the x2-coordinate for the component (right side). This is used to set the x2 coordinate position to a specific value. The component
- * bounds is still precalculated to the grid cell and this method should be seen as a way to correct the x position.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param x2 The x2 side's position as a UnitValue. E.g. "10" or "40mm" or "container.x2 - 10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- * @see #setBoundsInGrid(boolean)
- */
- public final CC x2(String x2)
- {
- return corrPos(x2, 2);
- }
-
- /** Sets the y2-coordinate for the component (bottom side). This is used to set the y2 coordinate position to a specific value. The component
- * bounds is still precalculated to the grid cell and this method should be seen as a way to correct the y position.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param y2 The y2 side's position as a UnitValue. E.g. "10" or "40mm" or "container.x2 - 10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- * @see #setBoundsInGrid(boolean)
- */
- public final CC y2(String y2)
- {
- return corrPos(y2, 3);
- }
-
- private final CC corrPos(String uv, int ix)
- {
- UnitValue[] b = getPos();
- if (b == null)
- b = new UnitValue[4];
-
- b[ix] = ConstraintParser.parseUnitValue(uv, (ix % 2 == 0));
- setPos(b);
-
- setBoundsInGrid(true);
- return this;
- }
-
- /** Same functionality as {@link #x(String x)} and {@link #y(String y)} toghether.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param x The x position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @param y The y position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- */
- public final CC pos(String x, String y)
- {
- UnitValue[] b = getPos();
- if (b == null)
- b = new UnitValue[4];
-
- b[0] = ConstraintParser.parseUnitValue(x, true);
- b[1] = ConstraintParser.parseUnitValue(y, false);
- setPos(b);
-
- setBoundsInGrid(false);
- return this;
- }
-
- /** Same functionality as {@link #x(String x)}, {@link #y(String y)}, {@link #y2(String y)} and {@link #y2(String y)} toghether.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param x The x position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @param y The y position as a UnitValue. E.g. "10" or "40mm" or "container.x+10".
- * @param x2 The x2 side's position as a UnitValue. E.g. "10" or "40mm" or "container.x2 - 10".
- * @param y2 The y2 side's position as a UnitValue. E.g. "10" or "40mm" or "container.x2 - 10".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setPos(UnitValue[])
- */
- public final CC pos(String x, String y, String x2, String y2)
- {
- setPos(new UnitValue[] {
- ConstraintParser.parseUnitValue(x, true),
- ConstraintParser.parseUnitValue(y, false),
- ConstraintParser.parseUnitValue(x2, true),
- ConstraintParser.parseUnitValue(y2, false),
- });
- setBoundsInGrid(false);
- return this;
- }
-
- /** Same functionality as {@link #setPadding(UnitValue[])} but the unit values as absolute pixels. This method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param top The top padding that will be added to the y coordinate at the last stage in the layout.
- * @param left The top padding that will be added to the x coordinate at the last stage in the layout.
- * @param bottom The top padding that will be added to the y2 coordinate at the last stage in the layout.
- * @param right The top padding that will be added to the x2 coordinate at the last stage in the layout.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setTag(String)
- */
- public final CC pad(int top, int left, int bottom, int right)
- {
- setPadding(new UnitValue[] {
- new UnitValue(top), new UnitValue(left), new UnitValue(bottom), new UnitValue(right)
- });
- return this;
- }
-
- /** Same functionality as <code>setPadding(ConstraintParser.parseInsets(pad, false))}</code> only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param pad The string to parse. E.g. "10 10 10 10" or "20". If less than 4 groups the last will be used for the missing.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new ComponentConstraint().noGrid().gap().fill()</code>.
- * @see #setTag(String)
- */
- public final CC pad(String pad)
- {
- setPadding(pad != null ? ConstraintParser.parseInsets(pad, false) : null);
- return this;
- }
-
- // **********************************************************
- // Bean properties
- // **********************************************************
-
- /** Returns the horizontal dimension constraint for this component constraint. It has constraints for the horizontal size
- * and grow/shink priorities and weights.
- * <p>
- * Note! If any changes is to be made it must be made direct when the object is returned. It is not allowed to save the
- * constraint for later use.
- * @return The current dimension constraint. Never <code>null</code>.
- */
- public DimConstraint getHorizontal()
- {
- return hor;
- }
-
- /** Sets the horizontal dimension constraint for this component constraint. It has constraints for the horizontal size
- * and grow/shrink priorities and weights.
- * @param h The new dimension constraint. If <code>null</code> it will be reset to <code>new DimConstraint();</code>
- */
- public void setHorizontal(DimConstraint h)
- {
- hor = h != null ? h : new DimConstraint();
- }
-
- /** Returns the vertical dimension constraint for this component constraint. It has constraints for the vertical size
- * and grow/shrink priorities and weights.
- * <p>
- * Note! If any changes is to be made it must be made direct when the object is returned. It is not allowed to save the
- * constraint for later use.
- * @return The current dimension constraint. Never <code>null</code>.
- */
- public DimConstraint getVertical()
- {
- return ver;
- }
-
- /** Sets the vertical dimension constraint for this component constraint. It has constraints for the vertical size
- * and grow/shrink priorities and weights.
- * @param v The new dimension constraint. If <code>null</code> it will be reset to <code>new DimConstraint();</code>
- */
- public void setVertical(DimConstraint v)
- {
- ver = v != null ? v : new DimConstraint();
- }
-
- /** Returns the vertical or horizontal dim constraint.
- * <p>
- * Note! If any changes is to be made it must be made direct when the object is returned. It is not allowed to save the
- * constraint for later use.
- * @param isHor If the horizontal constraint should be returned.
- * @return The dim constraint. Never <code>null</code>.
- */
- public DimConstraint getDimConstraint(boolean isHor)
- {
- return isHor ? hor : ver;
- }
-
- /** Returns the absolute positioning of one or more of the edges. This will be applied last in the layout cycle and will not
- * affect the flow or grid positions. The positioning is relative to the parent and can not (as padding) be used
- * to adjust the edges relative to the old value. May be <code>null</code> and elements may be <code>null</code>.
- * <code>null</code> value(s) for the x2 and y2 will be interpreted as to keep the preferred size and thus the x1
- * and x2 will just absolutely positions the component.
- * <p>
- * Note that {@link #setBoundsInGrid(boolean)} changes the interpretation of thisproperty slightly.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value as a new array, free to modify.
- */
- public UnitValue[] getPos()
- {
- return pos != null ? new UnitValue[] {pos[0], pos[1], pos[2], pos[3]} : null;
- }
-
- /** Sets absolute positioning of one or more of the edges. This will be applied last in the layout cycle and will not
- * affect the flow or grid positions. The positioning is relative to the parent and can not (as padding) be used
- * to adjust the edges relative to the old value. May be <code>null</code> and elements may be <code>null</code>.
- * <code>null</code> value(s) for the x2 and y2 will be interpreted as to keep the preferred size and thus the x1
- * and x2 will just absolutely positions the component.
- * <p>
- * Note that {@link #setBoundsInGrid(boolean)} changes the interpretation of thisproperty slightly.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param pos <code>UnitValue[] {x, y, x2, y2}</code>. Must be <code>null</code> or of length 4. Elements can be <code>null</code>.
- */
- public void setPos(UnitValue[] pos)
- {
- this.pos = pos != null ? new UnitValue[] {pos[0], pos[1], pos[2], pos[3]} : null;
- linkTargets = null;
- }
-
- /** Returns if the absolute <code>pos</code> value should be corrections to the component that is in a normal cell. If <code>false</code>
- * the value of <code>pos</code> is truly absolute in that it will not affect the grid or have a default bounds in the grid.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- * @see #getPos()
- */
- public boolean isBoundsInGrid()
- {
- return boundsInGrid;
- }
-
- /** Sets if the absolute <code>pos</code> value should be corrections to the component that is in a normal cell. If <code>false</code>
- * the value of <code>pos</code> is truly absolute in that it will not affect the grid or have a default bounds in the grid.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> for bounds taken from the grid position. <code>false</code> is default.
- * @see #setPos(UnitValue[])
- */
- void setBoundsInGrid(boolean b)
- {
- this.boundsInGrid = b;
- }
-
- /** Returns the absolute cell position in the grid or <code>-1</code> if cell positioning is not used.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public int getCellX()
- {
- return cellX;
- }
-
- /** Set an absolute cell x-position in the grid. If >= 0 this point points to the absolute cell that this constaint's component should occupy.
- * If there's already a component in that cell they will split the cell. The flow will then continue after this cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param x The x-position or <code>-1</code> to disable cell positioning.
- */
- public void setCellX(int x)
- {
- cellX = x;
- }
-
- /** Returns the absolute cell position in the grid or <code>-1</code> if cell positioning is not used.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public int getCellY()
- {
- return cellX < 0 ? -1 : cellY;
- }
-
- /** Set an absolute cell x-position in the grid. If >= 0 this point points to the absolute cell that this constaint's component should occupy.
- * If there's already a component in that cell they will split the cell. The flow will then continue after this cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param y The y-position or <code>-1</code> to disable cell positioning.
- */
- public void setCellY(int y)
- {
- if (y < 0)
- cellX = -1;
- cellY = y < 0 ? 0 : y;
- }
-
- /** Sets the docking side. -1 means no docking.<br>
- * Valid sides are: <code> north = 0, west = 1, south = 2, east = 3</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current side.
- */
- public int getDockSide()
- {
- return dock;
- }
-
- /** Sets the docking side. -1 means no docking.<br>
- * Valid sides are: <code> north = 0, west = 1, south = 2, east = 3</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param side -1 or 0-3.
- */
- public void setDockSide(int side)
- {
- if (side < -1 || side > 3)
- throw new IllegalArgumentException("Illegal dock side: " + side);
- dock = side;
- }
-
- /** Returns if this component should have its bounds handled by an external source and not this layout manager.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public boolean isExternal()
- {
- return external;
- }
-
- /** If this boolean is true this component is not handled in any way by the layout manager and the component can have its bounds set by an external
- * handler which is normally by the use of some <code>component.setBounds(x, y, width, height)</code> directly (for Swing).
- * <p>
- * The bounds <b>will not</b> affect the minimum and preferred size of the container.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> means that the bounds are not changed.
- */
- public void setExternal(boolean b)
- {
- this.external = b;
- }
-
- /** Returns if the flow in the <b>cell</b> is in the horizontal dimension. Vertical if <code>false</code>. Only the first
- * component is a cell can set the flow.
- * <p>
- * If <code>null</code> the flow direction is inherited by from the {@link net.miginfocom.layout.LC}.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public Boolean getFlowX()
- {
- return flowX;
- }
-
- /** Sets if the flow in the <b>cell</b> is in the horizontal dimension. Vertical if <code>false</code>. Only the first
- * component is a cell can set the flow.
- * <p>
- * If <code>null</code> the flow direction is inherited by from the {@link net.miginfocom.layout.LC}.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>Boolean.TRUE</code> means horizontal flow in the cell.
- */
- public void setFlowX(Boolean b)
- {
- this.flowX = b;
- }
-
- /** Sets how a component that is hidden (not visible) should be treated by default.
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The mode:<br>
- * 0 == Normal. Bounds will be calculated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- */
- public int getHideMode()
- {
- return hideMode;
- }
-
- /** Sets how a component that is hidden (not visible) should be treated by default.
- * @param mode The mode:<br>
- * 0 == Normal. Bounds will be calculated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- */
- public void setHideMode(int mode)
- {
- if (mode < -1 || mode > 3)
- throw new IllegalArgumentException("Wrong hideMode: " + mode);
-
- hideMode = mode;
- }
-
- /** Returns the id used to reference this component in some constraints.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The id or <code>null</code>. May consist of a groupID and an componentID which are separated by a dot: ".". E.g. "grp1.id1".
- * The dot should never be first or last if present.
- */
- public String getId()
- {
- return id;
- }
-
- /** Sets the id used to reference this component in some constraints.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param id The id or <code>null</code>. May consist of a groupID and an componentID which are separated by a dot: ".". E.g. "grp1.id1".
- * The dot should never be first or last if present.
- */
- public void setId(String id)
- {
- this.id = id;
- }
-
- /** Returns the absolute resizing in the last stage of the layout cycle. May be <code>null</code> and elements may be <code>null</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value. <code>null</code> or of length 4.
- */
- public UnitValue[] getPadding()
- {
- return padding != null ? new UnitValue[] {padding[0], padding[1], padding[2], padding[3]} : null;
- }
-
- /** Sets the absolute resizing in the last stage of the layout cycle. These values are added to the edges and can thus for
- * instance be used to grow or reduce the size or move the component an absolute number of pixels. May be <code>null</code>
- * and elements may be <code>null</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param sides top, left, bottom right. Must be <code>null</code> or of length 4.
- */
- public void setPadding(UnitValue[] sides)
- {
- this.padding = sides != null ? new UnitValue[] {sides[0], sides[1], sides[2], sides[3]} : null;
- }
-
- /** Returns how many cells in the grid that should be skipped <b>before</b> the component that this constraint belongs to.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value. 0 if no skip.
- */
- public int getSkip()
- {
- return skip;
- }
-
- /** Sets how many cells in the grid that should be skipped <b>before</b> the component that this constraint belongs to.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells How many cells in the grid that should be skipped <b>before</b> the component that this constraint belongs to
- */
- public void setSkip(int cells)
- {
- this.skip = cells;
- }
-
- /** Returns the number of cells the cell that this constraint's component will span in the indicated dimension. <code>1</code> is default and
- * means that it only spans the current cell. <code>LayoutUtil.INF</code> is used to indicate a span to the end of the column/row.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public int getSpanX()
- {
- return spanX;
- }
-
- /** Sets the number of cells the cell that this constraint's component will span in the indicated dimension. <code>1</code> is default and
- * means that it only spans the current cell. <code>LayoutUtil.INF</code> is used to indicate a span to the end of the column/row.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells The number of cells to span (i.e. merge).
- */
- public void setSpanX(int cells)
- {
- this.spanX = cells;
- }
-
- /** Returns the number of cells the cell that this constraint's component will span in the indicated dimension. <code>1</code> is default and
- * means that it only spans the current cell. <code>LayoutUtil.INF</code> is used to indicate a span to the end of the column/row.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public int getSpanY()
- {
- return spanY;
- }
-
- /** Sets the number of cells the cell that this constraint's component will span in the indicated dimension. <code>1</code> is default and
- * means that it only spans the current cell. <code>LayoutUtil.INF</code> is used to indicate a span to the end of the column/row.
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param cells The number of cells to span (i.e. merge).
- */
- public void setSpanY(int cells)
- {
- this.spanY = cells;
- }
-
- /** "pushx" indicates that the column that this component is in (this first if the component spans) should default to growing.
- * If any other column has been set to grow this push value on the component does nothing as the column's explicit grow weight
- * will take precedence. Push is normally used when the grid has not been defined in the layout.
- * <p>
- * If multiple components in a column has push weights set the largest one will be used for the column.
- * @return The current push value. Default is <code>null</code>.
- */
- public Float getPushX()
- {
- return pushX;
- }
-
- /** "pushx" indicates that the column that this component is in (this first if the component spans) should default to growing.
- * If any other column has been set to grow this push value on the component does nothing as the column's explicit grow weight
- * will take precedence. Push is normally used when the grid has not been defined in the layout.
- * <p>
- * If multiple components in a column has push weights set the largest one will be used for the column.
- * @param weight The new push value. Default is <code>null</code>.
- */
- public void setPushX(Float weight)
- {
- this.pushX = weight;
- }
-
- /** "pushx" indicates that the row that this component is in (this first if the component spans) should default to growing.
- * If any other row has been set to grow this push value on the component does nothing as the row's explicit grow weight
- * will take precedence. Push is normally used when the grid has not been defined in the layout.
- * <p>
- * If multiple components in a row has push weights set the largest one will be used for the row.
- * @return The current push value. Default is <code>null</code>.
- */
- public Float getPushY()
- {
- return pushY;
- }
-
- /** "pushx" indicates that the row that this component is in (this first if the component spans) should default to growing.
- * If any other row has been set to grow this push value on the component does nothing as the row's explicit grow weight
- * will take precedence. Push is normally used when the grid has not been defined in the layout.
- * <p>
- * If multiple components in a row has push weights set the largest one will be used for the row.
- * @param weight The new push value. Default is <code>null</code>.
- */
- public void setPushY(Float weight)
- {
- this.pushY = weight;
- }
-
- /** Returns in how many parts the current cell (that this constraint's component will be in) should be split in. If for instance
- * it is split in two, the next component will also share the same cell. Note that the cell can also span a number of
- * cells, which means that you can for instance span three cells and split that big cell for two components. Split can be
- * set to a very high value to make all components in the same row/column share the same cell (e.g. <code>LayoutUtil.INF</code>).
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public int getSplit()
- {
- return split;
- }
-
- /** Sets in how many parts the current cell (that this constraint's component will be in) should be split in. If for instance
- * it is split in two, the next component will also share the same cell. Note that the cell can also span a number of
- * cells, which means that you can for instance span three cells and split that big cell for two components. Split can be
- * set to a very high value to make all components in the same row/column share the same cell (e.g. <code>LayoutUtil.INF</code>).
- * <p>
- * Note that only the first component will be checked for this property.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param parts The number of parts (i.e. component slots) the cell should be divided into.
- */
- public void setSplit(int parts)
- {
- this.split = parts;
- }
-
- /** Tags the component with metadata. Currently only used to tag buttons with for instance "cancel" or "ok" to make them
- * show up in the correct order depending on platform. See {@link PlatformDefaults#setButtonOrder(String)} for information.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value. May be <code>null</code>.
- */
- public String getTag()
- {
- return tag;
- }
-
- /** Optinal tag that gives more context to this constraint's component. It is for instance used to tag buttons in a
- * button bar with the button type such as "ok", "help" or "cancel".
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param tag The new tag. May be <code>null</code>.
- */
- public void setTag(String tag)
- {
- this.tag = tag;
- }
-
- /** Returns if the flow should wrap to the next line/column <b>after</b> the component that this constraint belongs to.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public boolean isWrap()
- {
- return wrap != null;
- }
-
- /** Sets if the flow should wrap to the next line/column <b>after</b> the component that this constraint belongs to.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> means wrap after.
- */
- public void setWrap(boolean b)
- {
- wrap = b ? (wrap == null ? DEF_GAP : wrap) : null;
- }
-
- /** Returns the wrap size if it is a custom size. If wrap was set to true with {@link #setWrap(boolean)} then this method will
- * return <code>null</code> since that means that the gap size should be the default one as defined in the rows spec.
- * @return The custom gap size. NOTE! Will return <code>null</code> for both no wrap <b>and</b> default wrap.
- * @see #isWrap()
- * @see #setWrap(boolean)
- * @since 2.4.2
- */
- public BoundSize getWrapGapSize()
- {
- return wrap == DEF_GAP ? null : wrap;
- }
-
- /** Set the wrap size and turns wrap on if <code>!= null</code>.
- * @param s The custom gap size. NOTE! <code>null</code> will not turn on or off wrap, it will only set the wrap gap size to "default".
- * A non-null value will turn on wrap though.
- * @see #isWrap()
- * @see #setWrap(boolean)
- * @since 2.4.2
- */
- public void setWrapGapSize(BoundSize s)
- {
- wrap = s == null ? (wrap != null ? DEF_GAP : null) : s;
- }
-
- /** Returns if the flow should wrap to the next line/column <b>before</b> the component that this constraint belongs to.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current value.
- */
- public boolean isNewline()
- {
- return newline != null;
- }
-
- /** Sets if the flow should wrap to the next line/column <b>before</b> the component that this constraint belongs to.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> means wrap before.
- */
- public void setNewline(boolean b)
- {
- newline = b ? (newline == null ? DEF_GAP : newline) : null;
- }
-
- /** Returns the newline size if it is a custom size. If newline was set to true with {@link #setNewline(boolean)} then this method will
- * return <code>null</code> since that means that the gap size should be the default one as defined in the rows spec.
- * @return The custom gap size. NOTE! Will return <code>null</code> for both no newline <b>and</b> default newline.
- * @see #isNewline()
- * @see #setNewline(boolean)
- * @since 2.4.2
- */
- public BoundSize getNewlineGapSize()
- {
- return newline == DEF_GAP ? null : newline;
- }
-
- /** Set the newline size and turns newline on if <code>!= null</code>.
- * @param s The custom gap size. NOTE! <code>null</code> will not turn on or off newline, it will only set the newline gap size to "default".
- * A non-null value will turn on newline though.
- * @see #isNewline()
- * @see #setNewline(boolean)
- * @since 2.4.2
- */
- public void setNewlineGapSize(BoundSize s)
- {
- newline = s == null ? (newline != null ? DEF_GAP : null) : s;
- }
-
- // ************************************************
- // 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() == CC.class)
- LayoutUtil.writeAsXML(out, this);
- }
-}
\ No newline at end of file
[08/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/Grid.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/Grid.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/Grid.java
deleted file mode 100644
index ea7fa0a..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/Grid.java
+++ /dev/null
@@ -1,2350 +0,0 @@
-package net.miginfocom.layout;
-
-
-import java.util.*;
-/*
- * 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
- */
-
-/** Holds components in a grid. Does most of the logic behind the layout manager.
- */
-public final class Grid
-{
- public static final boolean TEST_GAPS = true;
-
- private static final Float[] GROW_100 = new Float[] {ResizeConstraint.WEIGHT_100};
-
- private static final DimConstraint DOCK_DIM_CONSTRAINT = new DimConstraint();
- static {
- DOCK_DIM_CONSTRAINT.setGrowPriority(0);
- }
-
- /** This is the maximum grid position for "normal" components. Docking components use the space out to
- * <code>MAX_DOCK_GRID</code> and below 0.
- */
- private static final int MAX_GRID = 30000;
-
- /** Docking components will use the grid coordinates <code>-MAX_DOCK_GRID -> 0</code> and <code>MAX_GRID -> MAX_DOCK_GRID</code>.
- */
- private static final int MAX_DOCK_GRID = 32767;
-
- /** A constraint used for gaps.
- */
- private static final ResizeConstraint GAP_RC_CONST = new ResizeConstraint(200, ResizeConstraint.WEIGHT_100, 50, null);
- private static final ResizeConstraint GAP_RC_CONST_PUSH = new ResizeConstraint(200, ResizeConstraint.WEIGHT_100, 50, ResizeConstraint.WEIGHT_100);
-
- /** The constraints. Never <code>null</code>.
- */
- private final LC lc;
-
- /** The parent that is layout out and this grid is done for. Never <code>null</code>.
- */
- private final ContainerWrapper container;
-
- /** An x, y array implemented as a sparse array to accommodate for any grid size without wasting memory (or rather 15 bit (0-MAX_GRID * 0-MAX_GRID).
- */
- private final LinkedHashMap<Integer, Cell> grid = new LinkedHashMap<Integer, Cell>(); // [(y << 16) + x] -> Cell. null key for absolute positioned compwraps
-
- private HashMap<Integer, BoundSize> wrapGapMap = null; // Row or Column index depending in the dimension that "wraps". Normally row indexes but may be column indexes if "flowy". 0 means before first row/col.
-
- /** The size of the grid. Row count and column count.
- */
- private final TreeSet<Integer> rowIndexes = new TreeSet<Integer>(), colIndexes = new TreeSet<Integer>();
-
- /** The row and column specifications.
- */
- private final AC rowConstr, colConstr;
-
- /** The in the constructor calculated min/pref/max sizes of the rows and columns.
- */
- private FlowSizeSpec colFlowSpecs = null, rowFlowSpecs = null;
-
- /** Components that are connections in one dimension (such as baseline alignment for instance) are grouped together and stored here.
- * One for each row/column.
- */
- private final ArrayList<LinkedDimGroup>[] colGroupLists, rowGroupLists; //[(start)row/col number]
-
- /** The in the constructor calculated min/pref/max size of the whole grid.
- */
- private int[] width = null, height = null;
-
- /** If debug is on contains the bounds for things to paint when calling {@link ContainerWrapper#paintDebugCell(int, int, int, int)}
- */
- private ArrayList<int[]> debugRects = null; // [x, y, width, height]
-
- /** If any of the absolute coordinates for component bounds has links the name of the target is in this Set.
- * Since it requires some memory and computations this is checked at the creation so that
- * the link information is only created if needed later.
- * <p>
- * The boolean is true for groups id:s and null for normal id:s.
- */
- private HashMap<String, Boolean> linkTargetIDs = null;
-
- private final int dockOffY, dockOffX;
-
- private final Float[] pushXs, pushYs;
-
- private final ArrayList<LayoutCallback> callbackList;
-
- /** Constructor.
- * @param container The container that will be laid out.
- * @param lc The form flow constraints.
- * @param rowConstr The rows specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.
- * @param colConstr The columns specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.
- * @param ccMap The map containing the parsed constraints for each child component of <code>parent</code>. Will not be alterted.
- * @param callbackList A list of callbacks or <code>null</code> if none. Will not be alterted.
- */
- public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<ComponentWrapper, CC> ccMap, ArrayList<LayoutCallback> callbackList)
- {
- this.lc = lc;
- this.rowConstr = rowConstr;
- this.colConstr = colConstr;
- this.container = container;
- this.callbackList = callbackList;
-
- int wrap = lc.getWrapAfter() != 0 ? lc.getWrapAfter() : (lc.isFlowX() ? colConstr : rowConstr).getConstaints().length;
-
- final ComponentWrapper[] comps = container.getComponents();
-
- boolean hasTagged = false; // So we do not have to sort if it will not do any good
- boolean hasPushX = false, hasPushY = false;
- boolean hitEndOfRow = false;
- final int[] cellXY = new int[2];
- final ArrayList<int[]> spannedRects = new ArrayList<int[]>(2);
-
- final DimConstraint[] specs = (lc.isFlowX() ? rowConstr : colConstr).getConstaints();
-
- int sizeGroupsX = 0, sizeGroupsY = 0;
- int[] dockInsets = null; // top, left, bottom, right insets for docks.
-
- LinkHandler.clearTemporaryBounds(container.getLayout());
-
- for (int i = 0; i < comps.length;) {
- ComponentWrapper comp = comps[i];
- CC rootCc = getCC(comp, ccMap);
-
- addLinkIDs(rootCc);
-
- int hideMode = comp.isVisible() ? -1 : rootCc.getHideMode() != -1 ? rootCc.getHideMode() : lc.getHideMode();
-
- if (hideMode == 3) { // To work with situations where there are components that does not have a layout manager, or not this one.
- setLinkedBounds(comp, rootCc, comp.getX(), comp.getY(), comp.getWidth(), comp.getHeight(), rootCc.isExternal());
- i++;
- continue; // The "external" component should not be handled further.
- }
-
- if (rootCc.getHorizontal().getSizeGroup() != null)
- sizeGroupsX++;
- if (rootCc.getVertical().getSizeGroup() != null)
- sizeGroupsY++;
-
- // Special treatment of absolute positioned components.
- UnitValue[] pos = getPos(comp, rootCc);
- BoundSize[] cbSz = getCallbackSize(comp);
- if (pos != null || rootCc.isExternal()) {
-
- CompWrap cw = new CompWrap(comp, rootCc, hideMode, pos, cbSz);
- Cell cell = grid.get(null);
- if (cell == null) {
- grid.put(null, new Cell(cw));
- } else {
- cell.compWraps.add(cw);
- }
-
- if (rootCc.isBoundsInGrid() == false || rootCc.isExternal()) {
- setLinkedBounds(comp, rootCc, comp.getX(), comp.getY(), comp.getWidth(), comp.getHeight(), rootCc.isExternal());
- i++;
- continue;
- }
- }
-
- if (rootCc.getDockSide() != -1) {
- if (dockInsets == null)
- dockInsets = new int[] {-MAX_DOCK_GRID, -MAX_DOCK_GRID, MAX_DOCK_GRID, MAX_DOCK_GRID};
-
- addDockingCell(dockInsets, rootCc.getDockSide(), new CompWrap(comp, rootCc, hideMode, pos, cbSz));
- i++;
- continue;
- }
-
- Boolean cellFlowX = rootCc.getFlowX();
- Cell cell = null;
-
- if (rootCc.isNewline()) {
- wrap(cellXY, rootCc.getNewlineGapSize());
- } else if (hitEndOfRow) {
- wrap(cellXY, null);
- }
- hitEndOfRow = false;
-
- final boolean rowNoGrid = lc.isNoGrid() || ((DimConstraint) LayoutUtil.getIndexSafe(specs, lc.isFlowX() ? cellXY[1] : cellXY[0])).isNoGrid();
-
- // Move to a free y, x if no absolute grid specified
- int cx = rootCc.getCellX();
- int cy = rootCc.getCellY();
- if ((cx < 0 || cy < 0) && rowNoGrid == false && rootCc.getSkip() == 0) { // 3.7.2: If skip, don't find an empty cell first.
- while (isCellFree(cellXY[1], cellXY[0], spannedRects) == false) {
- if (Math.abs(increase(cellXY, 1)) >= wrap)
- wrap(cellXY, null);
- }
- } else {
- if (cx >= 0 && cy >= 0) {
- if (cy >= 0) {
- cellXY[0] = cx;
- cellXY[1] = cy;
- } else { // Only one coordinate is specified. Use the current row (flowx) or column (flowy) to fill in.
- if (lc.isFlowX()) {
- cellXY[0] = cx;
- } else {
- cellXY[1] = cx;
- }
- }
- }
- cell = getCell(cellXY[1], cellXY[0]); // Might be null
- }
-
- // Skip a number of cells. Changed for 3.6.1 to take wrap into account and thus "skip" to the next and possibly more rows.
- for (int s = 0, skipCount = rootCc.getSkip(); s < skipCount; s++) {
- do {
- if (Math.abs(increase(cellXY, 1)) >= wrap)
- wrap(cellXY, null);
- } while (isCellFree(cellXY[1], cellXY[0], spannedRects) == false);
- }
-
- // If cell is not created yet, create it and set it.
- if (cell == null) {
- int spanx = Math.min(rowNoGrid && lc.isFlowX() ? LayoutUtil.INF : rootCc.getSpanX(), MAX_GRID - cellXY[0]);
- int spany = Math.min(rowNoGrid && !lc.isFlowX() ? LayoutUtil.INF : rootCc.getSpanY(), MAX_GRID - cellXY[1]);
-
- cell = new Cell(spanx, spany, cellFlowX != null ? cellFlowX : lc.isFlowX());
-
- setCell(cellXY[1], cellXY[0], cell);
-
- // Add a rectangle so we can know that spanned cells occupy more space.
- if (spanx > 1 || spany > 1)
- spannedRects.add(new int[] {cellXY[0], cellXY[1], spanx, spany});
- }
-
- // Add the one, or all, components that split the grid position to the same Cell.
- boolean wrapHandled = false;
- int splitLeft = rowNoGrid ? LayoutUtil.INF : rootCc.getSplit() - 1;
- boolean splitExit = false;
- final boolean spanRestOfRow = (lc.isFlowX() ? rootCc.getSpanX() : rootCc.getSpanY()) == LayoutUtil.INF;
-
- for (; splitLeft >= 0 && i < comps.length; splitLeft--) {
- ComponentWrapper compAdd = comps[i];
- CC cc = getCC(compAdd, ccMap);
-
- addLinkIDs(cc);
-
- boolean visible = compAdd.isVisible();
- hideMode = visible ? -1 : cc.getHideMode() != -1 ? cc.getHideMode() : lc.getHideMode();
-
- if (cc.isExternal() || hideMode == 3) {
- i++;
- splitLeft++; // Added for 3.5.5 so that these components does not "take" a split slot.
- continue; // To work with situations where there are components that does not have a layout manager, or not this one.
- }
-
- hasPushX |= (visible || hideMode > 1) && (cc.getPushX() != null);
- hasPushY |= (visible || hideMode > 1) && (cc.getPushY() != null);
-
- if (cc != rootCc) { // If not first in a cell
- if (cc.isNewline() || cc.isBoundsInGrid() == false || cc.getDockSide() != -1)
- break;
-
- if (splitLeft > 0 && cc.getSkip() > 0) {
- splitExit = true;
- break;
- }
-
- pos = getPos(compAdd, cc);
- cbSz = getCallbackSize(compAdd);
- }
-
- CompWrap cw = new CompWrap(compAdd, cc, hideMode, pos, cbSz);
- cell.compWraps.add(cw);
- cell.hasTagged |= cc.getTag() != null;
- hasTagged |= cell.hasTagged;
-
- if (cc != rootCc) {
- if (cc.getHorizontal().getSizeGroup() != null)
- sizeGroupsX++;
- if (cc.getVertical().getSizeGroup() != null)
- sizeGroupsY++;
- }
-
- i++;
-
- if ((cc.isWrap() || (spanRestOfRow && splitLeft == 0))) {
- if (cc.isWrap()) {
- wrap(cellXY, cc.getWrapGapSize());
- } else {
- hitEndOfRow = true;
- }
- wrapHandled = true;
- break;
- }
- }
-
- if (wrapHandled == false && rowNoGrid == false) {
- int span = lc.isFlowX() ? cell.spanx : cell.spany;
- if (Math.abs((lc.isFlowX() ? cellXY[0] : cellXY[1])) + span >= wrap) {
- hitEndOfRow = true;
- } else {
- increase(cellXY, splitExit ? span - 1 : span);
- }
- }
- }
-
- // If there were size groups, calculate the largest values in the groups (for min/pref/max) and enforce them on the rest in the group.
- if (sizeGroupsX > 0 || sizeGroupsY > 0) {
- HashMap<String, int[]> sizeGroupMapX = sizeGroupsX > 0 ? new HashMap<String, int[]>(sizeGroupsX) : null;
- HashMap<String, int[]> sizeGroupMapY = sizeGroupsY > 0 ? new HashMap<String, int[]>(sizeGroupsY) : null;
- ArrayList<CompWrap> sizeGroupCWs = new ArrayList<CompWrap>(Math.max(sizeGroupsX, sizeGroupsY));
-
- for (Cell cell : grid.values()) {
- for (int i = 0; i < cell.compWraps.size(); i++) {
- CompWrap cw = cell.compWraps.get(i);
- String sgx = cw.cc.getHorizontal().getSizeGroup();
- String sgy = cw.cc.getVertical().getSizeGroup();
-
- if (sgx != null || sgy != null) {
- if (sgx != null && sizeGroupMapX != null)
- addToSizeGroup(sizeGroupMapX, sgx, cw.horSizes);
- if (sgy != null && sizeGroupMapY != null)
- addToSizeGroup(sizeGroupMapY, sgy, cw.verSizes);
- sizeGroupCWs.add(cw);
- }
- }
- }
-
- // Set/equalize the sizeGroups to same the values.
- for (CompWrap cw : sizeGroupCWs) {
- if (sizeGroupMapX != null)
- cw.setSizes(sizeGroupMapX.get(cw.cc.getHorizontal().getSizeGroup()), true); // Target method handles null sizes
- if (sizeGroupMapY != null)
- cw.setSizes(sizeGroupMapY.get(cw.cc.getVertical().getSizeGroup()), false); // Target method handles null sizes
- }
- } // Component loop
-
- // If there were size groups, calculate the largest values in the groups (for min/pref/max) and enforce them on the rest in the group.
- if (sizeGroupsX > 0 || sizeGroupsY > 0) {
- HashMap<String, int[]> sizeGroupMapX = sizeGroupsX > 0 ? new HashMap<String, int[]>(sizeGroupsX) : null;
- HashMap<String, int[]> sizeGroupMapY = sizeGroupsY > 0 ? new HashMap<String, int[]>(sizeGroupsY) : null;
- ArrayList<CompWrap> sizeGroupCWs = new ArrayList<CompWrap>(Math.max(sizeGroupsX, sizeGroupsY));
-
- for (Cell cell : grid.values()) {
- for (int i = 0; i < cell.compWraps.size(); i++) {
- CompWrap cw = cell.compWraps.get(i);
- String sgx = cw.cc.getHorizontal().getSizeGroup();
- String sgy = cw.cc.getVertical().getSizeGroup();
-
- if (sgx != null || sgy != null) {
- if (sgx != null && sizeGroupMapX != null)
- addToSizeGroup(sizeGroupMapX, sgx, cw.horSizes);
- if (sgy != null && sizeGroupMapY != null)
- addToSizeGroup(sizeGroupMapY, sgy, cw.verSizes);
- sizeGroupCWs.add(cw);
- }
- }
- }
-
- // Set/equalize the sizeGroups to same the values.
- for (CompWrap cw : sizeGroupCWs) {
- if (sizeGroupMapX != null)
- cw.setSizes(sizeGroupMapX.get(cw.cc.getHorizontal().getSizeGroup()), true); // Target method handles null sizes
- if (sizeGroupMapY != null)
- cw.setSizes(sizeGroupMapY.get(cw.cc.getVertical().getSizeGroup()), false); // Target method handles null sizes
- }
- }
-
- if (hasTagged)
- sortCellsByPlatform(grid.values(), container);
-
- // Calculate gaps now that the cells are filled and we know all adjacent components.
- boolean ltr = LayoutUtil.isLeftToRight(lc, container);
- for (Cell cell : grid.values()) {
- ArrayList<CompWrap> cws = cell.compWraps;
-
- for (int i = 0, lastI = cws.size() - 1; i <= lastI; i++) {
- CompWrap cw = cws.get(i);
- ComponentWrapper cwBef = i > 0 ? cws.get(i - 1).comp : null;
- ComponentWrapper cwAft = i < lastI ? cws.get(i + 1).comp : null;
-
- String tag = getCC(cw.comp, ccMap).getTag();
- CC ccBef = cwBef != null ? getCC(cwBef, ccMap) : null;
- CC ccAft = cwAft != null ? getCC(cwAft, ccMap) : null;
-
- cw.calcGaps(cwBef, ccBef, cwAft, ccAft, tag, cell.flowx, ltr);
- }
- }
-
- dockOffX = getDockInsets(colIndexes);
- dockOffY = getDockInsets(rowIndexes);
-
- // Add synthetic indexes for empty rows and columns so they can get a size
- for (int i = 0, iSz = rowConstr.getCount(); i < iSz; i++)
- rowIndexes.add(i);
- for (int i = 0, iSz = colConstr.getCount(); i < iSz; i++)
- colIndexes.add(i);
-
- colGroupLists = divideIntoLinkedGroups(false);
- rowGroupLists = divideIntoLinkedGroups(true);
-
- pushXs = hasPushX || lc.isFillX() ? getDefaultPushWeights(false) : null;
- pushYs = hasPushY || lc.isFillY() ? getDefaultPushWeights(true) : null;
-
- if (LayoutUtil.isDesignTime(container))
- saveGrid(container, grid);
- }
-
- private static CC getCC(ComponentWrapper comp, Map<ComponentWrapper, CC> ccMap)
- {
- CC cc = ccMap.get(comp);
- return cc != null ? cc : new CC();
- }
-
- private void addLinkIDs(CC cc)
- {
- String[] linkIDs = cc.getLinkTargets();
- for (String linkID : linkIDs) {
- if (linkTargetIDs == null)
- linkTargetIDs = new HashMap<String, Boolean>();
- linkTargetIDs.put(linkID, null);
- }
- }
-
- /** If the container (parent) that this grid is laying out has changed its bounds, call this method to
- * clear any cached values.
- */
- public void invalidateContainerSize()
- {
- colFlowSpecs = null;
- }
-
- /** Does the actual layout. Uses many values calculated in the constructor.
- * @param bounds The bounds to layout against. Normally that of the parent. [x, y, width, height].
- * @param alignX The alignment for the x-axis.
- * @param alignY The alignment for the y-axis.
- * @param debug If debug information should be saved in {@link #debugRects}.
- * @param checkPrefChange If a check should be done to see if the setting of any new bounds changes the preferred size
- * of a component.
- * @return If the layout has probably changed the preferred size and there is need for a new layout (normally only SWT).
- */
- public boolean layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean checkPrefChange)
- {
- if (debug)
- debugRects = new ArrayList<int[]>();
-
- checkSizeCalcs();
-
- resetLinkValues(true, true);
-
- layoutInOneDim(bounds[2], alignX, false, pushXs);
- layoutInOneDim(bounds[3], alignY, true, pushYs);
-
- HashMap<String, Integer> endGrpXMap = null, endGrpYMap = null;
- int compCount = container.getComponentCount();
-
- // Transfer the calculated bound from the ComponentWrappers to the actual Components.
- boolean layoutAgain = false;
- if (compCount > 0) {
- for (int j = 0; j < (linkTargetIDs != null ? 2 : 1); j++) { // First do the calculations (maybe more than once) then set the bounds when done
- boolean doAgain;
- int count = 0;
- do {
- doAgain = false;
- for (Cell cell : grid.values()) {
- ArrayList<CompWrap> compWraps = cell.compWraps;
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
-
- if (j == 0) {
- doAgain |= doAbsoluteCorrections(cw, bounds);
- if (doAgain == false) { // If we are going to do this again, do not bother this time around
- if (cw.cc.getHorizontal().getEndGroup() != null)
- endGrpXMap = addToEndGroup(endGrpXMap, cw.cc.getHorizontal().getEndGroup(), cw.x + cw.w);
- if (cw.cc.getVertical().getEndGroup() != null)
- endGrpYMap = addToEndGroup(endGrpYMap, cw.cc.getVertical().getEndGroup(), cw.y + cw.h);
- }
-
- // @since 3.7.2 Needed or absolute "pos" pointing to "visual" or "container" didn't work if
- // their bounds changed during the layout cycle. At least not in SWT.
- if (linkTargetIDs != null && (linkTargetIDs.containsKey("visual") || linkTargetIDs.containsKey("container")))
- layoutAgain = true;
- }
-
- if (linkTargetIDs == null || j == 1) {
- if (cw.cc.getHorizontal().getEndGroup() != null)
- cw.w = endGrpXMap.get(cw.cc.getHorizontal().getEndGroup()) - cw.x;
- if (cw.cc.getVertical().getEndGroup() != null)
- cw.h = endGrpYMap.get(cw.cc.getVertical().getEndGroup()) - cw.y;
-
- cw.x += bounds[0];
- cw.y += bounds[1];
- layoutAgain |= cw.transferBounds(checkPrefChange && !layoutAgain);
-
- if (callbackList != null) {
- for (LayoutCallback callback : callbackList)
- callback.correctBounds(cw.comp);
- }
- }
- }
- }
- clearGroupLinkBounds();
- if (++count > ((compCount << 3) + 10)) {
- System.err.println("Unstable cyclic dependency in absolute linked values!");
- break;
- }
-
- } while (doAgain);
- }
- }
-
- // Add debug shapes for the "cells". Use the CompWraps as base for inding the cells.
- if (debug) {
- for (Cell cell : grid.values()) {
- ArrayList<CompWrap> compWraps = cell.compWraps;
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
- LinkedDimGroup hGrp = getGroupContaining(colGroupLists, cw);
- LinkedDimGroup vGrp = getGroupContaining(rowGroupLists, cw);
-
- if (hGrp != null && vGrp != null)
- debugRects.add(new int[]{hGrp.lStart + bounds[0] - (hGrp.fromEnd ? hGrp.lSize : 0), vGrp.lStart + bounds[1] - (vGrp.fromEnd ? vGrp.lSize : 0), hGrp.lSize, vGrp.lSize});
- }
- }
- }
- return layoutAgain;
- }
-
- public void paintDebug()
- {
- if (debugRects != null) {
- container.paintDebugOutline();
-
- ArrayList<int[]> painted = new ArrayList<int[]>();
- for (int i = 0, iSz = debugRects.size(); i < iSz; i++) {
- int[] r = debugRects.get(i);
- if (painted.contains(r) == false) {
- container.paintDebugCell(r[0], r[1], r[2], r[3]);
- painted.add(r);
- }
- }
-
- for (Cell cell : grid.values()) {
- ArrayList<CompWrap> compWraps = cell.compWraps;
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++)
- compWraps.get(i).comp.paintDebugOutline();
- }
- }
- }
-
- public ContainerWrapper getContainer()
- {
- return container;
- }
-
- public final int[] getWidth()
- {
- checkSizeCalcs();
- return width.clone();
- }
-
- public final int[] getHeight()
- {
- checkSizeCalcs();
- return height.clone();
- }
-
- private void checkSizeCalcs()
- {
- if (colFlowSpecs == null) {
-
- colFlowSpecs = calcRowsOrColsSizes(true);
- rowFlowSpecs = calcRowsOrColsSizes(false);
-
- width = getMinPrefMaxSumSize(true);
- height = getMinPrefMaxSumSize(false);
-
- if (linkTargetIDs == null) {
- resetLinkValues(false, true);
- } else {
- // This call makes some components flicker on SWT. They get their bounds changed twice since
- // the change might affect the absolute size adjustment below. There's no way around this that
- // I know of.
- layout(new int[4], null, null, false, false);
- resetLinkValues(false, false);
- }
-
- adjustSizeForAbsolute(true);
- adjustSizeForAbsolute(false);
- }
- }
-
- private UnitValue[] getPos(ComponentWrapper cw, CC cc)
- {
- UnitValue[] cbPos = null;
- if (callbackList != null) {
- for (int i = 0; i < callbackList.size() && cbPos == null; i++)
- cbPos = callbackList.get(i).getPosition(cw); // NOT a copy!
- }
-
- // If one is null, return the other (which many also be null)
- UnitValue[] ccPos = cc.getPos(); // A copy!!
- if (cbPos == null || ccPos == null)
- return cbPos != null ? cbPos : ccPos;
-
- // Merge
- for (int i = 0; i < 4; i++) {
- UnitValue cbUv = cbPos[i];
- if (cbUv != null)
- ccPos[i] = cbUv;
- }
-
- return ccPos;
- }
-
- private BoundSize[] getCallbackSize(ComponentWrapper cw)
- {
- if (callbackList != null) {
- for (LayoutCallback callback : callbackList) {
- BoundSize[] bs = callback.getSize(cw); // NOT a copy!
- if (bs != null)
- return bs;
- }
- }
- return null;
- }
-
- private static int getDockInsets(TreeSet<Integer> set)
- {
- int c = 0;
- for (Integer i : set) {
- if (i < -MAX_GRID) {
- c++;
- } else {
- break; // Since they are sorted we can break
- }
- }
- return c;
- }
-
- /**
- * @param cw Never <code>null</code>.
- * @param cc Never <code>null</code>.
- * @param external The bounds should be stored even if they are not in {@link #linkTargetIDs}.
- * @return If a change has been made.
- */
- private boolean setLinkedBounds(ComponentWrapper cw, CC cc, int x, int y, int w, int h, boolean external)
- {
- String id = cc.getId() != null ? cc.getId() : cw.getLinkId();
- if (id == null)
- return false;
-
- String gid = null;
- int grIx = id.indexOf('.');
- if (grIx != -1 ) {
- gid = id.substring(0, grIx);
- id = id.substring(grIx + 1);
- }
-
- Object lay = container.getLayout();
- boolean changed = false;
- if (external || (linkTargetIDs != null && linkTargetIDs.containsKey(id)))
- changed = LinkHandler.setBounds(lay, id, x, y, w, h, !external, false);
-
- if (gid != null && (external || (linkTargetIDs != null && linkTargetIDs.containsKey(gid)))) {
- if (linkTargetIDs == null)
- linkTargetIDs = new HashMap<String, Boolean>(4);
-
- linkTargetIDs.put(gid, Boolean.TRUE);
- changed |= LinkHandler.setBounds(lay, gid, x, y, w, h, !external, true);
- }
-
- return changed;
- }
-
- /** Go to next cell.
- * @param p The point to increase
- * @param cnt How many cells to advance.
- * @return The new value in the "incresing" dimension.
- */
- private int increase(int[] p, int cnt)
- {
- return lc.isFlowX() ? (p[0] += cnt) : (p[1] += cnt);
- }
-
- /** Wraps to the next row or column depending on if horizontal flow or vertical flow is used.
- * @param cellXY The point to wrap and thus set either x or y to 0 and increase the other one.
- * @param gapSize The gaps size specified in a "wrap XXX" or "newline XXX" or <code>null</code> if none.
- */
- private void wrap(int[] cellXY, BoundSize gapSize)
- {
- boolean flowx = lc.isFlowX();
- cellXY[0] = flowx ? 0 : cellXY[0] + 1;
- cellXY[1] = flowx ? cellXY[1] + 1 : 0;
-
- if (gapSize != null) {
- if (wrapGapMap == null)
- wrapGapMap = new HashMap<Integer, BoundSize>(8);
-
- wrapGapMap.put(cellXY[flowx ? 1 : 0], gapSize);
- }
-
- // add the row/column so that the gap in the last row/col will not be removed.
- if (flowx) {
- rowIndexes.add(cellXY[1]);
- } else {
- colIndexes.add(cellXY[0]);
- }
- }
-
- /** Sort components (normally buttons in a button bar) so they appear in the correct order.
- * @param cells The cells to sort.
- * @param parent The parent.
- */
- private static void sortCellsByPlatform(Collection<Cell> cells, ContainerWrapper parent)
- {
- String order = PlatformDefaults.getButtonOrder();
- String orderLo = order.toLowerCase();
-
- int unrelSize = PlatformDefaults.convertToPixels(1, "u", true, 0, parent, null);
-
- if (unrelSize == UnitConverter.UNABLE)
- throw new IllegalArgumentException("'unrelated' not recognized by PlatformDefaults!");
-
- int[] gapUnrel = new int[] {unrelSize, unrelSize, LayoutUtil.NOT_SET};
- int[] flGap = new int[] {0, 0, LayoutUtil.NOT_SET};
-
- for (Cell cell : cells) {
- if (cell.hasTagged == false)
- continue;
-
- CompWrap prevCW = null;
- boolean nextUnrel = false;
- boolean nextPush = false;
- ArrayList<CompWrap> sortedList = new ArrayList<CompWrap>(cell.compWraps.size());
-
- for (int i = 0, iSz = orderLo.length(); i < iSz; i++) {
- char c = orderLo.charAt(i);
- if (c == '+' || c == '_') {
- nextUnrel = true;
- if (c == '+')
- nextPush = true;
- } else {
- String tag = PlatformDefaults.getTagForChar(c);
- if (tag != null) {
- for (int j = 0, jSz = cell.compWraps.size(); j < jSz; j++) {
- CompWrap cw = cell.compWraps.get(j);
- if (tag.equals(cw.cc.getTag())) {
- if (Character.isUpperCase(order.charAt(i))) {
- int min = PlatformDefaults.getMinimumButtonWidth().getPixels(0, parent, cw.comp);
- if (min > cw.horSizes[LayoutUtil.MIN])
- cw.horSizes[LayoutUtil.MIN] = min;
-
- correctMinMax(cw.horSizes);
- }
-
- sortedList.add(cw);
-
- if (nextUnrel) {
- (prevCW != null ? prevCW : cw).mergeGapSizes(gapUnrel, cell.flowx, prevCW == null);
- if (nextPush) {
- cw.forcedPushGaps = 1;
- nextUnrel = false;
- nextPush = false;
- }
- }
-
- // "unknown" components will always get an Unrelated gap.
- if (c == 'u')
- nextUnrel = true;
- prevCW = cw;
- }
- }
- }
- }
- }
-
- // If we have a gap that was supposed to push but no more components was found to but the "gap before" then compensate.
- if (sortedList.size() > 0) {
- CompWrap cw = sortedList.get(sortedList.size() - 1);
- if (nextUnrel) {
- cw.mergeGapSizes(gapUnrel, cell.flowx, false);
- if (nextPush)
- cw.forcedPushGaps |= 2;
- }
-
- // Remove first and last gap if not set explicitly.
- if (cw.cc.getHorizontal().getGapAfter() == null)
- cw.setGaps(flGap, 3);
-
- cw = sortedList.get(0);
- if (cw.cc.getHorizontal().getGapBefore() == null)
- cw.setGaps(flGap, 1);
- }
-
- // Exchange the unsorted CompWraps for the sorted one.
- if (cell.compWraps.size() == sortedList.size()) {
- cell.compWraps.clear();
- } else {
- cell.compWraps.removeAll(sortedList);
- }
- cell.compWraps.addAll(sortedList);
- }
- }
-
- private Float[] getDefaultPushWeights(boolean isRows)
- {
- ArrayList<LinkedDimGroup>[] groupLists = isRows ? rowGroupLists : colGroupLists;
-
- Float[] pushWeightArr = GROW_100; // Only create specific if any of the components have grow.
- for (int i = 0, ix = 1; i < groupLists.length; i++, ix += 2) {
- ArrayList<LinkedDimGroup> grps = groupLists[i];
- Float rowPushWeight = null;
- for (LinkedDimGroup grp : grps) {
- for (int c = 0; c < grp._compWraps.size(); c++) {
- CompWrap cw = grp._compWraps.get(c);
- int hideMode = cw.comp.isVisible() ? -1 : cw.cc.getHideMode() != -1 ? cw.cc.getHideMode() : lc.getHideMode();
-
- Float pushWeight = hideMode < 2 ? (isRows ? cw.cc.getPushY() : cw.cc.getPushX()) : null;
- if (rowPushWeight == null || (pushWeight != null && pushWeight.floatValue() > rowPushWeight.floatValue()))
- rowPushWeight = pushWeight;
- }
- }
-
- if (rowPushWeight != null) {
- if (pushWeightArr == GROW_100)
- pushWeightArr = new Float[(groupLists.length << 1) + 1];
- pushWeightArr[ix] = rowPushWeight;
- }
- }
-
- return pushWeightArr;
- }
-
- private void clearGroupLinkBounds()
- {
- if (linkTargetIDs == null)
- return;
-
- for (Map.Entry<String, Boolean> o : linkTargetIDs.entrySet()) {
- if (o.getValue() == Boolean.TRUE)
- LinkHandler.clearBounds(container.getLayout(), o.getKey());
- }
- }
-
- private void resetLinkValues(boolean parentSize, boolean compLinks)
- {
- Object lay = container.getLayout();
- if (compLinks)
- LinkHandler.clearTemporaryBounds(lay);
-
- boolean defIns = !hasDocks();
-
- int parW = parentSize ? lc.getWidth().constrain(container.getWidth(), getParentSize(container, true), container) : 0;
- int parH = parentSize ? lc.getHeight().constrain(container.getHeight(), getParentSize(container, false), container) : 0;
-
- int insX = LayoutUtil.getInsets(lc, 0, defIns).getPixels(0, container, null);
- int insY = LayoutUtil.getInsets(lc, 1, defIns).getPixels(0, container, null);
- int visW = parW - insX - LayoutUtil.getInsets(lc, 2, defIns).getPixels(0, container, null);
- int visH = parH - insY - LayoutUtil.getInsets(lc, 3, defIns).getPixels(0, container, null);
-
- LinkHandler.setBounds(lay, "visual", insX, insY, visW, visH, true, false);
- LinkHandler.setBounds(lay, "container", 0, 0, parW, parH, true, false);
- }
-
- /** Returns the {@link net.miginfocom.layout.Grid.LinkedDimGroup} that has the {@link net.miginfocom.layout.Grid.CompWrap}
- * <code>cw</code>.
- * @param groupLists The lists to search in.
- * @param cw The component wrap to find.
- * @return The linked group or <code>null</code> if none had the component wrap.
- */
- private static LinkedDimGroup getGroupContaining(ArrayList<LinkedDimGroup>[] groupLists, CompWrap cw)
- {
- for (ArrayList<LinkedDimGroup> groups : groupLists) {
- for (int j = 0, jSz = groups.size(); j < jSz; j++) {
- ArrayList<CompWrap> cwList = groups.get(j)._compWraps;
- for (int k = 0, kSz = cwList.size(); k < kSz; k++) {
- if (cwList.get(k) == cw)
- return groups.get(j);
- }
- }
- }
- return null;
- }
-
- private boolean doAbsoluteCorrections(CompWrap cw, int[] bounds)
- {
- boolean changed = false;
-
- int[] stSz = getAbsoluteDimBounds(cw, bounds[2], true);
- if (stSz != null)
- cw.setDimBounds(stSz[0], stSz[1], true);
-
- stSz = getAbsoluteDimBounds(cw, bounds[3], false);
- if (stSz != null)
- cw.setDimBounds(stSz[0], stSz[1], false);
-
- // If there is a link id, store the new bounds.
- if (linkTargetIDs != null)
- changed = setLinkedBounds(cw.comp, cw.cc, cw.x, cw.y, cw.w, cw.h, false);
-
- return changed;
- }
-
- private void adjustSizeForAbsolute(boolean isHor)
- {
- int[] curSizes = isHor ? width : height;
-
- Cell absCell = grid.get(null);
- if (absCell == null || absCell.compWraps.size() == 0)
- return;
-
- ArrayList<CompWrap> cws = absCell.compWraps;
-
- int maxEnd = 0;
- for (int j = 0, cwSz = absCell.compWraps.size(); j < cwSz + 3; j++) { // "Do Again" max absCell.compWraps.size() + 3 times.
- boolean doAgain = false;
- for (int i = 0; i < cwSz; i++) {
- CompWrap cw = cws.get(i);
- int[] stSz = getAbsoluteDimBounds(cw, 0, isHor);
- int end = stSz[0] + stSz[1];
- if (maxEnd < end)
- maxEnd = end;
-
- // If there is a link id, store the new bounds.
- if (linkTargetIDs != null)
- doAgain |= setLinkedBounds(cw.comp, cw.cc, stSz[0], stSz[0], stSz[1], stSz[1], false);
- }
- if (doAgain == false)
- break;
-
- // We need to check this again since the coords may be smaller this round.
- maxEnd = 0;
- clearGroupLinkBounds();
- }
-
- maxEnd += LayoutUtil.getInsets(lc, isHor ? 3 : 2, !hasDocks()).getPixels(0, container, null);
-
- if (curSizes[LayoutUtil.MIN] < maxEnd)
- curSizes[LayoutUtil.MIN] = maxEnd;
- if (curSizes[LayoutUtil.PREF] < maxEnd)
- curSizes[LayoutUtil.PREF] = maxEnd;
- }
-
- private int[] getAbsoluteDimBounds(CompWrap cw, int refSize, boolean isHor)
- {
- if (cw.cc.isExternal()) {
- if (isHor) {
- return new int[] {cw.comp.getX(), cw.comp.getWidth()};
- } else {
- return new int[] {cw.comp.getY(), cw.comp.getHeight()};
- }
- }
-
- int[] plafPad = lc.isVisualPadding() ? cw.comp.getVisualPadding() : null;
- UnitValue[] pad = cw.cc.getPadding();
-
- // If no changes do not create a lot of objects
- if (cw.pos == null && plafPad == null && pad == null)
- return null;
-
- // Set start
- int st = isHor ? cw.x : cw.y;
- int sz = isHor ? cw.w : cw.h;
-
- // If absolute, use those coordinates instead.
- if (cw.pos != null) {
- UnitValue stUV = cw.pos != null ? cw.pos[isHor ? 0 : 1] : null;
- UnitValue endUV = cw.pos != null ? cw.pos[isHor ? 2 : 3] : null;
-
- int minSz = cw.getSize(LayoutUtil.MIN, isHor);
- int maxSz = cw.getSize(LayoutUtil.MAX, isHor);
- sz = Math.min(Math.max(cw.getSize(LayoutUtil.PREF, isHor), minSz), maxSz);
-
- if (stUV != null) {
- st = stUV.getPixels(stUV.getUnit() == UnitValue.ALIGN ? sz : refSize, container, cw.comp);
-
- if (endUV != null) // if (endUV == null && cw.cc.isBoundsIsGrid() == true)
- sz = Math.min(Math.max((isHor ? (cw.x + cw.w) : (cw.y + cw.h)) - st, minSz), maxSz);
- }
-
- if (endUV != null) {
- if (stUV != null) { // if (stUV != null || cw.cc.isBoundsIsGrid()) {
- sz = Math.min(Math.max(endUV.getPixels(refSize, container, cw.comp) - st, minSz), maxSz);
- } else {
- st = endUV.getPixels(refSize, container, cw.comp) - sz;
- }
- }
- }
-
- // If constraint has padding -> correct the start/size
- if (pad != null) {
- UnitValue uv = pad[isHor ? 1 : 0];
- int p = uv != null ? uv.getPixels(refSize, container, cw.comp) : 0;
- st += p;
- uv = pad[isHor ? 3 : 2];
- sz += -p + (uv != null ? uv.getPixels(refSize, container, cw.comp) : 0);
- }
-
- // If the plaf converter has padding -> correct the start/size
- if (plafPad != null) {
- int p = plafPad[isHor ? 1 : 0];
- st += p;
- sz += -p + (plafPad[isHor ? 3 : 2]);
- }
-
- return new int[] {st, sz};
- }
-
- private void layoutInOneDim(int refSize, UnitValue align, boolean isRows, Float[] defaultPushWeights)
- {
- boolean fromEnd = !(isRows ? lc.isTopToBottom() : LayoutUtil.isLeftToRight(lc, container));
- DimConstraint[] primDCs = (isRows ? rowConstr : colConstr).getConstaints();
- FlowSizeSpec fss = isRows ? rowFlowSpecs : colFlowSpecs;
- ArrayList<LinkedDimGroup>[] rowCols = isRows ? rowGroupLists : colGroupLists;
-
- int[] rowColSizes = LayoutUtil.calculateSerial(fss.sizes, fss.resConstsInclGaps, defaultPushWeights, LayoutUtil.PREF, refSize);
-
- if (LayoutUtil.isDesignTime(container)) {
- TreeSet<Integer> indexes = isRows ? rowIndexes : colIndexes;
- int[] ixArr = new int[indexes.size()];
- int ix = 0;
- for (Integer i : indexes)
- ixArr[ix++] = i;
-
- putSizesAndIndexes(container.getComponent(), rowColSizes, ixArr, isRows);
- }
-
- int curPos = align != null ? align.getPixels(refSize - LayoutUtil.sum(rowColSizes), container, null) : 0;
-
- if (fromEnd)
- curPos = refSize - curPos;
-
- for (int i = 0 ; i < rowCols.length; i++) {
- ArrayList<LinkedDimGroup> linkedGroups = rowCols[i];
- int scIx = i - (isRows ? dockOffY : dockOffX);
-
- int bIx = i << 1;
- int bIx2 = bIx + 1;
-
- curPos += (fromEnd ? -rowColSizes[bIx] : rowColSizes[bIx]);
-
- DimConstraint primDC = scIx >= 0 ? primDCs[scIx >= primDCs.length ? primDCs.length - 1 : scIx] : DOCK_DIM_CONSTRAINT;
-
- int rowSize = rowColSizes[bIx2];
-
- for (LinkedDimGroup group : linkedGroups) {
- int groupSize = rowSize;
- if (group.span > 1)
- groupSize = LayoutUtil.sum(rowColSizes, bIx2, Math.min((group.span << 1) - 1, rowColSizes.length - bIx2 - 1));
-
- group.layout(primDC, curPos, groupSize, group.span);
- }
-
- curPos += (fromEnd ? -rowSize : rowSize);
- }
- }
-
- private static void addToSizeGroup(HashMap<String, int[]> sizeGroups, String sizeGroup, int[] size)
- {
- int[] sgSize = sizeGroups.get(sizeGroup);
- if (sgSize == null) {
- sizeGroups.put(sizeGroup, new int[] {size[LayoutUtil.MIN], size[LayoutUtil.PREF], size[LayoutUtil.MAX]});
- } else {
- sgSize[LayoutUtil.MIN] = Math.max(size[LayoutUtil.MIN], sgSize[LayoutUtil.MIN]);
- sgSize[LayoutUtil.PREF] = Math.max(size[LayoutUtil.PREF], sgSize[LayoutUtil.PREF]);
- sgSize[LayoutUtil.MAX] = Math.min(size[LayoutUtil.MAX], sgSize[LayoutUtil.MAX]);
- }
- }
-
- private static HashMap<String, Integer> addToEndGroup(HashMap<String, Integer> endGroups, String endGroup, int end)
- {
- if (endGroup != null) {
- if (endGroups == null)
- endGroups = new HashMap<String, Integer>(2);
-
- Integer oldEnd = endGroups.get(endGroup);
- if (oldEnd == null || end > oldEnd)
- endGroups.put(endGroup, end);
- }
- return endGroups;
- }
-
- /** Calculates Min, Preferred and Max size for the columns OR rows.
- * @param isHor If it is the horizontal dimension to calculate.
- * @return The sizes in a {@link net.miginfocom.layout.Grid.FlowSizeSpec}.
- */
- private FlowSizeSpec calcRowsOrColsSizes(boolean isHor)
- {
- ArrayList<LinkedDimGroup>[] groupsLists = isHor ? colGroupLists : rowGroupLists;
- Float[] defPush = isHor ? pushXs : pushYs;
- int refSize = isHor ? container.getWidth() : container.getHeight();
-
- BoundSize cSz = isHor ? lc.getWidth() : lc.getHeight();
- if (cSz.isUnset() == false)
- refSize = cSz.constrain(refSize, getParentSize(container, isHor), container);
-
- DimConstraint[] primDCs = (isHor? colConstr : rowConstr).getConstaints();
- TreeSet<Integer> primIndexes = isHor ? colIndexes : rowIndexes;
-
- int[][] rowColBoundSizes = new int[primIndexes.size()][];
- HashMap<String, int[]> sizeGroupMap = new HashMap<String, int[]>(2);
- DimConstraint[] allDCs = new DimConstraint[primIndexes.size()];
-
- Iterator<Integer> primIt = primIndexes.iterator();
- for (int r = 0; r < rowColBoundSizes.length; r++) {
- int cellIx = primIt.next();
- int[] rowColSizes = new int[3];
-
- if (cellIx >= -MAX_GRID && cellIx <= MAX_GRID) { // If not dock cell
- allDCs[r] = primDCs[cellIx >= primDCs.length ? primDCs.length - 1 : cellIx];
- } else {
- allDCs[r] = DOCK_DIM_CONSTRAINT;
- }
-
- ArrayList<LinkedDimGroup> groups = groupsLists[r];
-
- int[] groupSizes = new int[] {
- getTotalGroupsSizeParallel(groups, LayoutUtil.MIN, false),
- getTotalGroupsSizeParallel(groups, LayoutUtil.PREF, false),
- LayoutUtil.INF};
-
- correctMinMax(groupSizes);
- BoundSize dimSize = allDCs[r].getSize();
-
- for (int sType = LayoutUtil.MIN; sType <= LayoutUtil.MAX; sType++) {
-
- int rowColSize = groupSizes[sType];
-
- UnitValue uv = dimSize.getSize(sType);
- if (uv != null) {
- // If the size of the column is a link to some other size, use that instead
- int unit = uv.getUnit();
- if (unit == UnitValue.PREF_SIZE) {
- rowColSize = groupSizes[LayoutUtil.PREF];
- } else if (unit == UnitValue.MIN_SIZE) {
- rowColSize = groupSizes[LayoutUtil.MIN];
- } else if (unit == UnitValue.MAX_SIZE) {
- rowColSize = groupSizes[LayoutUtil.MAX];
- } else {
- rowColSize = uv.getPixels(refSize, container, null);
- }
- } else if (cellIx >= -MAX_GRID && cellIx <= MAX_GRID && rowColSize == 0) {
- rowColSize = LayoutUtil.isDesignTime(container) ? LayoutUtil.getDesignTimeEmptySize() : 0; // Empty rows with no size set gets XX pixels if design time
- }
-
- rowColSizes[sType] = rowColSize;
- }
-
- correctMinMax(rowColSizes);
- addToSizeGroup(sizeGroupMap, allDCs[r].getSizeGroup(), rowColSizes);
-
- rowColBoundSizes[r] = rowColSizes;
- }
-
- // Set/equalize the size groups to same the values.
- if (sizeGroupMap.size() > 0) {
- for (int r = 0; r < rowColBoundSizes.length; r++) {
- if (allDCs[r].getSizeGroup() != null)
- rowColBoundSizes[r] = sizeGroupMap.get(allDCs[r].getSizeGroup());
- }
- }
-
- // Add the gaps
- ResizeConstraint[] resConstrs = getRowResizeConstraints(allDCs);
-
- boolean[] fillInPushGaps = new boolean[allDCs.length + 1];
- int[][] gapSizes = getRowGaps(allDCs, refSize, isHor, fillInPushGaps);
-
- FlowSizeSpec fss = mergeSizesGapsAndResConstrs(resConstrs, fillInPushGaps, rowColBoundSizes, gapSizes);
-
- // Spanning components are not handled yet. Check and adjust the multi-row min/pref they enforce.
- adjustMinPrefForSpanningComps(allDCs, defPush, fss, groupsLists);
-
- return fss;
- }
-
- private static int getParentSize(ComponentWrapper cw, boolean isHor)
- {
- ComponentWrapper p = cw.getParent();
- return p != null ? (isHor ? cw.getWidth() : cw.getHeight()) : 0;
- }
-
- private int[] getMinPrefMaxSumSize(boolean isHor)
- {
- int[][] sizes = isHor ? colFlowSpecs.sizes : rowFlowSpecs.sizes;
-
- int[] retSizes = new int[3];
-
- BoundSize sz = isHor ? lc.getWidth() : lc.getHeight();
-
- for (int i = 0; i < sizes.length; i++) {
- if (sizes[i] != null) {
- int[] size = sizes[i];
- for (int sType = LayoutUtil.MIN; sType <= LayoutUtil.MAX; sType++) {
- if (sz.getSize(sType) != null) {
- if (i == 0)
- retSizes[sType] = sz.getSize(sType).getPixels(getParentSize(container, isHor), container, null);
- } else {
- int s = size[sType];
-
- if (s != LayoutUtil.NOT_SET) {
- if (sType == LayoutUtil.PREF) {
- int bnd = size[LayoutUtil.MAX];
- if (bnd != LayoutUtil.NOT_SET && bnd < s)
- s = bnd;
-
- bnd = size[LayoutUtil.MIN];
- if (bnd > s) // Includes s == LayoutUtil.NOT_SET since < 0.
- s = bnd;
- }
-
- retSizes[sType] += s; // MAX compensated below.
- }
-
- // So that MAX is always correct.
- if (size[LayoutUtil.MAX] == LayoutUtil.NOT_SET || retSizes[LayoutUtil.MAX] > LayoutUtil.INF)
- retSizes[LayoutUtil.MAX] = LayoutUtil.INF;
- }
- }
- }
- }
-
- correctMinMax(retSizes);
-
- return retSizes;
- }
-
- private static ResizeConstraint[] getRowResizeConstraints(DimConstraint[] specs)
- {
- ResizeConstraint[] resConsts = new ResizeConstraint[specs.length];
- for (int i = 0; i < resConsts.length; i++)
- resConsts[i] = specs[i].resize;
- return resConsts;
- }
-
- private static ResizeConstraint[] getComponentResizeConstraints(ArrayList<CompWrap> compWraps, boolean isHor)
- {
- ResizeConstraint[] resConsts = new ResizeConstraint[compWraps.size()];
- for (int i = 0; i < resConsts.length; i++) {
- CC fc = compWraps.get(i).cc;
- resConsts[i] = fc.getDimConstraint(isHor).resize;
-
- // Always grow docking components in the correct dimension.
- int dock = fc.getDockSide();
- if (isHor ? (dock == 0 || dock == 2) : (dock == 1 || dock == 3)) {
- ResizeConstraint dc = resConsts[i];
- resConsts[i] = new ResizeConstraint(dc.shrinkPrio, dc.shrink, dc.growPrio, ResizeConstraint.WEIGHT_100);
- }
- }
- return resConsts;
- }
-
- private static boolean[] getComponentGapPush(ArrayList<CompWrap> compWraps, boolean isHor)
- {
- // Make one element bigger and or the after gap with the next before gap.
- boolean[] barr = new boolean[compWraps.size() + 1];
- for (int i = 0; i < barr.length; i++) {
-
- boolean push = i > 0 && compWraps.get(i - 1).isPushGap(isHor, false);
-
- if (push == false && i < (barr.length - 1))
- push = compWraps.get(i).isPushGap(isHor, true);
-
- barr[i] = push;
- }
- return barr;
- }
-
- /** Returns the row gaps in pixel sizes. One more than there are <code>specs</code> sent in.
- * @param specs
- * @param refSize
- * @param isHor
- * @param fillInPushGaps If the gaps are pushing. <b>NOTE!</b> this argument will be filled in and thus changed!
- * @return The row gaps in pixel sizes. One more than there are <code>specs</code> sent in.
- */
- private int[][] getRowGaps(DimConstraint[] specs, int refSize, boolean isHor, boolean[] fillInPushGaps)
- {
- BoundSize defGap = isHor ? lc.getGridGapX() : lc.getGridGapY();
- if (defGap == null)
- defGap = isHor ? PlatformDefaults.getGridGapX() : PlatformDefaults.getGridGapY();
- int[] defGapArr = defGap.getPixelSizes(refSize, container, null);
-
- boolean defIns = !hasDocks();
-
- UnitValue firstGap = LayoutUtil.getInsets(lc, isHor ? 1 : 0, defIns);
- UnitValue lastGap = LayoutUtil.getInsets(lc, isHor ? 3 : 2, defIns);
-
- int[][] retValues = new int[specs.length + 1][];
-
- for (int i = 0, wgIx = 0; i < retValues.length; i++) {
- DimConstraint specBefore = i > 0 ? specs[i - 1] : null;
- DimConstraint specAfter = i < specs.length ? specs[i] : null;
-
- // No gap if between docking components.
- boolean edgeBefore = (specBefore == DOCK_DIM_CONSTRAINT || specBefore == null);
- boolean edgeAfter = (specAfter == DOCK_DIM_CONSTRAINT || specAfter == null);
- if (edgeBefore && edgeAfter)
- continue;
-
- BoundSize wrapGapSize = (wrapGapMap == null || isHor == lc.isFlowX() ? null : wrapGapMap.get(Integer.valueOf(wgIx++)));
-
- if (wrapGapSize == null) {
-
- int[] gapBefore = specBefore != null ? specBefore.getRowGaps(container, null, refSize, false) : null;
- int[] gapAfter = specAfter != null ? specAfter.getRowGaps(container, null, refSize, true) : null;
-
- if (edgeBefore && gapAfter == null && firstGap != null) {
-
- int bef = firstGap.getPixels(refSize, container, null);
- retValues[i] = new int[] {bef, bef, bef};
-
- } else if (edgeAfter && gapBefore == null && firstGap != null) {
-
- int aft = lastGap.getPixels(refSize, container, null);
- retValues[i] = new int[] {aft, aft, aft};
-
- } else {
- retValues[i] = gapAfter != gapBefore ? mergeSizes(gapAfter, gapBefore) : new int[] {defGapArr[0], defGapArr[1], defGapArr[2]};
- }
-
- if (specBefore != null && specBefore.isGapAfterPush() || specAfter != null && specAfter.isGapBeforePush())
- fillInPushGaps[i] = true;
- } else {
-
- if (wrapGapSize.isUnset()) {
- retValues[i] = new int[] {defGapArr[0], defGapArr[1], defGapArr[2]};
- } else {
- retValues[i] = wrapGapSize.getPixelSizes(refSize, container, null);
- }
- fillInPushGaps[i] = wrapGapSize.getGapPush();
- }
- }
- return retValues;
- }
-
- private static int[][] getGaps(ArrayList<CompWrap> compWraps, boolean isHor)
- {
- int compCount = compWraps.size();
- int[][] retValues = new int[compCount + 1][];
-
- retValues[0] = compWraps.get(0).getGaps(isHor, true);
- for (int i = 0; i < compCount; i++) {
- int[] gap1 = compWraps.get(i).getGaps(isHor, false);
- int[] gap2 = i < compCount - 1 ? compWraps.get(i + 1).getGaps(isHor, true) : null;
-
- retValues[i + 1] = mergeSizes(gap1, gap2);
- }
-
- return retValues;
- }
-
- private boolean hasDocks()
- {
- return (dockOffX > 0 || dockOffY > 0 || rowIndexes.last() > MAX_GRID || colIndexes.last() > MAX_GRID);
- }
-
- /** Adjust min/pref size for columns(or rows) that has components that spans multiple columns (or rows).
- * @param specs The specs for the columns or rows. Last index will be used if <code>count</code> is greater than this array's length.
- * @param defPush The default grow weight if the specs does not have anyone that will grow. Comes from "push" in the CC.
- * @param fss
- * @param groupsLists
- */
- private void adjustMinPrefForSpanningComps(DimConstraint[] specs, Float[] defPush, FlowSizeSpec fss, ArrayList<LinkedDimGroup>[] groupsLists)
- {
- for (int r = groupsLists.length - 1; r >= 0; r--) { // Since 3.7.3 Iterate from end to start. Will solve some multiple spanning components hard to solve problems.
- ArrayList<LinkedDimGroup> groups = groupsLists[r];
-
- for (LinkedDimGroup group : groups) {
- if (group.span == 1)
- continue;
-
- int[] sizes = group.getMinPrefMax();
- for (int s = LayoutUtil.MIN; s <= LayoutUtil.PREF; s++) {
- int cSize = sizes[s];
- if (cSize == LayoutUtil.NOT_SET)
- continue;
-
- int rowSize = 0;
- int sIx = (r << 1) + 1;
- int len = Math.min((group.span << 1), fss.sizes.length - sIx) - 1;
- for (int j = sIx; j < sIx + len; j++) {
- int sz = fss.sizes[j][s];
- if (sz != LayoutUtil.NOT_SET)
- rowSize += sz;
- }
-
- if (rowSize < cSize && len > 0) {
- for (int eagerness = 0, newRowSize = 0; eagerness < 4 && newRowSize < cSize; eagerness++)
- newRowSize = fss.expandSizes(specs, defPush, cSize, sIx, len, s, eagerness);
- }
- }
- }
- }
- }
-
- /** For one dimension divide the component wraps into logical groups. One group for component wraps that share a common something,
- * line the property to layout by base line.
- * @param isRows If rows, and not columns, are to be divided.
- * @return One <code>ArrayList<LinkedDimGroup></code> for every row/column.
- */
- private ArrayList<LinkedDimGroup>[] divideIntoLinkedGroups(boolean isRows)
- {
- boolean fromEnd = !(isRows ? lc.isTopToBottom() : LayoutUtil.isLeftToRight(lc, container));
- TreeSet<Integer> primIndexes = isRows ? rowIndexes : colIndexes;
- TreeSet<Integer> secIndexes = isRows ? colIndexes : rowIndexes;
- DimConstraint[] primDCs = (isRows ? rowConstr : colConstr).getConstaints();
-
- ArrayList<LinkedDimGroup>[] groupLists = new ArrayList[primIndexes.size()];
-
- int gIx = 0;
- for (int i : primIndexes) {
-
- DimConstraint dc;
- if (i >= -MAX_GRID && i <= MAX_GRID) { // If not dock cell
- dc = primDCs[i >= primDCs.length ? primDCs.length - 1 : i];
- } else {
- dc = DOCK_DIM_CONSTRAINT;
- }
-
- ArrayList<LinkedDimGroup> groupList = new ArrayList<LinkedDimGroup>(2);
- groupLists[gIx++] = groupList;
-
- for (Integer ix : secIndexes) {
- Cell cell = isRows ? getCell(i, ix) : getCell(ix, i);
- if (cell == null || cell.compWraps.size() == 0)
- continue;
-
- int span = (isRows ? cell.spany : cell.spanx);
- if (span > 1)
- span = convertSpanToSparseGrid(i, span, primIndexes);
-
- boolean isPar = (cell.flowx == isRows);
-
- if ((isPar == false && cell.compWraps.size() > 1) || span > 1) {
-
- int linkType = isPar ? LinkedDimGroup.TYPE_PARALLEL : LinkedDimGroup.TYPE_SERIAL;
- LinkedDimGroup lg = new LinkedDimGroup("p," + ix, span, linkType, !isRows, fromEnd);
- lg.setCompWraps(cell.compWraps);
- groupList.add(lg);
- } else {
- for (int cwIx = 0; cwIx < cell.compWraps.size(); cwIx++) {
- CompWrap cw = cell.compWraps.get(cwIx);
- boolean rowBaselineAlign = (isRows && lc.isTopToBottom() && dc.getAlignOrDefault(!isRows) == UnitValue.BASELINE_IDENTITY); // Disable baseline for bottomToTop since I can not verify it working.
- boolean isBaseline = isRows && cw.isBaselineAlign(rowBaselineAlign);
-
- String linkCtx = isBaseline ? "baseline" : null;
-
- // Find a group with same link context and put it in that group.
- boolean foundList = false;
- for (int glIx = 0, lastGl = groupList.size() - 1; glIx <= lastGl; glIx++) {
- LinkedDimGroup group = groupList.get(glIx);
- if (group.linkCtx == linkCtx || linkCtx != null && linkCtx.equals(group.linkCtx)) {
- group.addCompWrap(cw);
- foundList = true;
- break;
- }
- }
-
- // If none found and at last add a new group.
- if (foundList == false) {
- int linkType = isBaseline ? LinkedDimGroup.TYPE_BASELINE : LinkedDimGroup.TYPE_PARALLEL;
- LinkedDimGroup lg = new LinkedDimGroup(linkCtx, 1, linkType, !isRows, fromEnd);
- lg.addCompWrap(cw);
- groupList.add(lg);
- }
- }
- }
- }
- }
- return groupLists;
- }
-
- /** Spanning is specified in the uncompressed grid number. They can for instance be more than 60000 for the outer
- * edge dock grid cells. When the grid is compressed and indexed after only the cells that area occupied the span
- * is erratic. This method use the row/col indexes and corrects the span to be correct for the compressed grid.
- * @param span The span un the uncompressed grid. <code>LayoutUtil.INF</code> will be interpreted to span the rest
- * of the column/row excluding the surrounding docking components.
- * @param indexes The indexes in the correct dimension.
- * @return The converted span.
- */
- private static int convertSpanToSparseGrid(int curIx, int span, TreeSet<Integer> indexes)
- {
- int lastIx = curIx + span;
- int retSpan = 1;
-
- for (Integer ix : indexes) {
- if (ix <= curIx)
- continue; // We have not arrived to the correct index yet
-
- if (ix >= lastIx)
- break;
-
- retSpan++;
- }
- return retSpan;
- }
-
- private boolean isCellFree(int r, int c, ArrayList<int[]> occupiedRects)
- {
- if (getCell(r, c) != null)
- return false;
-
- for (int[] rect : occupiedRects) {
- if (rect[0] <= c && rect[1] <= r && rect[0] + rect[2] > c && rect[1] + rect[3] > r)
- return false;
- }
- return true;
- }
-
- private Cell getCell(int r, int c)
- {
- return grid.get(Integer.valueOf((r << 16) + c));
- }
-
- private void setCell(int r, int c, Cell cell)
- {
- if (c < 0 || r < 0)
- throw new IllegalArgumentException("Cell position cannot be negative. row: " + r + ", col: " + c);
-
- if (c > MAX_GRID || r > MAX_GRID)
- throw new IllegalArgumentException("Cell position out of bounds. Out of cells. row: " + r + ", col: " + c);
-
- rowIndexes.add(r);
- colIndexes.add(c);
-
- grid.put((r << 16) + c, cell);
- }
-
- /** Adds a docking cell. That cell is outside the normal cell indexes.
- * @param dockInsets The current dock insets. Will be updated!
- * @param side top == 0, left == 1, bottom = 2, right = 3.
- * @param cw The compwrap to put in a cell and add.
- */
- private void addDockingCell(int[] dockInsets, int side, CompWrap cw)
- {
- int r, c, spanx = 1, spany = 1;
- switch (side) {
- case 0:
- case 2:
- r = side == 0 ? dockInsets[0]++ : dockInsets[2]--;
- c = dockInsets[1];
- spanx = dockInsets[3] - dockInsets[1] + 1; // The +1 is for cell 0.
- colIndexes.add(dockInsets[3]); // Make sure there is a receiving cell
- break;
-
- case 1:
- case 3:
- c = side == 1 ? dockInsets[1]++ : dockInsets[3]--;
- r = dockInsets[0];
- spany = dockInsets[2] - dockInsets[0] + 1; // The +1 is for cell 0.
- rowIndexes.add(dockInsets[2]); // Make sure there is a receiving cell
- break;
-
- default:
- throw new IllegalArgumentException("Internal error 123.");
- }
-
- rowIndexes.add(r);
- colIndexes.add(c);
-
- grid.put((r << 16) + c, new Cell(cw, spanx, spany, spanx > 1));
- }
-
- /** A simple representation of a cell in the grid. Contains a number of component wraps and if they span more than one cell.
- */
- private static class Cell
- {
- private final int spanx, spany;
- private final boolean flowx;
- private final ArrayList<CompWrap> compWraps = new ArrayList<CompWrap>(1);
-
- private boolean hasTagged = false; // If one or more components have styles and need to be checked by the component sorter
-
- private Cell(CompWrap cw)
- {
- this(cw, 1, 1, true);
- }
-
- private Cell(int spanx, int spany, boolean flowx)
- {
- this(null, spanx, spany, flowx);
- }
-
- private Cell(CompWrap cw, int spanx, int spany, boolean flowx)
- {
- if (cw != null)
- compWraps.add(cw);
- this.spanx = spanx;
- this.spany = spany;
- this.flowx = flowx;
- }
- }
-
- /** A number of component wraps that share a layout "something" <b>in one dimension</b>
- */
- private static class LinkedDimGroup
- {
- private static final int TYPE_SERIAL = 0;
- private static final int TYPE_PARALLEL = 1;
- private static final int TYPE_BASELINE = 2;
-
- private final String linkCtx;
- private final int span;
- private final int linkType;
- private final boolean isHor, fromEnd;
-
- private ArrayList<CompWrap> _compWraps = new ArrayList<CompWrap>(4);
-
- private int[] sizes = null;
- private int lStart = 0, lSize = 0; // Currently mostly for debug painting
-
- private LinkedDimGroup(String linkCtx, int span, int linkType, boolean isHor, boolean fromEnd)
- {
- this.linkCtx = linkCtx;
- this.span = span;
- this.linkType = linkType;
- this.isHor = isHor;
- this.fromEnd = fromEnd;
- }
-
- private void addCompWrap(CompWrap cw)
- {
- _compWraps.add(cw);
- sizes = null;
- }
-
- private void setCompWraps(ArrayList<CompWrap> cws)
- {
- if (_compWraps != cws) {
- _compWraps = cws;
- sizes = null;
- }
- }
-
- private void layout(DimConstraint dc, int start, int size, int spanCount)
- {
- lStart = start;
- lSize = size;
-
- if (_compWraps.size() == 0)
- return;
-
- ContainerWrapper parent = _compWraps.get(0).comp.getParent();
- if (linkType == TYPE_PARALLEL) {
- layoutParallel(parent, _compWraps, dc, start, size, isHor, fromEnd);
- } else if (linkType == TYPE_BASELINE) {
- layoutBaseline(parent, _compWraps, dc, start, size, LayoutUtil.PREF, spanCount);
- } else {
- layoutSerial(parent, _compWraps, dc, start, size, isHor, spanCount, fromEnd);
- }
- }
-
- /** Returns the min/pref/max sizes for this cell. Returned array <b>must not be altered</b>
- * @return A shared min/pref/max array of sizes. Always of length 3 and never <code>null</code>. Will always be of type STATIC and PIXEL.
- */
- private int[] getMinPrefMax()
- {
- if (sizes == null && _compWraps.size() > 0) {
- sizes = new int[3];
- for (int sType = LayoutUtil.MIN; sType <= LayoutUtil.PREF; sType++) {
- if (linkType == TYPE_PARALLEL) {
- sizes[sType] = getTotalSizeParallel(_compWraps, sType, isHor);
- } else if (linkType == TYPE_BASELINE) {
- int[] aboveBelow = getBaselineAboveBelow(_compWraps, sType, false);
- sizes[sType] = aboveBelow[0] + aboveBelow[1];
- } else {
- sizes[sType] = getTotalSizeSerial(_compWraps, sType, isHor);
- }
- }
- sizes[LayoutUtil.MAX] = LayoutUtil.INF;
- }
- return sizes;
- }
- }
-
- /** Wraps a {@link java.awt.Component} together with its constraint. Caches a lot of information about the component so
- * for instance not the preferred size has to be calculated more than once.
- */
- private final static class CompWrap
- {
- private final ComponentWrapper comp;
- private final CC cc;
- private final UnitValue[] pos;
- private int[][] gaps; // [top,left(actually before),bottom,right(actually after)][min,pref,max]
-
- private final int[] horSizes = new int[3];
- private final int[] verSizes = new int[3];
-
- private int x = LayoutUtil.NOT_SET, y = LayoutUtil.NOT_SET, w = LayoutUtil.NOT_SET, h = LayoutUtil.NOT_SET;
-
- private int forcedPushGaps = 0; // 1 == before, 2 = after. Bitwise.
-
- private CompWrap(ComponentWrapper c, CC cc, int eHideMode, UnitValue[] pos, BoundSize[] callbackSz)
- {
- this.comp = c;
- this.cc = cc;
- this.pos = pos;
-
- if (eHideMode <= 0) {
- BoundSize hBS = (callbackSz != null && callbackSz[0] != null) ? callbackSz[0] : cc.getHorizontal().getSize();
- BoundSize vBS = (callbackSz != null && callbackSz[1] != null) ? callbackSz[1] : cc.getVertical().getSize();
-
- int wHint = -1, hHint = -1; // Added for v3.7
- if (comp.getWidth() > 0 && comp.getHeight() > 0) {
- hHint = comp.getHeight();
- wHint = comp.getWidth();
- }
-
- for (int i = LayoutUtil.MIN; i <= LayoutUtil.MAX; i++) {
- horSizes[i] = getSize(hBS, i, true, hHint);
- verSizes[i] = getSize(vBS, i, false, wHint > 0 ? wHint : horSizes[i]);
- }
-
- correctMinMax(horSizes);
- correctMinMax(verSizes);
- }
-
- if (eHideMode > 1) {
- gaps = new int[4][];
- for (int i = 0; i < gaps.length; i++)
- gaps[i] = new int[3];
- }
- }
-
- private int getSize(BoundSize uvs, int sizeType, boolean isHor, int sizeHint)
- {
- if (uvs == null || uvs.getSize(sizeType) == null) {
- switch(sizeType) {
- case LayoutUtil.MIN:
- return isHor ? comp.getMinimumWidth(sizeHint) : comp.getMinimumHeight(sizeHint);
- case LayoutUtil.PREF:
- return isHor ? comp.getPreferredWidth(sizeHint) : comp.getPreferredHeight(sizeHint);
- default:
- return isHor ? comp.getMaximumWidth(sizeHint) : comp.getMaximumHeight(sizeHint);
- }
- }
-
- ContainerWrapper par = comp.getParent();
- return uvs.getSize(sizeType).getPixels(isHor ? par.getWidth() : par.getHeight(), par, comp);
- }
-
- private void calcGaps(ComponentWrapper before, CC befCC, ComponentWrapper after, CC aftCC, String tag, boolean flowX, boolean isLTR)
- {
- ContainerWrapper par = comp.getParent();
- int parW = par.getWidth();
- int parH = par.getHeight();
-
- BoundSize befGap = before != null ? (flowX ? befCC.getHorizontal() : befCC.getVertical()).getGapAfter() : null;
- BoundSize aftGap = after != null ? (flowX ? aftCC.getHorizontal() : aftCC.getVertical()).getGapBefore() : null;
-
- mergeGapSizes(cc.getVertical().getComponentGaps(par, comp, befGap, (flowX ? null : before), tag, parH, 0, isLTR), false, true);
- mergeGapSizes(cc.getHorizontal().getComponentGaps(par, comp, befGap, (flowX ? before : null), tag, parW, 1, isLTR), true, true);
- mergeGapSizes(cc.getVertical().getComponentGaps(par, comp, aftGap, (flowX ? null : after), tag, parH, 2, isLTR), false, false);
- mergeGapSizes(cc.getHorizontal().getComponentGaps(par, comp, aftGap, (flowX ? after : null), tag, parW, 3, isLTR), true, false);
- }
-
- private void setDimBounds(int start, int size, boolean isHor)
- {
- if (isHor) {
- x = start;
- w = size;
- } else {
- y = start;
- h = size;
- }
- }
-
- private boolean isPushGap(boolean isHor, boolean isBefore)
- {
- if (isHor && ((isBefore ? 1 : 2) & forcedPushGaps) != 0)
- return true; // Forced
-
- DimConstraint dc = cc.getDimConstraint(isHor);
- BoundSize s = isBefore ? dc.getGapBefore() : dc.getGapAfter();
- return s != null && s.getGapPush();
- }
-
- /**
- * @return If the preferred size have changed because of the new bounds.
- */
- private boolean transferBounds(boolean checkPrefChange)
- {
- comp.setBounds(x, y, w, h);
-
- if (checkPrefChange && w != horSizes[LayoutUtil.PREF]) {
- BoundSize vSz = cc.getVertical().getSize();
- if (vSz.getPreferred() == null) {
- if (comp.getPreferredHeight(-1) != verSizes[LayoutUtil.PREF])
- return true;
- }
- }
- return false;
- }
-
- private void setSizes(int[] sizes, boolean isHor)
- {
- if (sizes == null)
- return;
-
- int[] s = isHor ? horSizes : verSizes;
- s[LayoutUtil.MIN] = sizes[LayoutUtil.MIN];
- s[LayoutUtil.PREF] = sizes[LayoutUtil.PREF];
- s[LayoutUtil.MAX] = sizes[LayoutUtil.MAX];
- }
-
- private void setGaps(int[] minPrefMax, int ix)
- {
- if (gaps == null)
- gaps = new int[][] {null, null, null, null};
-
- gaps[ix] = minPrefMax;
- }
-
- private void mergeGapSizes(int[] sizes, boolean isHor, boolean isTL)
- {
- if (gaps == null)
- gaps = new int[][] {null, null, null, null};
-
- if (sizes == null)
- return;
-
- int gapIX = getGapIx(isHor, isTL);
- int[] oldGaps = gaps[gapIX];
- if (oldGaps == null) {
- oldGaps = new int[] {0, 0, LayoutUtil.INF};
- gaps[gapIX] = oldGaps;
- }
-
- oldGaps[LayoutUtil.MIN] = Math.max(sizes[LayoutUtil.MIN], oldGaps[LayoutUtil.MIN]);
- oldGaps[LayoutUtil.PREF] = Math.max(sizes[LayoutUtil.PREF], oldGaps[LayoutUtil.PREF]);
- oldGaps[LayoutUtil.MAX] = Math.min(sizes[LayoutUtil.MAX], oldGaps[LayoutUtil.MAX]);
- }
-
- private int getGapIx(boolean isHor, boolean isTL)
- {
- return isHor ? (isTL ? 1 : 3) : (isTL ? 0 : 2);
- }
-
- private int getSizeInclGaps(int sizeType, boolean isHor)
- {
- return filter(sizeType, getGapBefore(sizeType, isHor) + getSize(sizeType, isHor) + getGapAfter(sizeType, isHor));
- }
-
- private int getSize(int sizeType, boolean isHor)
- {
- return filter(sizeType, isHor ? horSizes[sizeType] : verSizes[sizeType]);
- }
-
- private int getGapBefore(int sizeType, boolean isHor)
- {
- int[] gaps = getGaps(isHor, true);
- return gaps != null ? filter(sizeType, gaps[sizeType]) : 0;
- }
-
- private int getGapAfter(int sizeType, boolean isHor)
- {
- int[] gaps = getGaps(isHor, false);
- return gaps != null ? filter(sizeType, gaps[sizeType]) : 0;
- }
-
- private int[] getGaps(boolean isHor, boolean isTL)
- {
- return gaps[getGapIx(isHor, isTL)];
- }
-
- private int filter(int sizeType, int size)
- {
- if (size == LayoutUtil.NOT_SET)
- return sizeType != LayoutUtil.MAX ? 0 : LayoutUtil.INF;
- return constrainSize(size);
- }
-
- private boolean isBaselineAlign(boolean defValue)
- {
- Float g = cc.getVertical().getGrow();
- if (g != null && g.intValue() != 0)
- return false;
-
- UnitValue al = cc.getVertical().getAlign();
- return (al != null ? al == UnitValue.BASELINE_IDENTITY : defValue) && comp.hasBaseline();
- }
-
- private int getBaseline(int sizeType)
- {
- return comp.getBaseline(getSize(sizeType, true), getSize(sizeType, false));
- }
- }
-
- //***************************************************************************************
- //* Helper Methods
- //***************************************************************************************
-
- private static void layoutBaseline(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, int sizeType, int spanCount)
- {
- int[] aboveBelow = getBaselineAboveBelow(compWraps, sizeType, true);
- int blRowSize = aboveBelow[0] + aboveBelow[1];
-
- CC cc = compWraps.get(0).cc;
-
- // Align for the whole baseline component array
- UnitValue align = cc.getVertical().getAlign();
- if (spanCount == 1 && align == null)
- align = dc.getAlignOrDefault(false);
- if (align == UnitValue.BASELINE_IDENTITY)
- align = UnitValue.CENTER;
-
- int offset = start + aboveBelow[0] + (align != null ? Math.max(0, align.getPixels(size - blRowSize, parent, null)) : 0);
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
- cw.y += offset;
- if (cw.y + cw.h > start + size)
- cw.h = start + size - cw.y;
- }
- }
-
- private static void layoutSerial(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, int spanCount, boolean fromEnd)
- {
- FlowSizeSpec fss = mergeSizesGapsAndResConstrs(
- getComponentResizeConstraints(compWraps, isHor),
- getComponentGapPush(compWraps, isHor),
- getComponentSizes(compWraps, isHor),
- getGaps(compWraps, isHor));
-
- Float[] pushW = dc.isFill() ? GROW_100 : null;
- int[] sizes = LayoutUtil.calculateSerial(fss.sizes, fss.resConstsInclGaps, pushW, LayoutUtil.PREF, size);
- setCompWrapBounds(parent, sizes, compWraps, dc.getAlignOrDefault(isHor), start, size, isHor, fromEnd);
- }
-
- private static void setCompWrapBounds(ContainerWrapper parent, int[] allSizes, ArrayList<CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)
- {
- int totSize = LayoutUtil.sum(allSizes);
- CC cc = compWraps.get(0).cc;
- UnitValue align = correctAlign(cc, rowAlign, isHor, fromEnd);
-
- int cSt = start;
- int slack = size - totSize;
- if (slack > 0 && align != null) {
- int al = Math.min(slack, Math.max(0, align.getPixels(slack, parent, null)));
- cSt += (fromEnd ? -al : al);
- }
-
- for (int i = 0, bIx = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
- if (fromEnd ) {
- cSt -= allSizes[bIx++];
- cw.setDimBounds(cSt - allSizes[bIx], allSizes[bIx], isHor);
- cSt -= allSizes[bIx++];
- } else {
- cSt += allSizes[bIx++];
- cw.setDimBounds(cSt, allSizes[bIx], isHor);
- cSt += allSizes[bIx++];
- }
- }
- }
-
- private static void layoutParallel(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, boolean fromEnd)
- {
- int[][] sizes = new int[compWraps.size()][]; // [compIx][gapBef,compSize,gapAft]
-
- for (int i = 0; i < sizes.length; i++) {
- CompWrap cw = compWraps.get(i);
-
- DimConstraint cDc = cw.cc.getDimConstraint(isHor);
-
- ResizeConstraint[] resConstr = new ResizeConstraint[] {
- cw.isPushGap(isHor, true) ? GAP_RC_CONST_PUSH : GAP_RC_CONST,
- cDc.resize,
- cw.isPushGap(isHor, false) ? GAP_RC_CONST_PUSH : GAP_RC_CONST,
- };
-
- int[][] sz = new int[][] {
- cw.getGaps(isHor, true), (isHor ? cw.horSizes : cw.verSizes), cw.getGaps(isHor, false)
- };
-
- Float[] pushW = dc.isFill() ? GROW_100 : null;
-
- sizes[i] = LayoutUtil.calculateSerial(sz, resConstr, pushW, LayoutUtil.PREF, size);
- }
-
- UnitValue rowAlign = dc.getAlignOrDefault(isHor);
- setCompWrapBounds(parent, sizes, compWraps, rowAlign, start, size, isHor, fromEnd);
- }
-
- private static void setCompWrapBounds(ContainerWrapper parent, int[][] sizes, ArrayList<CompWrap> compWraps, UnitValue rowAlign, int start, int size, boolean isHor, boolean fromEnd)
- {
- for (int i = 0; i < sizes.length; i++) {
- CompWrap cw = compWraps.get(i);
-
- UnitValue align = correctAlign(cw.cc, rowAlign, isHor, fromEnd);
-
- int[] cSizes = sizes[i];
- int gapBef = cSizes[0];
- int cSize = cSizes[1]; // No Math.min(size, cSizes[1]) here!
- int gapAft = cSizes[2];
-
- int cSt = fromEnd ? start - gapBef : start + gapBef;
- int slack = size - cSize - gapBef - gapAft;
- if (slack > 0 && align != null) {
- int al = Math.min(slack, Math.max(0, align.getPixels(slack, parent, null)));
- cSt += (fromEnd ? -al : al);
- }
-
- cw.setDimBounds(fromEnd ? cSt - cSize : cSt, cSize, isHor);
- }
- }
-
- private static UnitValue correctAlign(CC cc, UnitValue rowAlign, boolean isHor, boolean fromEnd)
- {
- UnitValue align = (isHor ? cc.getHorizontal() : cc.getVertical()).getAlign();
- if (align == null)
- align = rowAlign;
- if (align == UnitValue.BASELINE_IDENTITY)
- align = UnitValue.CENTER;
-
- if (fromEnd) {
- if (align == UnitValue.LEFT)
- align = UnitValue.RIGHT;
- else if (align == UnitValue.RIGHT)
- align = UnitValue.LEFT;
- }
- return align;
- }
-
- private static int[] getBaselineAboveBelow(ArrayList<CompWrap> compWraps, int sType, boolean centerBaseline)
- {
- int maxAbove = Short.MIN_VALUE;
- int maxBelow = Short.MIN_VALUE;
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
-
- int height = cw.getSize(sType, false);
- if (height >= LayoutUtil.INF)
- return new int[] {LayoutUtil.INF / 2, LayoutUtil.INF / 2};
-
- int baseline = cw.getBaseline(sType);
- int above = baseline + cw.getGapBefore(sType, false);
- maxAbove = Math.max(above, maxAbove);
- maxBelow = Math.max(height - baseline + cw.getGapAfter(sType, false), maxBelow);
-
- if (centerBaseline)
- cw.setDimBounds(-baseline, height, false);
- }
- return new int[] {maxAbove, maxBelow};
- }
-
- private static int getTotalSizeParallel(ArrayList<CompWrap> compWraps, int sType, boolean isHor)
- {
- int size = sType == LayoutUtil.MAX ? LayoutUtil.INF : 0;
-
- for (int i = 0, iSz = compWraps.size(); i < iSz; i++) {
- CompWrap cw = compWraps.get(i);
- int cwSize = cw.getSizeInclGaps(sType, isHor);
- if (cwSize >= LayoutUtil.INF)
- return LayoutUtil.INF;
-
- if (sType == LayoutUtil.MAX ? cwSize < size : cwSize > size)
- size = cwSize;
- }
- return constrainSize(size);
- }
-
- private static int getTotalSizeSerial(ArrayList<CompWrap> compWraps, int sType, boolean isHor)
- {
- int totSize = 0;
- for (int i = 0, iSz = compWraps.size(), lastGapAfter = 0; i < iSz; i++) {
- CompWrap wrap = compWraps.get(i);
- int gapBef = wrap.getGapBefore(sType, isHor);
- if (gapBef > lastGapAfter)
- totSize += gapBef - lastGapAfter;
-
- totSize += wrap.getSize(sType, isHor);
- totSize += (lastGapAfter = wrap.getGapAfter(sType, isHor));
-
- if (totSize >= LayoutUtil.INF)
- return LayoutUtil.INF;
- }
- return constrainSize(totSize);
- }
-
- private static int getTotalGroupsSizeParallel(ArrayList<LinkedDimGroup> groups, int sType, boolean countSpanning)
- {
- int size = sType == LayoutUtil.MAX ? LayoutUtil.INF : 0;
- for (int i = 0, iSz = groups.size(); i < iSz; i++) {
- LinkedDimGroup group = groups.get(i);
- if (countSpanning || group.span == 1) {
- int grpSize = group.getMinPrefMax()[sType];
- if (grpSize >= LayoutUtil.INF)
- return LayoutUtil.INF;
-
- if (sType == LayoutUtil.MAX ? grpSize < size : grpSize > size)
- size = grpSize;
- }
- }
- return constrainSize(size);
- }
-
- /**
- * @param compWraps
- * @param isHor
- * @return Might contain LayoutUtil.NOT_SET
- */
- private static int[][] getComponentSizes(ArrayList<CompWrap> compWraps, boolean isHor)
- {
- int[][] compSizes = new int[compWraps.size()][];
- for (int i = 0; i < compSizes.length; i++) {
- CompWrap cw = compWraps.get(i);
- compSizes[i] = isHor ? cw.horSizes : cw.verSizes;
- }
- return compSizes;
- }
-
- /** Merges sizes and gaps together with Resize Constraints. For gaps {@link #GAP_RC_CONST} is used.
- * @param resConstr One resize constriant for every row/component. Can be lesser in length and the last element should be used for missing elements.
- * @param gapPush If the corresponding gap should be considered pushing and thus want to take free space if left over. Should be one more than resConstrs!
- * @param minPrefMaxSizes The sizes (min/pref/max) for every row/component.
- * @param gapSizes The gaps before and after each row/component packed in one double sized array.
- * @return A holder for the merged values.
- */
- private static FlowSizeSpec mergeSizesGapsAndResConstrs(ResizeConstraint[] resConstr, boolean[] gapPush, int[][] minPrefMaxSizes, int[][] gapSizes)
- {
- int[][] sizes = new int[(minPrefMaxSizes.length << 1) + 1][]; // Make room for gaps around.
- ResizeConstraint[] resConstsInclGaps = new ResizeConstraint[sizes.length];
-
- sizes[0] = gapSizes[0];
- for (int i = 0, crIx = 1; i < minPrefMaxSizes.length; i++, crIx += 2) {
-
- // Component bounds and constraints
- resConstsInclGaps[crIx] = resConstr[i];
- sizes[crIx] = minPrefMaxSizes[i];
-
- sizes[crIx + 1] = gapSizes[i + 1];
-
- if (sizes[crIx - 1] != null)
- resConstsInclGaps[crIx - 1] = gapPush[i < gapPush.length ? i : gapPush.length - 1] ? GAP_RC_CONST_PUSH : GAP_RC_CONST;
-
- if (i == (minPrefMaxSizes.length - 1) && sizes[crIx + 1] != null)
- resConstsInclGaps[crIx + 1] = gapPush[(i + 1) < gapPush.length ? (i + 1) : gapPush.length - 1] ? GAP_RC_CONST_PUSH : GAP_RC_CONST;
- }
-
- // Check for null and set it to 0, 0, 0.
- for (int i = 0; i < sizes.length; i++) {
- if (sizes[i] == null)
- sizes[i] = new int[3];
- }
-
- return new FlowSizeSpec(sizes, resConstsInclGaps);
- }
-
- private static int[] mergeSizes(int[] oldValues, int[] newValues)
- {
- if (oldValues == null)
- return newValues;
-
- if (newValues == null)
- return oldValues;
-
- int[] ret = new int[oldValues.length];
- for (int i = 0; i < ret.length; i++)
- ret[i] = mergeSizes(oldValues[i], newValues[i], true);
-
- return ret;
- }
-
- private static int mergeSizes(int oldValue, int newValue, boolean toMax)
- {
- if (oldValue == LayoutUtil.NOT_SET || oldValue == newValue)
- return newValue;
-
- if (newValue == LayoutUtil.NOT_SET)
- return oldValue;
-
- return toMax != oldValue > newValue ? newValue : oldValue;
- }
-
- private static int constrainSize(int s)
- {
- return s > 0 ? (s < LayoutUtil.INF ? s : LayoutUtil.INF) : 0;
- }
-
- private static void correctMinMax(int s[])
- {
- if (s[LayoutUtil.MIN] > s[LayoutUtil.MAX])
- s[LayoutUtil.MIN] = s[LayoutUtil.MAX]; // Since MAX is almost always explicitly set use that
-
- if (s[LayoutUtil.PREF] < s[LayoutUtil.MIN])
- s[LayoutUtil.PREF] = s[LayoutUtil.MIN];
-
- if (s[LayoutUtil.PREF] > s[LayoutUtil.MAX])
- s[LayoutUtil.PREF] = s[LayoutUtil.MAX];
- }
-
- private static final class FlowSizeSpec
- {
- private final int[][] sizes; // [row/col index][min, pref, max]
- private final ResizeConstraint[] resConstsInclGaps; // [row/col index]
-
- private FlowSizeSpec(int[][] sizes, ResizeConstraint[] resConstsInclGaps)
- {
- this.sizes = sizes;
- this.resConstsInclGaps = resConstsInclGaps;
- }
-
- /**
- * @param specs The specs for the columns or rows. Last index will be used of <code>fromIx + len</code> is greater than this array's length.
- * @param targetSize The size to try to meet.
- * @param defGrow The default grow weight if the specs does not have anyone that will grow. Comes from "push" in the CC.
- * @param fromIx
- * @param len
- * @param sizeType
- * @param eagerness How eager the algorithm should be to try to expand the sizes.
- * <ul>
- * <li>0 - Grow only rows/columns which have the <code>sizeType</code> set to be the containing components AND which has a grow weight > 0.
- * <li>1 - Grow only rows/columns which have the <code>sizeType</code> set to be the containing components AND which has a grow weight > 0 OR unspecified.
- * <li>2 - Grow all rows/columns that have a grow weight > 0.
- * <li>3 - Grow all rows/columns that have a grow weight > 0 OR unspecified.
- * </ul>
- * @return The new size.
- */
- private int expandSizes(DimConstraint[] specs, Float[] defGrow, int targetSize, int fromIx, int len, int sizeType, int eagerness)
- {
- ResizeConstraint[] resConstr = new ResizeConstraint[len];
- int[][] sizesToExpand = new int[len][];
- for (int i = 0; i < len; i++) {
- int[] minPrefMax = sizes[i + fromIx];
- sizesToExpand[i] = new int[] {minPrefMax[sizeType], minPrefMax[LayoutUtil.PREF], minPrefMax[LayoutUtil.MAX]};
-
- if (eagerness <= 1 && i % 2 == 0) { // (i % 2 == 0) means only odd indexes, which is only rows/col indexes and not gaps.
- int cIx = (i + fromIx - 1) >> 1;
- DimConstraint spec = (DimConstraint) LayoutUtil.getIndexSafe(specs, cIx);
-
- BoundSize sz = spec.getSize();
- if ( (sizeType == LayoutUtil.MIN && sz.getMin() != null && sz.getMin().getUnit() != UnitValue.MIN_SIZE) ||
- (sizeType == LayoutUtil.PREF && sz.getPreferred() != null && sz.getPreferred().getUnit() != UnitValue.PREF_SIZE)) {
- continue;
- }
- }
- resConstr[i] = (ResizeConstraint) LayoutUtil.getIndexSafe(resConstsInclGaps, i + fromIx);
- }
-
- Float[] growW = (eagerness == 1 || eagerness == 3) ? extractSubArray(specs, defGrow, fromIx, len): null;
- int[] newSizes = LayoutUtil.calculateSerial(sizesToExpand, resConstr, growW, LayoutUtil.PREF, targetSize);
- int newSize = 0;
-
- for (int i = 0; i < len; i++) {
- int s = newSizes[i];
- sizes[i + fromIx][sizeType] = s;
- newSize += s;
- }
- return newSize;
- }
- }
-
- private static Float[] extractSubArray(DimConstraint[] specs, Float[] arr, int ix, int len)
- {
- if (arr == null || arr.length < ix + len) {
- Float[] growLastArr = new Float[len];
-
- // Handle a group where some rows (first one/few and/or last one/few) are docks.
- for (int i = ix + len - 1; i >= 0; i -= 2) {
- int specIx = (i >> 1);
- if (specs[specIx] != DOCK_DIM_CONSTRAINT) {
- growLastArr[i - ix] = ResizeConstraint.WEIGHT_100;
- return growLastArr;
- }
- }
- return growLastArr;
- }
-
- Float[] newArr = new Float[len];
- for (int i = 0; i < len; i++)
- newArr[i] = arr[ix + i];
- return newArr;
- }
-
- private static WeakHashMap[] PARENT_ROWCOL_SIZES_MAP = null;
- private static synchronized void putSizesAndIndexes(Object parComp, int[] sizes, int[] ixArr, boolean isRows)
- {
- if (PARENT_ROWCOL_SIZES_MAP == null) // Lazy since only if designing in IDEs
- PARENT_ROWCOL_SIZES_MAP = new WeakHashMap[] {new WeakHashMap(4), new WeakHashMap(4)};
-
- PARENT_ROWCOL_SIZES_MAP[isRows ? 0 : 1].put(parComp, new int[][] {ixArr, sizes});
- }
-
- static synchronized int[][] getSizesAndIndexes(Object parComp, boolean isRows)
- {
- if (PARENT_ROWCOL_SIZES_MAP == null)
- return null;
-
- return (int[][]) PARENT_ROWCOL_SIZES_MAP[isRows ? 0 : 1].get(parComp);
- }
-
- private static WeakHashMap<Object, LinkedHashMap<Integer, Cell>> PARENT_GRIDPOS_MAP = null;
- private static synchronized void saveGrid(ComponentWrapper parComp, LinkedHashMap<Integer, Cell> grid)
- {
- if (PARENT_GRIDPOS_MAP == null) // Lazy since only if designing in IDEs
- PARENT_GRIDPOS_MAP = new WeakHashMap<Object, LinkedHashMap<Integer, Cell>>();
-
- PARENT_GRIDPOS_MAP.put(parComp.getComponent(), grid);
- }
-
- static synchronized HashMap<Object, int[]> getGridPositions(Object parComp)
- {
- if (PARENT_GRIDPOS_MAP == null)
- return null;
-
- LinkedHashMap<Integer, Cell> grid = PARENT_GRIDPOS_MAP.get(parComp);
- if (grid == null)
- return null;
-
- HashMap<Object, int[]> retMap = new HashMap<Object,int[]>();
-
- for (Map.Entry<Integer, Cell> e : grid.entrySet()) {
- Cell cell = e.getValue();
- Integer xyInt = e.getKey();
- if (xyInt != null) {
- int x = xyInt & 0x0000ffff;
- int y = xyInt >> 16;
-
- for (CompWrap cw : cell.compWraps)
- retMap.put(cw.comp.getComponent(), new int[]{x, y, cell.spanx, cell.spany});
- }
- }
-
- return retMap;
- }
-}
[09/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ComponentWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ComponentWrapper.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ComponentWrapper.java
deleted file mode 100644
index 913babc..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ComponentWrapper.java
+++ /dev/null
@@ -1,297 +0,0 @@
-package net.miginfocom.layout;
-/*
- * 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
- */
-
-/** A class that wraps the important parts of a Component.
- * <p>
- * <b>NOTE!</b>.equals() and .hashcode() should be shunted to the wrapped component. E.g.
- * <pre>
- * public int hashCode()
- {
- return getComponent().hashCode();
- }
-
- public final boolean equals(Object o)
- {
- if (o instanceof ComponentWrapper == false)
- return false;
-
- return getComponent().equals(((ComponentWrapper) o).getComponent());
- }
- * </pre>
- */
-public interface ComponentWrapper
-{
- static final int TYPE_UNSET = -1;
- public static final int TYPE_UNKNOWN = 0;
- public static final int TYPE_CONTAINER = 1;
- public static final int TYPE_LABEL = 2;
- public static final int TYPE_TEXT_FIELD = 3;
- public static final int TYPE_TEXT_AREA = 4;
- public static final int TYPE_BUTTON = 5;
- public static final int TYPE_LIST = 6;
- public static final int TYPE_TABLE = 7;
- public static final int TYPE_SCROLL_PANE = 8;
- public static final int TYPE_IMAGE = 9;
- public static final int TYPE_PANEL = 10;
- public static final int TYPE_COMBO_BOX = 11;
- public static final int TYPE_SLIDER = 12;
- public static final int TYPE_SPINNER = 13;
- public static final int TYPE_PROGRESS_BAR = 14;
- public static final int TYPE_TREE = 15;
- public static final int TYPE_CHECK_BOX = 16;
- public static final int TYPE_SCROLL_BAR = 17;
- public static final int TYPE_SEPARATOR = 18;
-
- /** Returns the actual object that this wrapper is aggregating. This might be needed for getting
- * information about the object that the wrapper interface does not provide.
- * <p>
- * If this is a container the container should be returned instead.
- * @return The actual object that this wrapper is aggregating. Not <code>null</code>.
- */
- public abstract Object getComponent();
-
- /** Returns the current x coordinate for this component.
- * @return The current x coordinate for this component.
- */
- public abstract int getX();
-
- /** Returns the current y coordinate for this component.
- * @return The current y coordinate for this component.
- */
- public abstract int getY();
-
- /** Returns the current width for this component.
- * @return The current width for this component.
- */
- public abstract int getWidth();
-
- /** Returns the current height for this component.
- * @return The current height for this component.
- */
- public abstract int getHeight();
-
- /** Returns the screen x-coordinate for the upper left coordinate of the component layout-able bounds.
- * @return The screen x-coordinate for the upper left coordinate of the component layout-able bounds.
- */
- public abstract int getScreenLocationX();
-
- /** Returns the screen y-coordinate for the upper left coordinate of the component layout-able bounds.
- * @return The screen y-coordinate for the upper left coordinate of the component layout-able bounds.
- */
- public abstract int getScreenLocationY();
-
- /** Returns the minimum width of the component.
- * @param hHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The minimum width of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getMinimumWidth(int hHint);
-
- /** Returns the minimum height of the component.
- * @param wHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The minimum height of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getMinimumHeight(int wHint);
-
- /** Returns the preferred width of the component.
- * @param hHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The preferred width of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getPreferredWidth(int hHint);
-
- /** Returns the preferred height of the component.
- * @param wHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The preferred height of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getPreferredHeight(int wHint);
-
- /** Returns the maximum width of the component.
- * @param hHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The maximum width of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getMaximumWidth(int hHint);
-
- /** Returns the maximum height of the component.
- * @param wHint The Size hint for the other dimension. An implementation can use this value or the
- * current size for the widget in this dimension, or a combination of both, to calculate the correct size.<br>
- * Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
- * @return The maximum height of the component.
- * @since 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for
- * any implementing classes. This change was worth it though.
- */
- public abstract int getMaximumHeight(int wHint);
-
- /** Sets the component's bounds.
- * @param x The x coordinate.
- * @param y The y coordinate.
- * @param width The width.
- * @param height The height.
- */
- public abstract void setBounds(int x, int y, int width, int height);
-
- /** Returns if the component's visibility is set to <code>true</code>. This should not return if the component is
- * actually visible, but if the visibility is set to true or not.
- * @return <code>true</code> means visible.
- */
- public abstract boolean isVisible();
-
- /** Returns the baseline for the component given the suggested height.
- * @param width The width to calculate for if other than the current. If <code>-1</code> the current size should be used.
- * @param height The height to calculate for if other than the current. If <code>-1</code> the current size should be used.
- * @return The baseline from the top or -1 if not applicable.
- */
- public abstract int getBaseline(int width, int height);
-
- /** Returns if the component has a baseline and if it can be retrieved. Should for instance return
- * <code>false</code> for Swing before mustang.
- * @return If the component has a baseline and if it can be retrieved.
- */
- public abstract boolean hasBaseline();
-
- /** Returns the container for this component.
- * @return The container for this component. Will return <code>null</code> if the component has no parent.
- */
- public abstract ContainerWrapper getParent();
-
- /** Returns the pixel unit factor for the horizontal or vertical dimension.
- * <p>
- * The factor is 1 for both dimensions on the normal font in a JPanel on Windows. The factor should increase with a bigger "X".
- * <p>
- * This is the Swing version:
- * <pre>
- * Rectangle2D r = fm.getStringBounds("X", parent.getGraphics());
- * wFactor = r.getWidth() / 6;
- * hFactor = r.getHeight() / 13.27734375f;
- * </pre>
- * @param isHor If it is the horizontal factor that should be returned.
- * @return The factor.
- */
- public abstract float getPixelUnitFactor(boolean isHor);
-
- /** Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
- * screen if the component is not visible.
- * <p>
- * If headless mode {@link net.miginfocom.layout.PlatformDefaults#getDefaultDPI} will be returned.
- * @return The DPI.
- */
- public abstract int getHorizontalScreenDPI();
-
- /** Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
- * screen if the component is not visible.
- * <p>
- * If headless mode {@link net.miginfocom.layout.PlatformDefaults#getDefaultDPI} will be returned.
- * @return The DPI.
- */
- public abstract int getVerticalScreenDPI();
-
- /** Returns the pixel size of the screen that the component is currently in or for the default
- * screen if the component is not visible or <code>null</code>.
- * <p>
- * If in headless mode <code>1024</code> is returned.
- * @return The screen size. E.g. <code>1280</code>.
- */
- public abstract int getScreenWidth();
-
- /** Returns the pixel size of the screen that the component is currently in or for the default
- * screen if the component is not visible or <code>null</code>.
- * <p>
- * If in headless mode <code>768</code> is returned.
- * @return The screen size. E.g. <code>1024</code>.
- */
- public abstract int getScreenHeight();
-
- /** Returns a String id that can be used to reference the component in link constraints. This value should
- * return the default id for the component. The id can be set for a component in the constraints and if
- * so the value returned by this method will never be used. If there are no sensible id for the component
- * <code>null</code> should be returned.
- * <p>
- * For instance the Swing implementation returns the string returned from <code>Component.getName()</code>.
- * @return The string link id or <code>null</code>.
- */
- public abstract String getLinkId();
-
- /** Returns a hash code that should be reasonably different for anything that might change the layout. This value is used to
- * know if the component layout needs to clear any caches.
- * @return A hash code that should be reasonably different for anything that might change the layout. Returns -1 if the widget is
- * disposed.
- */
- public abstract int getLayoutHashCode();
-
- /** Returns the padding on a component by component basis. This method can be overridden to return padding to compensate for example for
- * borders that have shadows or where the outer most pixel is not the visual "edge" to align to.
- * <p>
- * Default implementation returns <code>null</code> for all components except for Windows XP's JTabbedPane which will return new Insets(0, 0, 2, 2).
- * <p>
- * <b>NOTE!</B> To reduce generated garbage the returned padding should never be changed so that the same insets can be returned many times.
- * @return <code>null</code> if no padding. <b>NOTE!</B> To reduce generated garbage the returned padding should never be changed so that
- * the same insets can be returned many times. [top, left, bottom, right]
- */
- public int[] getVisualPadding();
-
- /** Paints component outline to indicate where it is.
- */
- public abstract void paintDebugOutline();
-
- /** Returns the type of component that this wrapper is wrapping.
- * <p>
- * This method can be invoked often so the result should be cached.
- * <p>
- * <b>NOTE!</b> This is misspelled. Keeping it that way though since this is only used by developers who
- * port MigLayout.
- * @param disregardScrollPane Is <code>true</code> any wrapping scroll pane should be disregarded and the type
- * of the scrolled component should be returned.
- * @return The type of component that this wrapper is wrapping. E.g. {@link #TYPE_LABEL}.
- */
- public abstract int getComponetType(boolean disregardScrollPane);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ConstraintParser.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ConstraintParser.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ConstraintParser.java
deleted file mode 100644
index c83fd7b..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ConstraintParser.java
+++ /dev/null
@@ -1,1464 +0,0 @@
-package net.miginfocom.layout;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-/*
- * 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
- */
-
-/** Parses string constraints.
- */
-public final class ConstraintParser
-{
- private ConstraintParser()
- {
- }
-
- /** Parses the layout constraints and stores the parsed values in the transient (cache) member varables.
- * @param s The String to parse. Should not be <code>null</code> and <b>must be lower case and trimmed</b>.
- * @throws RuntimeException if the constaint was not valid.
- * @return The parsed constraint. Never <code>null</code>.
- */
- public static LC parseLayoutConstraint(String s)
- {
- LC lc = new LC();
- if (s.length() == 0)
- return lc;
-
- String[] parts = toTrimmedTokens(s, ',');
-
- // First check for "ltr" or "rtl" since that will affect the interpretation of the other constraints.
- for (int i = 0; i < parts.length; i++) {
- String part = parts[i];
- if (part == null)
- continue;
-
- int len = part.length();
- if (len == 3 || len == 11) { // Optimization
- if (part.equals("ltr") || part.equals("rtl") || part.equals("lefttoright") || part.equals("righttoleft")) {
- lc.setLeftToRight(part.charAt(0) == 'l' ? Boolean.TRUE : Boolean.FALSE);
- parts[i] = null; // So we will not try to interpret it again
- }
-
- if (part.equals("ttb") || part.equals("btt") || part.equals("toptobottom") || part.equals("bottomtotop")) {
- lc.setTopToBottom(part.charAt(0) == 't');
- parts[i] = null; // So we will not try to interpret it again
- }
- }
- }
-
- for (String part : parts) {
- if (part == null || part.length() == 0)
- continue;
-
- try {
- int ix = -1;
- char c = part.charAt(0);
-
- if (c == 'w' || c == 'h') {
-
- ix = startsWithLenient(part, "wrap", -1, true);
- if (ix > -1) {
- String num = part.substring(ix).trim();
- lc.setWrapAfter(num.length() != 0 ? Integer.parseInt(num) : 0);
- continue;
- }
-
- boolean isHor = c == 'w';
- if (isHor && (part.startsWith("w ") || part.startsWith("width "))) {
- String sz = part.substring(part.charAt(1) == ' ' ? 2 : 6).trim();
- lc.setWidth(parseBoundSize(sz, false, true));
- continue;
- }
-
- if (!isHor && (part.startsWith("h ") || part.startsWith("height "))) {
- String uvStr = part.substring(part.charAt(1) == ' ' ? 2 : 7).trim();
- lc.setHeight(parseBoundSize(uvStr, false, false));
- continue;
- }
-
- if (part.length() > 5) {
- String sz = part.substring(5).trim();
- if (part.startsWith("wmin ")) {
- lc.minWidth(sz);
- continue;
- } else if (part.startsWith("wmax ")) {
- lc.maxWidth(sz);
- continue;
- } else if (part.startsWith("hmin ")) {
- lc.minHeight(sz);
- continue;
- } else if (part.startsWith("hmax ")) {
- lc.maxHeight(sz);
- continue;
- }
- }
-
- if (part.startsWith("hidemode ")) {
- lc.setHideMode(Integer.parseInt(part.substring(9)));
- continue;
- }
- }
-
- if (c == 'g') {
- if (part.startsWith("gapx ")) {
- lc.setGridGapX(parseBoundSize(part.substring(5).trim(), true, true));
- continue;
- }
-
- if (part.startsWith("gapy ")) {
- lc.setGridGapY(parseBoundSize(part.substring(5).trim(), true, false));
- continue;
- }
-
- if (part.startsWith("gap ")) {
- String[] gaps = toTrimmedTokens(part.substring(4).trim(), ' ');
- lc.setGridGapX(parseBoundSize(gaps[0], true, true));
- lc.setGridGapY(gaps.length > 1 ? parseBoundSize(gaps[1], true, false) : lc.getGridGapX());
- continue;
- }
- }
-
- if (c == 'd') {
- ix = startsWithLenient(part, "debug", 5, true);
- if (ix > -1) {
- String millis = part.substring(ix).trim();
- lc.setDebugMillis(millis.length() > 0 ? Integer.parseInt(millis) : 1000);
- continue;
- }
- }
-
- if (c == 'n') {
- if (part.equals("nogrid")) {
- lc.setNoGrid(true);
- continue;
- }
-
- if (part.equals("nocache")) {
- lc.setNoCache(true);
- continue;
- }
-
- if (part.equals("novisualpadding")) {
- lc.setVisualPadding(false);
- continue;
- }
- }
-
- if (c == 'f') {
- if (part.equals("fill") || part.equals("fillx") || part.equals("filly")) {
- lc.setFillX(part.length() == 4 || part.charAt(4) == 'x');
- lc.setFillY(part.length() == 4 || part.charAt(4) == 'y');
- continue;
- }
-
- if (part.equals("flowy")) {
- lc.setFlowX(false);
- continue;
- }
-
- if (part.equals("flowx")) {
- lc.setFlowX(true); // This is the default but added for consistency
- continue;
- }
- }
-
- if (c == 'i') {
- ix = startsWithLenient(part, "insets", 3, true);
- if (ix > -1) {
- String insStr = part.substring(ix).trim();
- UnitValue[] ins = parseInsets(insStr, true);
- LayoutUtil.putCCString(ins, insStr);
- lc.setInsets(ins);
- continue;
- }
- }
-
- if (c == 'a') {
- ix = startsWithLenient(part, new String[]{"aligny", "ay"}, new int[]{6, 2}, true);
- if (ix > -1) {
- UnitValue align = parseUnitValueOrAlign(part.substring(ix).trim(), false, null);
- if (align == UnitValue.BASELINE_IDENTITY)
- throw new IllegalArgumentException("'baseline' can not be used to align the whole component group.");
- lc.setAlignY(align);
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"alignx", "ax"}, new int[]{6, 2}, true);
- if (ix > -1) {
- lc.setAlignX(parseUnitValueOrAlign(part.substring(ix).trim(), true, null));
- continue;
- }
-
- ix = startsWithLenient(part, "align", 2, true);
- if (ix > -1) {
- String[] gaps = toTrimmedTokens(part.substring(ix).trim(), ' ');
- lc.setAlignX(parseUnitValueOrAlign(gaps[0], true, null));
- if (gaps.length > 1)
- lc.setAlignY(parseUnitValueOrAlign(gaps[1], false, null));
- continue;
- }
- }
-
- if (c == 'p') {
- if (part.startsWith("packalign ")) {
- String[] packs = toTrimmedTokens(part.substring(10).trim(), ' ');
- lc.setPackWidthAlign(packs[0].length() > 0 ? Float.parseFloat(packs[0]) : 0.5f);
- if (packs.length > 1)
- lc.setPackHeightAlign(Float.parseFloat(packs[1]));
- continue;
- }
-
- if (part.startsWith("pack ") || part.equals("pack")) {
- String ps = part.substring(4).trim();
- String[] packs = toTrimmedTokens(ps.length() > 0 ? ps : "pref pref", ' ');
- lc.setPackWidth(parseBoundSize(packs[0], false, true));
- if (packs.length > 1)
- lc.setPackHeight(parseBoundSize(packs[1], false, false));
-
- continue;
- }
- }
-
- if (lc.getAlignX() == null) {
- UnitValue alignX = parseAlignKeywords(part, true);
- if (alignX != null) {
- lc.setAlignX(alignX);
- continue;
- }
- }
-
- UnitValue alignY = parseAlignKeywords(part, false);
- if (alignY != null) {
- lc.setAlignY(alignY);
- continue;
- }
-
- throw new IllegalArgumentException("Unknown Constraint: '" + part + "'\n");
-
- } catch (Exception ex) {
- throw new IllegalArgumentException("Illegal Constraint: '" + part + "'\n" + ex.getMessage());
- }
- }
-
-// lc = (LC) serializeTest(lc);
-
- return lc;
- }
-
- /** Parses the column or rows constraints. They normally looks something like <code>"[min:pref]rel[10px][]"</code>.
- * @param s The string to parse. Not <code>null</code>.
- * @return An array of {@link DimConstraint}s that is as many are there exist "[...]" sections in the string that is parsed.
- * @throws RuntimeException if the constraint was not valid.
- */
- public static AC parseRowConstraints(String s)
- {
- return parseAxisConstraint(s, false);
- }
-
- /** Parses the column or rows constraints. They normally looks something like <code>"[min:pref]rel[10px][]"</code>.
- * @param s The string to parse. Not <code>null</code>.
- * @return An array of {@link DimConstraint}s that is as many are there exist "[...]" sections in the string that is parsed.
- * @throws RuntimeException if the constraint was not valid.
- */
- public static AC parseColumnConstraints(String s)
- {
- return parseAxisConstraint(s, true);
- }
-
- /** Parses the column or rows constraints. They normally looks something like <code>"[min:pref]rel[10px][]"</code>.
- * @param s The string to parse. Not <code>null</code>.
- * @param isCols If this for columns rather than rows.
- * @return An array of {@link DimConstraint}s that is as many are there exist "[...]" sections in the string that is parsed.
- * @throws RuntimeException if the constraint was not valid.
- */
- private static AC parseAxisConstraint(String s, boolean isCols)
- {
- s = s.trim();
-
- if (s.length() == 0)
- return new AC(); // Short circuit for performance.
-
- s = s.toLowerCase();
-
- ArrayList<String> parts = getRowColAndGapsTrimmed(s);
-
- BoundSize[] gaps = new BoundSize[(parts.size() >> 1) + 1];
- for (int i = 0, iSz = parts.size(), gIx = 0; i < iSz; i += 2, gIx++)
- gaps[gIx] = parseBoundSize(parts.get(i), true, isCols);
-
- DimConstraint[] colSpecs = new DimConstraint[parts.size() >> 1];
- for (int i = 0, gIx = 0; i < colSpecs.length; i++, gIx++) {
- if (gIx >= gaps.length - 1)
- gIx = gaps.length - 2;
-
- colSpecs[i] = parseDimConstraint(parts.get((i << 1) + 1), gaps[gIx], gaps[gIx + 1], isCols);
- }
-
- AC ac = new AC();
- ac.setConstaints(colSpecs);
-
-// ac = (AC) serializeTest(ac);
-
- return ac;
- }
-
- /** Parses a single column or row constraint.
- * @param s The single constraint to parse. May look something like <code>"min:pref,fill,grow"</code>. Should not be <code>null</code> and <b>must
- * be lower case and trimmed</b>.
- * @param gapBefore The default gap "before" the column/row constraint. Can be overridden with a <code>"gap"</code> section within <code>s</code>.
- * @param gapAfter The default gap "after" the column/row constraint. Can be overridden with a <code>"gap"</code> section within <code>s</code>.
- * @param isCols If the constraints are column constraints rather than row constraints.
- * @return A single constraint. Never <code>null</code>.
- * @throws RuntimeException if the constraint was not valid.
- */
- private static DimConstraint parseDimConstraint(String s, BoundSize gapBefore, BoundSize gapAfter, boolean isCols)
- {
- DimConstraint dimConstraint = new DimConstraint();
-
- // Default values.
- dimConstraint.setGapBefore(gapBefore);
- dimConstraint.setGapAfter(gapAfter);
-
- String[] parts = toTrimmedTokens(s, ',');
- for (int i = 0; i < parts.length; i++) {
- String part = parts[i];
- try {
- if (part.length() == 0)
- continue;
-
- if (part.equals("fill")) {
- dimConstraint.setFill(true);
-// dimConstraint.setAlign(null); // Can not have both fill and alignment (changed for 3.5 since it can have "growy 0")
- continue;
- }
-
- if (part.equals("nogrid")) {
- dimConstraint.setNoGrid(true);
- continue;
- }
-
- int ix = -1;
- char c = part.charAt(0);
-
- if (c == 's') {
- ix = startsWithLenient(part, new String[] {"sizegroup", "sg"}, new int[] {5, 2}, true);
- if (ix > -1) {
- dimConstraint.setSizeGroup(part.substring(ix).trim());
- continue;
- }
-
-
- ix = startsWithLenient(part, new String[] {"shrinkprio", "shp"}, new int[] {10, 3}, true);
- if (ix > -1) {
- dimConstraint.setShrinkPriority(Integer.parseInt(part.substring(ix).trim()));
- continue;
- }
-
- ix = startsWithLenient(part, "shrink", 6, true);
- if (ix > -1) {
- dimConstraint.setShrink(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
- }
-
- if (c == 'g') {
- ix = startsWithLenient(part, new String[] {"growpriority", "gp"}, new int[] {5, 2}, true);
- if (ix > -1) {
- dimConstraint.setGrowPriority(Integer.parseInt(part.substring(ix).trim()));
- continue;
- }
-
- ix = startsWithLenient(part, "grow", 4, true);
- if (ix > -1) {
- dimConstraint.setGrow(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
- }
-
- if (c == 'a') {
- ix = startsWithLenient(part, "align", 2, true);
- if (ix > -1) {
-// if (dimConstraint.isFill() == false) // Swallow, but ignore if fill is set. (changed for 3.5 since it can have "growy 0")
- dimConstraint.setAlign(parseUnitValueOrAlign(part.substring(ix).trim(), isCols, null));
- continue;
- }
- }
-
- UnitValue align = parseAlignKeywords(part, isCols);
- if (align != null) {
-// if (dimConstraint.isFill() == false) // Swallow, but ignore if fill is set. (changed for 3.5 since it can have "growy 0")
- dimConstraint.setAlign(align);
- continue;
- }
-
- // Only min:pref:max still left that is ok
- dimConstraint.setSize(parseBoundSize(part, false, isCols));
-
- } catch (Exception ex) {
- throw new IllegalArgumentException("Illegal contraint: '" + part + "'\n" + ex.getMessage());
- }
- }
- return dimConstraint;
- }
-
- /** Parses all component constraints and stores the parsed values in the transient (cache) member varables.
- * @param constrMap The constraints as <code>String</code>s. Strings <b>must be lower case and trimmed</b>
- * @return The parsed constraints. Never <code>null</code>.
- */
- public static Map<ComponentWrapper, CC> parseComponentConstraints(Map<ComponentWrapper, String> constrMap)
- {
- HashMap<ComponentWrapper, CC> flowConstrMap = new HashMap<ComponentWrapper, CC>();
-
- for (Iterator<Map.Entry<ComponentWrapper, String>> it = constrMap.entrySet().iterator(); it.hasNext();) {
- Map.Entry<ComponentWrapper, String> entry = it.next();
- flowConstrMap.put(entry.getKey(), parseComponentConstraint(entry.getValue()));
- }
-
- return flowConstrMap;
- }
-
- /** Parses one component constraint and returns the parsed value.
- * @param s The string to parse. Should not be <code>null</code> and <b>must be lower case and trimmed</b>.
- * @throws RuntimeException if the constaint was not valid.
- * @return The parsed constraint. Never <code>null</code>.
- */
- public static CC parseComponentConstraint(String s)
- {
- CC cc = new CC();
-
- if (s.length() == 0)
- return cc;
-
- String[] parts = toTrimmedTokens(s, ',');
-
- for (String part : parts) {
- try {
- if (part.length() == 0)
- continue;
-
- int ix = -1;
- char c = part.charAt(0);
-
- if (c == 'n') {
- if (part.equals("north")) {
- cc.setDockSide(0);
- continue;
- }
-
- if (part.equals("newline")) {
- cc.setNewline(true);
- continue;
- }
-
- if (part.startsWith("newline ")) {
- String gapSz = part.substring(7).trim();
- cc.setNewlineGapSize(parseBoundSize(gapSz, true, true));
- continue;
- }
- }
-
- if (c == 'f' && (part.equals("flowy") || part.equals("flowx"))) {
- cc.setFlowX(part.charAt(4) == 'x' ? Boolean.TRUE : Boolean.FALSE);
- continue;
- }
-
- if (c == 's') {
- ix = startsWithLenient(part, "skip", 4, true);
- if (ix > -1) {
- String num = part.substring(ix).trim();
- cc.setSkip(num.length() != 0 ? Integer.parseInt(num) : 1);
- continue;
- }
-
- ix = startsWithLenient(part, "split", 5, true);
- if (ix > -1) {
- String split = part.substring(ix).trim();
- cc.setSplit(split.length() > 0 ? Integer.parseInt(split) : LayoutUtil.INF);
- continue;
- }
-
- if (part.equals("south")) {
- cc.setDockSide(2);
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"spany", "sy"}, new int[]{5, 2}, true);
- if (ix > -1) {
- cc.setSpanY(parseSpan(part.substring(ix).trim()));
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"spanx", "sx"}, new int[]{5, 2}, true);
- if (ix > -1) {
- cc.setSpanX(parseSpan(part.substring(ix).trim()));
- continue;
- }
-
- ix = startsWithLenient(part, "span", 4, true);
- if (ix > -1) {
- String[] spans = toTrimmedTokens(part.substring(ix).trim(), ' ');
- cc.setSpanX(spans[0].length() > 0 ? Integer.parseInt(spans[0]) : LayoutUtil.INF);
- cc.setSpanY(spans.length > 1 ? Integer.parseInt(spans[1]) : 1);
- continue;
- }
-
- ix = startsWithLenient(part, "shrinkx", 7, true);
- if (ix > -1) {
- cc.getHorizontal().setShrink(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "shrinky", 7, true);
- if (ix > -1) {
- cc.getVertical().setShrink(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "shrink", 6, false);
- if (ix > -1) {
- String[] shrinks = toTrimmedTokens(part.substring(ix).trim(), ' ');
- cc.getHorizontal().setShrink(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- if (shrinks.length > 1)
- cc.getVertical().setShrink(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"shrinkprio", "shp"}, new int[]{10, 3}, true);
- if (ix > -1) {
- String sp = part.substring(ix).trim();
- if (sp.startsWith("x") || sp.startsWith("y")) { // To gandle "gpx", "gpy", "shrinkpriorityx", shrinkpriorityy"
- (sp.startsWith("x") ? cc.getHorizontal() : cc.getVertical()).setShrinkPriority(Integer.parseInt(sp.substring(2)));
- } else {
- String[] shrinks = toTrimmedTokens(sp, ' ');
- cc.getHorizontal().setShrinkPriority(Integer.parseInt(shrinks[0]));
- if (shrinks.length > 1)
- cc.getVertical().setShrinkPriority(Integer.parseInt(shrinks[1]));
- }
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"sizegroupx", "sizegroupy", "sgx", "sgy"}, new int[]{9, 9, 2, 2}, true);
- if (ix > -1) {
- String sg = part.substring(ix).trim();
- char lc = part.charAt(ix - 1);
- if (lc != 'y')
- cc.getHorizontal().setSizeGroup(sg);
- if (lc != 'x')
- cc.getVertical().setSizeGroup(sg);
- continue;
- }
- }
-
- if (c == 'g') {
- ix = startsWithLenient(part, "growx", 5, true);
- if (ix > -1) {
- cc.getHorizontal().setGrow(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "growy", 5, true);
- if (ix > -1) {
- cc.getVertical().setGrow(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "grow", 4, false);
- if (ix > -1) {
- String[] grows = toTrimmedTokens(part.substring(ix).trim(), ' ');
- cc.getHorizontal().setGrow(parseFloat(grows[0], ResizeConstraint.WEIGHT_100));
- cc.getVertical().setGrow(parseFloat(grows.length > 1 ? grows[1] : "", ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"growprio", "gp"}, new int[]{8, 2}, true);
- if (ix > -1) {
- String gp = part.substring(ix).trim();
- char c0 = gp.length() > 0 ? gp.charAt(0) : ' ';
- if (c0 == 'x' || c0 == 'y') { // To gandle "gpx", "gpy", "growpriorityx", growpriorityy"
- (c0 == 'x' ? cc.getHorizontal() : cc.getVertical()).setGrowPriority(Integer.parseInt(gp.substring(2)));
- } else {
- String[] grows = toTrimmedTokens(gp, ' ');
- cc.getHorizontal().setGrowPriority(Integer.parseInt(grows[0]));
- if (grows.length > 1)
- cc.getVertical().setGrowPriority(Integer.parseInt(grows[1]));
- }
- continue;
- }
-
- if (part.startsWith("gap")) {
- BoundSize[] gaps = parseGaps(part); // Changes order!!
- if (gaps[0] != null)
- cc.getVertical().setGapBefore(gaps[0]);
- if (gaps[1] != null)
- cc.getHorizontal().setGapBefore(gaps[1]);
- if (gaps[2] != null)
- cc.getVertical().setGapAfter(gaps[2]);
- if (gaps[3] != null)
- cc.getHorizontal().setGapAfter(gaps[3]);
- continue;
- }
- }
-
- if (c == 'a') {
- ix = startsWithLenient(part, new String[]{"aligny", "ay"}, new int[]{6, 2}, true);
- if (ix > -1) {
- cc.getVertical().setAlign(parseUnitValueOrAlign(part.substring(ix).trim(), false, null));
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"alignx", "ax"}, new int[]{6, 2}, true);
- if (ix > -1) {
- cc.getHorizontal().setAlign(parseUnitValueOrAlign(part.substring(ix).trim(), true, null));
- continue;
- }
-
- ix = startsWithLenient(part, "align", 2, true);
- if (ix > -1) {
- String[] gaps = toTrimmedTokens(part.substring(ix).trim(), ' ');
- cc.getHorizontal().setAlign(parseUnitValueOrAlign(gaps[0], true, null));
- if (gaps.length > 1)
- cc.getVertical().setAlign(parseUnitValueOrAlign(gaps[1], false, null));
- continue;
- }
- }
-
- if ((c == 'x' || c == 'y') && part.length() > 2) {
- char c2 = part.charAt(1);
- if (c2 == ' ' || (c2 == '2' && part.charAt(2) == ' ')) {
- if (cc.getPos() == null) {
- cc.setPos(new UnitValue[4]);
- } else if (cc.isBoundsInGrid() == false) {
- throw new IllegalArgumentException("Cannot combine 'position' with 'x/y/x2/y2' keywords.");
- }
-
- int edge = (c == 'x' ? 0 : 1) + (c2 == '2' ? 2 : 0);
- UnitValue[] pos = cc.getPos();
- pos[edge] = parseUnitValue(part.substring(2).trim(), null, c == 'x');
- cc.setPos(pos);
- cc.setBoundsInGrid(true);
- continue;
- }
- }
-
- if (c == 'c') {
- ix = startsWithLenient(part, "cell", 4, true);
- if (ix > -1) {
- String[] grs = toTrimmedTokens(part.substring(ix).trim(), ' ');
- if (grs.length < 2)
- throw new IllegalArgumentException("At least two integers must follow " + part);
- cc.setCellX(Integer.parseInt(grs[0]));
- cc.setCellY(Integer.parseInt(grs[1]));
- if (grs.length > 2)
- cc.setSpanX(Integer.parseInt(grs[2]));
- if (grs.length > 3)
- cc.setSpanY(Integer.parseInt(grs[3]));
- continue;
- }
- }
-
- if (c == 'p') {
- ix = startsWithLenient(part, "pos", 3, true);
- if (ix > -1) {
- if (cc.getPos() != null && cc.isBoundsInGrid())
- throw new IllegalArgumentException("Can not combine 'pos' with 'x/y/x2/y2' keywords.");
-
- String[] pos = toTrimmedTokens(part.substring(ix).trim(), ' ');
- UnitValue[] bounds = new UnitValue[4];
- for (int j = 0; j < pos.length; j++)
- bounds[j] = parseUnitValue(pos[j], null, j % 2 == 0);
-
- if (bounds[0] == null && bounds[2] == null || bounds[1] == null && bounds[3] == null)
- throw new IllegalArgumentException("Both x and x2 or y and y2 can not be null!");
-
- cc.setPos(bounds);
- cc.setBoundsInGrid(false);
- continue;
- }
-
- ix = startsWithLenient(part, "pad", 3, true);
- if (ix > -1) {
- UnitValue[] p = parseInsets(part.substring(ix).trim(), false);
- cc.setPadding(new UnitValue[]{
- p[0],
- p.length > 1 ? p[1] : null,
- p.length > 2 ? p[2] : null,
- p.length > 3 ? p[3] : null});
- continue;
- }
-
- ix = startsWithLenient(part, "pushx", 5, true);
- if (ix > -1) {
- cc.setPushX(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "pushy", 5, true);
- if (ix > -1) {
- cc.setPushY(parseFloat(part.substring(ix).trim(), ResizeConstraint.WEIGHT_100));
- continue;
- }
-
- ix = startsWithLenient(part, "push", 4, false);
- if (ix > -1) {
- String[] pushs = toTrimmedTokens(part.substring(ix).trim(), ' ');
- cc.setPushX(parseFloat(pushs[0], ResizeConstraint.WEIGHT_100));
- cc.setPushY(parseFloat(pushs.length > 1 ? pushs[1] : "", ResizeConstraint.WEIGHT_100));
- continue;
- }
- }
-
- if (c == 't') {
- ix = startsWithLenient(part, "tag", 3, true);
- if (ix > -1) {
- cc.setTag(part.substring(ix).trim());
- continue;
- }
- }
-
- if (c == 'w' || c == 'h') {
- if (part.equals("wrap")) {
- cc.setWrap(true);
- continue;
- }
-
- if (part.startsWith("wrap ")) {
- String gapSz = part.substring(5).trim();
- cc.setWrapGapSize(parseBoundSize(gapSz, true, true));
- continue;
- }
-
- boolean isHor = c == 'w';
- if (isHor && (part.startsWith("w ") || part.startsWith("width "))) {
- String uvStr = part.substring(part.charAt(1) == ' ' ? 2 : 6).trim();
- cc.getHorizontal().setSize(parseBoundSize(uvStr, false, true));
- continue;
- }
-
- if (!isHor && (part.startsWith("h ") || part.startsWith("height "))) {
- String uvStr = part.substring(part.charAt(1) == ' ' ? 2 : 7).trim();
- cc.getVertical().setSize(parseBoundSize(uvStr, false, false));
- continue;
- }
-
- if (part.startsWith("wmin ") || part.startsWith("wmax ") || part.startsWith("hmin ") || part.startsWith("hmax ")) {
- String uvStr = part.substring(5).trim();
- if (uvStr.length() > 0) {
- UnitValue uv = parseUnitValue(uvStr, null, isHor);
- boolean isMin = part.charAt(3) == 'n';
- DimConstraint dc = isHor ? cc.getHorizontal() : cc.getVertical();
- dc.setSize(new BoundSize(
- isMin ? uv : dc.getSize().getMin(),
- dc.getSize().getPreferred(),
- isMin ? (dc.getSize().getMax()) : uv,
- uvStr
- ));
- continue;
- }
- }
-
- if (part.equals("west")) {
- cc.setDockSide(1);
- continue;
- }
-
- if (part.startsWith("hidemode ")) {
- cc.setHideMode(Integer.parseInt(part.substring(9)));
- continue;
- }
- }
-
- if (c == 'i' && part.startsWith("id ")) {
- cc.setId(part.substring(3).trim());
- int dIx = cc.getId().indexOf('.');
- if (dIx == 0 || dIx == cc.getId().length() - 1)
- throw new IllegalArgumentException("Dot must not be first or last!");
-
- continue;
- }
-
- if (c == 'e') {
- if (part.equals("east")) {
- cc.setDockSide(3);
- continue;
- }
-
- if (part.equals("external")) {
- cc.setExternal(true);
- continue;
- }
-
- ix = startsWithLenient(part, new String[]{"endgroupx", "endgroupy", "egx", "egy"}, new int[]{-1, -1, -1, -1}, true);
- if (ix > -1) {
- String sg = part.substring(ix).trim();
- char lc = part.charAt(ix - 1);
- DimConstraint dc = (lc == 'x' ? cc.getHorizontal() : cc.getVertical());
- dc.setEndGroup(sg);
- continue;
- }
- }
-
- if (c == 'd') {
- if (part.equals("dock north")) {
- cc.setDockSide(0);
- continue;
- }
- if (part.equals("dock west")) {
- cc.setDockSide(1);
- continue;
- }
- if (part.equals("dock south")) {
- cc.setDockSide(2);
- continue;
- }
- if (part.equals("dock east")) {
- cc.setDockSide(3);
- continue;
- }
-
- if (part.equals("dock center")) {
- cc.getHorizontal().setGrow(100f);
- cc.getVertical().setGrow(100f);
- cc.setPushX(100f);
- cc.setPushY(100f);
- continue;
- }
- }
-
- UnitValue horAlign = parseAlignKeywords(part, true);
- if (horAlign != null) {
- cc.getHorizontal().setAlign(horAlign);
- continue;
- }
-
- UnitValue verAlign = parseAlignKeywords(part, false);
- if (verAlign != null) {
- cc.getVertical().setAlign(verAlign);
- continue;
- }
-
- throw new IllegalArgumentException("Unknown keyword.");
-
- } catch (Exception ex) {
- throw new IllegalArgumentException("Illegal Constraint: '" + part + "'\n" + ex.getMessage());
- }
- }
-
-// cc = (CC) serializeTest(cc);
-
- return cc;
- }
-
- /** Parses insets which consists of 1-4 <code>UnitValue</code>s.
- * @param s The string to parse. E.g. "10 10 10 10" or "20". If less than 4 groups the last will be used for the missing.
- * @param acceptPanel If "panel" and "dialog" should be accepted. They are used to access platform defaults.
- * @return An array of length 4 with the parsed insets.
- * @throws IllegalArgumentException if the parsing could not be done.
- */
- public static UnitValue[] parseInsets(String s, boolean acceptPanel)
- {
- if (s.length() == 0 || s.equals("dialog") || s.equals("panel")) {
- if (acceptPanel == false)
- throw new IllegalAccessError("Insets now allowed: " + s + "\n");
-
- boolean isPanel = s.startsWith("p");
- UnitValue[] ins = new UnitValue[4];
- for (int j = 0; j < 4; j++)
- ins[j] = isPanel ? PlatformDefaults.getPanelInsets(j) : PlatformDefaults.getDialogInsets(j);
-
- return ins;
- } else {
- String[] insS = toTrimmedTokens(s, ' ');
- UnitValue[] ins = new UnitValue[4];
- for (int j = 0; j < 4; j++) {
- UnitValue insSz = parseUnitValue(insS[j < insS.length ? j : insS.length - 1], UnitValue.ZERO, j % 2 == 1);
- ins[j] = insSz != null ? insSz : PlatformDefaults.getPanelInsets(j);
- }
- return ins;
- }
- }
-
- /** Parses gaps.
- * @param s The string that contains gap information. Should start with "gap".
- * @return The gaps as specified in <code>s</code>. Indexed: <code>[top,left,bottom,right][min,pref,max]</code> or
- * [before,after][min,pref,max] if <code>oneDim</code> is true.
- */
- private static BoundSize[] parseGaps(String s)
- {
- BoundSize[] ret = new BoundSize[4];
-
- int ix = startsWithLenient(s, "gaptop", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[0] = parseBoundSize(s, true, false);
- return ret;
- }
-
- ix = startsWithLenient(s, "gapleft", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[1] = parseBoundSize(s, true, true);
- return ret;
- }
-
- ix = startsWithLenient(s, "gapbottom", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[2] = parseBoundSize(s, true, false);
- return ret;
- }
-
- ix = startsWithLenient(s, "gapright", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[3] = parseBoundSize(s, true, true);
- return ret;
- }
-
- ix = startsWithLenient(s, "gapbefore", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[1] = parseBoundSize(s, true, true);
- return ret;
- }
-
- ix = startsWithLenient(s, "gapafter", -1, true);
- if (ix > -1) {
- s = s.substring(ix).trim();
- ret[3] = parseBoundSize(s, true, true);
- return ret;
- }
-
- ix = startsWithLenient(s, new String[] {"gapx", "gapy"}, null, true);
- if (ix > -1) {
- boolean x = s.charAt(3) == 'x';
- String[] gaps = toTrimmedTokens(s.substring(ix).trim(), ' ');
- ret[x ? 1 : 0] = parseBoundSize(gaps[0], true, x);
- if (gaps.length > 1)
- ret[x ? 3 : 2] = parseBoundSize(gaps[1], true, !x);
- return ret;
- }
-
- ix = startsWithLenient(s, "gap ", 1, true);
- if (ix > -1) {
- String[] gaps = toTrimmedTokens(s.substring(ix).trim(), ' ');
-
- ret[1] = parseBoundSize(gaps[0], true, true); // left
- if (gaps.length > 1) {
- ret[3] = parseBoundSize(gaps[1], true, false); // right
- if (gaps.length > 2) {
- ret[0] = parseBoundSize(gaps[2], true, true); // top
- if (gaps.length > 3)
- ret[2] = parseBoundSize(gaps[3], true, false); // bottom
- }
- }
- return ret;
- }
-
- throw new IllegalArgumentException("Unknown Gap part: '" + s + "'");
- }
-
- private static int parseSpan(String s)
- {
- return s.length() > 0 ? Integer.parseInt(s) : LayoutUtil.INF;
- }
-
- private static Float parseFloat(String s, Float nullVal)
- {
- return s.length() > 0 ? new Float(Float.parseFloat(s)) : nullVal;
- }
-
- /** Parses a single "min:pref:max" value. May look something like <code>"10px:20lp:30%"</code> or <code>"pref!"</code>.
- * @param s The string to parse. Not <code>null</code>.
- * @param isGap If this bound size is a gap (different empty string handling).
- * @param isHor If the size is for the horizontal dimension.
- * @return A bound size that may be <code>null</code> if the string was "null", "n" or <code>null</code>.
- */
- public static BoundSize parseBoundSize(String s, boolean isGap, boolean isHor)
- {
- if (s.length() == 0 || s.equals("null") || s.equals("n"))
- return null;
-
- String cs = s;
- boolean push = false;
- if (s.endsWith("push")) {
- push = true;
- int l = s.length();
- s = s.substring(0, l - (s.endsWith(":push") ? 5 : 4));
- if (s.length() == 0)
- return new BoundSize(null, null, null, true, cs);
- }
-
- String[] sizes = toTrimmedTokens(s, ':');
- String s0 = sizes[0];
-
- if (sizes.length == 1) {
- boolean hasEM = s0.endsWith("!");
- if (hasEM)
- s0 = s0.substring(0, s0.length() - 1);
- UnitValue uv = parseUnitValue(s0, null, isHor);
- return new BoundSize(((isGap || hasEM) ? uv : null), uv, (hasEM ? uv : null), push, cs);
-
- } else if (sizes.length == 2) {
- return new BoundSize(parseUnitValue(s0, null, isHor), parseUnitValue(sizes[1], null, isHor), null, push, cs);
- } else if (sizes.length == 3) {
- return new BoundSize(parseUnitValue(s0, null, isHor), parseUnitValue(sizes[1], null, isHor), parseUnitValue(sizes[2], null, isHor), push, cs);
- } else {
- throw new IllegalArgumentException("Min:Preferred:Max size section must contain 0, 1 or 2 colons. '" + cs + "'");
- }
- }
-
- /** Parses a single unit value that may also be an alignment as parsed by {@link #parseAlignKeywords(String, boolean)}.
- * @param s The string to parse. Not <code>null</code>. May look something like <code>"10px"</code> or <code>"5dlu"</code>.
- * @param isHor If the value is for the horizontal dimension.
- * @param emptyReplacement A replacement if <code>s</code> is empty. May be <code>null</code>.
- * @return The parsed unit value. May be <code>null</code>.
- */
- public static UnitValue parseUnitValueOrAlign(String s, boolean isHor, UnitValue emptyReplacement)
- {
- if (s.length() == 0)
- return emptyReplacement;
-
- UnitValue align = parseAlignKeywords(s, isHor);
- if (align != null)
- return align;
-
- return parseUnitValue(s, emptyReplacement, isHor);
- }
-
- /** Parses a single unit value. E.g. "10px" or "5in"
- * @param s The string to parse. Not <code>null</code>. May look something like <code>"10px"</code> or <code>"5dlu"</code>.
- * @param isHor If the value is for the horizontal dimension.
- * @return The parsed unit value. <code>null</code> is empty string,
- */
- public static UnitValue parseUnitValue(String s, boolean isHor)
- {
- return parseUnitValue(s, null, isHor);
- }
-
- /** Parses a single unit value.
- * @param s The string to parse. May be <code>null</code>. May look something like <code>"10px"</code> or <code>"5dlu"</code>.
- * @param emptyReplacement A replacement <code>s</code> is empty or <code>null</code>. May be <code>null</code>.
- * @param isHor If the value is for the horizontal dimension.
- * @return The parsed unit value. May be <code>null</code>.
- */
- private static UnitValue parseUnitValue(String s, UnitValue emptyReplacement, boolean isHor)
- {
- if (s == null || s.length() == 0)
- return emptyReplacement;
-
- String cs = s; // Save creation string.
- char c0 = s.charAt(0);
-
- // Remove start and end parentheses, if there.
- if (c0 == '(' && s.charAt(s.length() - 1) == ')')
- s = s.substring(1, s.length() - 1);
-
- if (c0 == 'n' && (s.equals("null") || s.equals("n")))
- return null;
-
- if (c0 == 'i' && s.equals("inf"))
- return UnitValue.INF;
-
- int oper = getOper(s);
- boolean inline = oper == UnitValue.ADD || oper == UnitValue.SUB || oper == UnitValue.MUL || oper == UnitValue.DIV;
-
- if (oper != UnitValue.STATIC) { // It is a multi-value
-
- String[] uvs;
- if (inline == false) { // If the format is of type "opr(xxx,yyy)" (compared to in-line "10%+15px")
- String sub = s.substring(4, s.length() - 1).trim();
- uvs = toTrimmedTokens(sub, ',');
- if (uvs.length == 1)
- return parseUnitValue(sub, null, isHor);
- } else {
- char delim;
- if (oper == UnitValue.ADD) {
- delim = '+';
- } else if (oper == UnitValue.SUB) {
- delim = '-';
- } else if (oper == UnitValue.MUL) {
- delim = '*';
- } else { // div left
- delim = '/';
- }
- uvs = toTrimmedTokens(s, delim);
- if (uvs.length > 2) { // More than one +-*/.
- String last = uvs[uvs.length - 1];
- String first = s.substring(0, s.length() - last.length() - 1);
- uvs = new String[] {first, last};
- }
- }
-
- if (uvs.length != 2)
- throw new IllegalArgumentException("Malformed UnitValue: '" + s + "'");
-
- UnitValue sub1 = parseUnitValue(uvs[0], null, isHor);
- UnitValue sub2 = parseUnitValue(uvs[1], null, isHor);
-
- if (sub1 == null || sub2 == null)
- throw new IllegalArgumentException("Malformed UnitValue. Must be two sub-values: '" + s + "'");
-
- return new UnitValue(isHor, oper, sub1, sub2, cs);
- } else {
- try {
- String[] numParts = getNumTextParts(s);
- float value = numParts[0].length() > 0 ? Float.parseFloat(numParts[0]) : 1; // e.g. "related" has no number part..
-
- return new UnitValue(value, numParts[1], isHor, oper, cs);
-
- } catch(Exception e) {
- throw new IllegalArgumentException("Malformed UnitValue: '" + s + "'");
- }
- }
- }
-
- /** Parses alignment keywords and returns the appropriate <code>UnitValue</code>.
- * @param s The string to parse. Not <code>null</code>.
- * @param isHor If alignments for horizontal is checked. <code>false</code> means vertical.
- * @return The unit value or <code>null</code> if not recognized (no exception).
- */
- static UnitValue parseAlignKeywords(String s, boolean isHor)
- {
- if (startsWithLenient(s, "center", 1, false) != -1)
- return UnitValue.CENTER;
-
- if (isHor) {
- if (startsWithLenient(s, "left", 1, false) != -1)
- return UnitValue.LEFT;
-
- if (startsWithLenient(s, "right", 1, false) != -1)
- return UnitValue.RIGHT;
-
- if (startsWithLenient(s, "leading", 4, false) != -1)
- return UnitValue.LEADING;
-
- if (startsWithLenient(s, "trailing", 5, false) != -1)
- return UnitValue.TRAILING;
-
- if (startsWithLenient(s, "label", 5, false) != -1)
- return UnitValue.LABEL;
-
- } else {
-
- if (startsWithLenient(s, "baseline", 4, false) != -1)
- return UnitValue.BASELINE_IDENTITY;
-
- if (startsWithLenient(s, "top", 1, false) != -1)
- return UnitValue.TOP;
-
- if (startsWithLenient(s, "bottom", 1, false) != -1)
- return UnitValue.BOTTOM;
- }
-
- return null;
- }
-
- /** Splits a text-number combination such as "hello 10.0" into <code>{"hello", "10.0"}</code>.
- * @param s The string to split. Not <code>null</code>. Needs be be reasonably formatted since the method
- * only finds the first 0-9 or . and cuts the string in half there.
- * @return Always length 2 and no <code>null</code> elements. Elements are "" if no part found.
- */
- private static String[] getNumTextParts(String s)
- {
- for (int i = 0, iSz = s.length(); i < iSz; i++) {
- char c = s.charAt(i);
- if (c == ' ')
- throw new IllegalArgumentException("Space in UnitValue: '" + s + "'");
-
- if ((c < '0' || c > '9') && c != '.' && c != '-')
- return new String[] {s.substring(0, i).trim(), s.substring(i).trim()};
- }
- return new String[] {s, ""};
- }
-
- /** Returns the operation depending on the start character.
- * @param s The string to check. Not <code>null</code>.
- * @return E.g. UnitValue.ADD, UnitValue.SUB or UnitValue.STATIC. Returns negative value for in-line operations.
- */
- private static int getOper(String s)
- {
- int len = s.length();
- if (len < 3)
- return UnitValue.STATIC;
-
- if (len > 5 && s.charAt(3) == '(' && s.charAt(len - 1) == ')') {
- if (s.startsWith("min("))
- return UnitValue.MIN;
-
- if (s.startsWith("max("))
- return UnitValue.MAX;
-
- if (s.startsWith("mid("))
- return UnitValue.MID;
- }
-
- // Try in-line add/sub. E.g. "pref+10px".
- for (int j = 0; j < 2; j++) { // First +- then */ (precedence)
- for (int i = len - 1, p = 0; i > 0; i--) {
- char c = s.charAt(i);
- if (c == ')') {
- p++;
- } else if (c == '(') {
- p--;
- } else if (p == 0) {
- if (j == 0) {
- if (c == '+')
- return UnitValue.ADD;
- if (c == '-')
- return UnitValue.SUB;
- } else {
- if (c == '*')
- return UnitValue.MUL;
- if (c == '/')
- return UnitValue.DIV;
- }
- }
- }
- }
- return UnitValue.STATIC;
- }
-
- /** Returns if a string shares at least a specified numbers starting characters with a number of matches.
- * <p>
- * This method just exercise {@link #startsWithLenient(String, String, int, boolean)} with every one of
- * <code>matches</code> and <code>minChars</code>.
- * @param s The string to check. Not <code>null</code>.
- * @param matches A number of possible starts for <code>s</code>.
- * @param minChars The minimum number of characters to match for every element in <code>matches</code>. Needs
- * to be of same length as <code>matches</code>. Can be <code>null</code>.
- * @param acceptTrailing If after the required number of characters are matched on recognized characters that are not
- * in one of the the <code>matches</code> string should be accepted. For instance if "abczz" should be matched with
- * "abcdef" and min chars 3.
- * @return The index of the first unmatched character if <code>minChars</code> was reached or <code>-1</code> if a match was not
- * found.
- */
- private static int startsWithLenient(String s, String[] matches, int[] minChars, boolean acceptTrailing)
- {
- for (int i = 0; i < matches.length; i++) {
- int minChar = minChars != null ? minChars[i] : -1;
- int ix = startsWithLenient(s, matches[i], minChar, acceptTrailing);
- if (ix > -1)
- return ix;
- }
- return -1;
- }
-
- /** Returns if a string shares at least a specified numbers starting characters with a match.
- * @param s The string to check. Not <code>null</code> and must be trimmed.
- * @param match The possible start for <code>s</code>. Not <code>null</code> and must be trimmed.
- * @param minChars The mimimum number of characters to match to <code>s</code> for it this to be considered a match. -1 means
- * the full length of <code>match</code>.
- * @param acceptTrailing If after the required number of charecters are matched unrecognized characters that are not
- * in one of the the <code>matches</code> string should be accepted. For instance if "abczz" should be matched with
- * "abcdef" and min chars 3.
- * @return The index of the first unmatched character if <code>minChars</code> was reached or <code>-1</code> if a match was not
- * found.
- */
- private static int startsWithLenient(String s, String match, int minChars, boolean acceptTrailing)
- {
- if (s.charAt(0) != match.charAt(0)) // Fast sanity check.
- return -1;
-
- if (minChars == -1)
- minChars = match.length();
-
- int sSz = s.length();
- if (sSz < minChars)
- return -1;
-
- int mSz = match.length();
- int sIx = 0;
- for (int mIx = 0; mIx < mSz; sIx++, mIx++) {
- while (sIx < sSz && (s.charAt(sIx) == ' ' || s.charAt(sIx) == '_')) // Disregard spaces and _
- sIx++;
-
- if (sIx >= sSz || s.charAt(sIx) != match.charAt(mIx))
- return mIx >= minChars && (acceptTrailing || sIx >= sSz) && (sIx >= sSz || s.charAt(sIx - 1) == ' ') ? sIx : -1;
- }
- return sIx >= sSz || acceptTrailing ||s.charAt(sIx) == ' ' ? sIx : -1;
- }
-
- /** Parses a string and returns it in those parts of the string that are separated with a <code>sep</code> character.
- * <p>
- * separator characters within parentheses will not be counted or handled in any way, whatever the depth.
- * <p>
- * A space separator will be a hit to one or more spaces and thus not return empty strings.
- * @param s The string to parse. If it starts and/or ends with a <code>sep</code> the first and/or last element returned will be "". If
- * two <code>sep</code> are next to each other and empty element will be "between" the periods. The <code>sep</code> themselves will never be returned.
- * @param sep The separator char.
- * @return Those parts of the string that are separated with <code>sep</code>. Never null and at least of size 1
- * @since 6.7.2 Changed so more than one space in a row works as one space.
- */
- private static String[] toTrimmedTokens(String s, char sep)
- {
- int toks = 0, sSize = s.length();
- boolean disregardDoubles = sep == ' ';
-
- // Count the sep:s
- int p = 0;
- for(int i = 0; i < sSize; i++) {
- char c = s.charAt(i);
- if (c == '(') {
- p++;
- } else if (c == ')') {
- p--;
- } else if (p == 0 && c == sep) {
- toks++;
- while (disregardDoubles && i < sSize - 1 && s.charAt(i + 1) == ' ')
- i++;
- }
- if (p < 0)
- throw new IllegalArgumentException("Unbalanced parentheses: '" + s + "'");
- }
- if (p != 0)
- throw new IllegalArgumentException("Unbalanced parentheses: '" + s + "'");
-
- if (toks == 0)
- return new String [] {s.trim()};
-
- String[] retArr = new String[toks + 1];
-
- int st = 0, pNr = 0;
- p = 0;
- for (int i = 0; i < sSize; i++) {
-
- char c = s.charAt(i);
- if (c == '(') {
- p++;
- } else if (c == ')') {
- p--;
- } else if (p == 0 && c == sep) {
- retArr[pNr++] = s.substring(st, i).trim();
- st = i + 1;
- while (disregardDoubles && i < sSize - 1 && s.charAt(i + 1) == ' ')
- i++;
- }
- }
-
- retArr[pNr++] = s.substring(st, sSize).trim();
- return retArr;
- }
-
- /** Parses "AAA[BBB]CCC[DDD]EEE" into {"AAA", "BBB", "CCC", "DDD", "EEE", "FFF"}. Handles empty parts. Will always start and end outside
- * a [] block so that the number of returned elemets will always be uneven and at least of length 3.
- * <p>
- * "|" is interpreted as "][".
- * @param s The string. Might be "" but not null. Should be trimmed.
- * @return The string divided into elements. Never <code>null</code> and at least of length 3.
- * @throws IllegalArgumentException If a [] mismatch of some kind. (If not same [ as ] count or if the interleave.)
- */
- private static ArrayList<String> getRowColAndGapsTrimmed(String s)
- {
- if (s.indexOf('|') != -1)
- s = s.replaceAll("\\|", "][");
-
- ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Approx return length.
- int s0 = 0, s1 = 0; // '[' and ']' count.
- int st = 0; // Start of "next token to add".
- for (int i = 0, iSz = s.length(); i < iSz; i++) {
- char c = s.charAt(i);
- if (c == '[') {
- s0++;
- } else if (c == ']') {
- s1++;
- } else {
- continue;
- }
-
- if (s0 != s1 && (s0 - 1) != s1)
- break; // Wrong [ or ] found. Break for throw.
-
- retList.add(s.substring(st, i).trim());
- st = i + 1;
- }
- if (s0 != s1)
- throw new IllegalArgumentException("'[' and ']' mismatch in row/column format string: " + s);
-
- if (s0 == 0) {
- retList.add("");
- retList.add(s);
- retList.add("");
- } else if (retList.size() % 2 == 0) {
- retList.add(s.substring(st, s.length()));
- }
-
- return retList;
- }
-
- /** Makes <code>null</code> "", trims and converts to lower case.
- * @param s The string
- * @return Not null.
- */
- public static String prepare(String s)
- {
- return s != null ? s.trim().toLowerCase() : "";
- }
-
-// /** Tests to serialize and deserialize the object with both XMLEncoder/Decoder and through Serializable
-// * @param o The object to serialize
-// * @return The same object after a tri through the process.
-// */
-// public static final Object serializeTest(Object o)
-// {
-// try {
-// ByteArrayOutputStream barr = new ByteArrayOutputStream();
-// XMLEncoder enc = new XMLEncoder(barr);
-// enc.writeObject(o);
-// enc.close();
-//
-// XMLDecoder dec = new XMLDecoder(new ByteArrayInputStream(barr.toByteArray()));
-// o = dec.readObject();
-// dec.close();
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-//
-// try {
-// ByteArrayOutputStream barr = new ByteArrayOutputStream();
-// ObjectOutputStream oos = new ObjectOutputStream(barr);
-// oos.writeObject(o);
-// oos.close();
-//
-// ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(barr.toByteArray()));
-// o = ois.readObject();
-// ois.close();
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-//
-// return o;
-// }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ContainerWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ContainerWrapper.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ContainerWrapper.java
deleted file mode 100644
index 8f80170..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ContainerWrapper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.miginfocom.layout;
-/*
- * 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
- */
-
-/** A class that wraps a container that contains components.
- */
-public interface ContainerWrapper extends ComponentWrapper
-{
- /** Returns the components of the container that wrapper is wrapping.
- * @return The components of the container that wrapper is wrapping. Never <code>null</code>.
- */
- public abstract ComponentWrapper[] getComponents();
-
- /** Returns the number of components that this parent has.
- * @return The number of components that this parent has.
- */
- public abstract int getComponentCount();
-
- /** Returns the <code>LayoutHandler</code> (in Swing terms) that is handling the layout of this container.
- * If there exist no such class the method should return the same as {@link #getComponent()}, which is the
- * container itself.
- * @return The layout handler instance. Never <code>null</code>.
- */
- public abstract Object getLayout();
-
- /** Returns if this container is using left-to-right component ordering.
- * @return If this container is using left-to-right component ordering.
- */
- public abstract boolean isLeftToRight();
-
- /** Paints a cell to indicate where it is.
- * @param x The x coordinate to start the drwaing.
- * @param y The x coordinate to start the drwaing.
- * @param width The width to draw/fill
- * @param height The height to draw/fill
- */
- public abstract void paintDebugCell(int x, int y, int width, int height);
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/DimConstraint.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/DimConstraint.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/DimConstraint.java
deleted file mode 100644
index 1693987..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/DimConstraint.java
+++ /dev/null
@@ -1,471 +0,0 @@
-package net.miginfocom.layout;
-
-import java.io.*;
-/*
- * 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
- */
-
-/** A simple value holder for a constraint for one dimension.
- */
-public final class DimConstraint implements Externalizable
-{
- /** How this entity can be resized in the dimension that this constraint represents.
- */
- final ResizeConstraint resize = new ResizeConstraint();
-
- // Look at the properties' getter/setter methods for explanation
-
- private String sizeGroup = null; // A "context" compared with equals.
-
- private BoundSize size = BoundSize.NULL_SIZE; // Min, pref, max. Never null, but sizes can be null.
-
- private BoundSize gapBefore = null, gapAfter = null;
-
- private UnitValue align = null;
-
-
- // ************** Only applicable on components! *******************
-
- private String endGroup = null; // A "context" compared with equals.
-
-
- // ************** Only applicable on rows/columns! *******************
-
- private boolean fill = false;
-
- private boolean noGrid = false;
-
- /** Empty constructor.
- */
- public DimConstraint()
- {
- }
-
- /** Returns the grow priority. Relative priority is used for determining which entities gets the extra space first.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The grow priority.
- */
- public int getGrowPriority()
- {
- return resize.growPrio;
- }
-
- /** Sets the grow priority. Relative priority is used for determining which entities gets the extra space first.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new grow priority.
- */
- public void setGrowPriority(int p)
- {
- resize.growPrio = p;
- }
-
- /** Returns the grow weight.<p>
- * Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing. <code>null</code> or
- * zero mean it will never grow. An entity that has twice the grow weight compared to another entity will get twice
- * as much of available space.
- * <p>
- * GrowWeight are only compared within the same GrowPrio.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current grow weight.
- */
- public Float getGrow()
- {
- return resize.grow;
- }
-
- /** Sets the grow weight.<p>
- * Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing. <code>null</code> or
- * zero mean it will never grow. An entity that has twice the grow weight compared to another entity will get twice
- * as much of available space.
- * <p>
- * GrowWeight are only compared within the same GrowPrio.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param weight The new grow weight.
- */
- public void setGrow(Float weight)
- {
- resize.grow = weight;
- }
-
- /** Returns the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The shrink priority.
- */
- public int getShrinkPriority()
- {
- return resize.shrinkPrio;
- }
-
- /** Sets the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new shrink priority.
- */
- public void setShrinkPriority(int p)
- {
- resize.shrinkPrio = p;
- }
-
- /** Returns the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.
- * Shrink weight is how flexible the entity should be, relative to other entities, when it comes to shrinking. <code>null</code> or
- * zero mean it will never shrink (default). An entity that has twice the shrink weight compared to another entity will get twice
- * as much of available space.
- * <p>
- * Shrink(Weight) are only compared within the same ShrinkPrio.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current shrink weight.
- */
- public Float getShrink()
- {
- return resize.shrink;
- }
-
- /** Sets the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.
- * Shrink weight is how flexible the entity should be, relative to other entities, when it comes to shrinking. <code>null</code> or
- * zero mean it will never shrink (default). An entity that has twice the shrink weight compared to another entity will get twice
- * as much of available space.
- * <p>
- * Shrink(Weight) are only compared within the same ShrinkPrio.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param weight The new shrink weight.
- */
- public void setShrink(Float weight)
- {
- resize.shrink = weight;
- }
-
- public UnitValue getAlignOrDefault(boolean isCols)
- {
- if (align != null)
- return align;
-
- if (isCols)
- return UnitValue.LEADING;
-
- return fill || PlatformDefaults.getDefaultRowAlignmentBaseline() == false ? UnitValue.CENTER : UnitValue.BASELINE_IDENTITY;
- }
-
- /** Returns the alignment used either as a default value for sub-entities or for this entity.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The alignment.
- */
- public UnitValue getAlign()
- {
- return align;
- }
-
- /** Sets the alignment used wither as a default value for sub-entities or for this entity.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param uv The new shrink priority. E.g. {@link UnitValue#CENTER} or {@link net.miginfocom.layout.UnitValue#LEADING}.
- */
- public void setAlign(UnitValue uv)
- {
- this.align = uv;
- }
-
- /** Returns the gap after this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and
- * grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The gap after this entity
- */
- public BoundSize getGapAfter()
- {
- return gapAfter;
- }
-
- /** Sets the gap after this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and
- * grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The new gap.
- * @see net.miginfocom.layout.ConstraintParser#parseBoundSize(String, boolean, boolean).
- */
- public void setGapAfter(BoundSize size)
- {
- this.gapAfter = size;
- }
-
- boolean hasGapAfter()
- {
- return gapAfter != null && gapAfter.isUnset() == false;
- }
-
- boolean isGapAfterPush()
- {
- return gapAfter != null && gapAfter.getGapPush();
- }
-
- /** Returns the gap before this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and
- * grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The gap before this entity
- */
- public BoundSize getGapBefore()
- {
- return gapBefore;
- }
-
- /** Sets the gap before this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and
- * grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The new gap.
- * @see net.miginfocom.layout.ConstraintParser#parseBoundSize(String, boolean, boolean).
- */
- public void setGapBefore(BoundSize size)
- {
- this.gapBefore = size;
- }
-
- boolean hasGapBefore()
- {
- return gapBefore != null && gapBefore.isUnset() == false;
- }
-
- boolean isGapBeforePush()
- {
- return gapBefore != null && gapBefore.getGapPush();
- }
-
- /** Returns the min/preferred/max size for the entity in the dimension that this object describes.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current size. Never <code>null</code> since v3.5.
- * @see net.miginfocom.layout.ConstraintParser#parseBoundSize(String, boolean, boolean).
- */
- public BoundSize getSize()
- {
- return size;
- }
-
- /** Sets the min/preferred/max size for the entity in the dimension that this object describes.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The new size. May be <code>null</code>.
- */
- public void setSize(BoundSize size)
- {
- if (size != null)
- size.checkNotLinked();
- this.size = size;
- }
-
- /** Returns the size group that this entity should be in for the dimension that this object is describing.
- * If this constraint is in a size group that is specified here. <code>null</code> means no size group
- * and all other values are legal. Comparison with .equals(). Components/columnss/rows in the same size group
- * will have the same min/preferred/max size; that of the largest in the group for the first two and the
- * smallest for max.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current size group. May be <code>null</code>.
- */
- public String getSizeGroup()
- {
- return sizeGroup;
- }
-
- /** Sets the size group that this entity should be in for the dimension that this object is describing.
- * If this constraint is in a size group that is specified here. <code>null</code> means no size group
- * and all other values are legal. Comparison with .equals(). Components/columnss/rows in the same size group
- * will have the same min/preferred/max size; that of the largest in the group for the first two and the
- * smallest for max.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The new size group. <code>null</code> disables size grouping.
- */
- public void setSizeGroup(String s)
- {
- sizeGroup = s;
- }
-
- // ************** Only applicable on components ! *******************
-
- /** Returns the end group that this entity should be in for the demension that this object is describing.
- * If this constraint is in an end group that is specified here. <code>null</code> means no end group
- * and all other values are legal. Comparison with .equals(). Components in the same end group
- * will have the same end coordinate.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return The current end group. <code>null</code> may be returned.
- */
- public String getEndGroup()
- {
- return endGroup;
- }
-
- /** Sets the end group that this entity should be in for the demension that this object is describing.
- * If this constraint is in an end group that is specified here. <code>null</code> means no end group
- * and all other values are legal. Comparison with .equals(). Components in the same end group
- * will have the same end coordinate.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The new end group. <code>null</code> disables end grouping.
- */
- public void setEndGroup(String s)
- {
- endGroup = s;
- }
-
- // ************** Not applicable on components below ! *******************
-
- /** Returns if the component in the row/column that this constraint should default be grown in the same dimension that
- * this constraint represents (width for column and height for a row).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return code>true</code> means that components should grow.
- */
- public boolean isFill()
- {
- return fill;
- }
-
- /** Sets if the component in the row/column that this constraint should default be grown in the same dimension that
- * this constraint represents (width for column and height for a row).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> means that components should grow.
- */
- public void setFill(boolean b)
- {
- fill = b;
- }
-
- /** Returns if the row/column should default to flow and not to grid behaviour. This means that the whole row/column
- * will be one cell and all components will end up in that cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>true</code> means that the whole row/column should be one cell.
- */
- public boolean isNoGrid()
- {
- return noGrid;
- }
-
- /** Sets if the row/column should default to flow and not to grid behaviour. This means that the whole row/column
- * will be one cell and all components will end up in that cell.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> means that the whole row/column should be one cell.
- */
- public void setNoGrid(boolean b)
- {
- this.noGrid = b;
- }
-
- /** Returns the gaps as pixel values.
- * @param parent The parent. Used to get the pixel values.
- * @param defGap The default gap to use if there is no gap set on this object (i.e. it is null).
- * @param refSize The reference size used to get the pixel sizes.
- * @param before IF it is the gap before rather than the gap after to return.
- * @return The [min,preferred,max] sizes for the specified gap. Uses {@link net.miginfocom.layout.LayoutUtil#NOT_SET}
- * for gap sizes that are <code>null</code>. Returns <code>null</code> if there was no gap specified. A new and free to use array.
- */
- int[] getRowGaps(ContainerWrapper parent, BoundSize defGap, int refSize, boolean before)
- {
- BoundSize gap = before ? gapBefore : gapAfter;
- if (gap == null || gap.isUnset())
- gap = defGap;
-
- if (gap == null || gap.isUnset())
- return null;
-
- int[] ret = new int[3];
- for (int i = LayoutUtil.MIN; i <= LayoutUtil.MAX; i++) {
- UnitValue uv = gap.getSize(i);
- ret[i] = uv != null ? uv.getPixels(refSize, parent, null) : LayoutUtil.NOT_SET;
- }
- return ret;
- }
-
- /** Returns the gaps as pixel values.
- * @param parent The parent. Used to get the pixel values.
- * @param comp The component that the gap is for. If not for a component it is <code>null</code>.
- * @param adjGap The gap that the adjacent component, if any, has towards <code>comp</code>.
- * @param adjacentComp The adjacent component if any. May be <code>null</code>.
- * @param refSize The reference size used to get the pixel sizes.
- * @param adjacentSide What side the <code>adjacentComp</code> is on. 0 = top, 1 = left, 2 = bottom, 3 = right.
- * @param tag The tag string that the component might be tagged with in the component constraints. May be <code>null</code>.
- * @param isLTR If it is left-to-right.
- * @return The [min,preferred,max] sizes for the specified gap. Uses {@link net.miginfocom.layout.LayoutUtil#NOT_SET}
- * for gap sizes that are <code>null</code>. Returns <code>null</code> if there was no gap specified. A new and free to use array.
- */
- int[] getComponentGaps(ContainerWrapper parent, ComponentWrapper comp, BoundSize adjGap, ComponentWrapper adjacentComp, String tag, int refSize, int adjacentSide, boolean isLTR)
- {
- BoundSize gap = adjacentSide < 2 ? gapBefore : gapAfter;
-
- boolean hasGap = gap != null && gap.getGapPush();
- if ((gap == null || gap.isUnset()) && (adjGap == null || adjGap.isUnset()) && comp != null)
- gap = PlatformDefaults.getDefaultComponentGap(comp, adjacentComp, adjacentSide + 1, tag, isLTR);
-
- if (gap == null)
- return hasGap ? new int[] {0, 0, LayoutUtil.NOT_SET} : null;
-
- int[] ret = new int[3];
- for (int i = LayoutUtil.MIN; i <= LayoutUtil.MAX; i++) {
- UnitValue uv = gap.getSize(i);
- ret[i] = uv != null ? uv.getPixels(refSize, parent, null) : LayoutUtil.NOT_SET;
- }
- return ret;
- }
-
- // ************************************************
- // 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() == DimConstraint.class)
- LayoutUtil.writeAsXML(out, this);
- }
-}
[07/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/IDEUtil.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/IDEUtil.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/IDEUtil.java
deleted file mode 100644
index 0483273..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/IDEUtil.java
+++ /dev/null
@@ -1,789 +0,0 @@
-package net.miginfocom.layout;
-
-import java.util.HashMap;
-/*
- * 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
- */
-
-/** This class contains static methods to be used by IDE vendors to convert to and from String/API constraints.
- * <p>
- * <b>Note that {@link LayoutUtil#setDesignTime(ContainerWrapper, boolean)} should be set to <code>true</code> for this class'
- * methods to work.</b>
- */
-public class IDEUtil
-{
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue ZERO = UnitValue.ZERO;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue TOP = UnitValue.TOP;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue LEADING = UnitValue.LEADING;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue LEFT = UnitValue.LEFT;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue CENTER = UnitValue.CENTER;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue TRAILING = UnitValue.TRAILING;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue RIGHT = UnitValue.RIGHT;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue BOTTOM = UnitValue.BOTTOM;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue LABEL = UnitValue.LABEL;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue INF = UnitValue.INF;
-
- /** A direct reference to the corresponding value for predefined UnitValues in {@link UnitValue}.
- */
- public static final UnitValue BASELINE_IDENTITY = UnitValue.BASELINE_IDENTITY;
-
- private final static String[] X_Y_STRINGS = new String[] {"x", "y", "x2", "y2"};
-
- /** Returns the version of IDEUtil
- * @return The version.
- */
- public String getIDEUtilVersion()
- {
- return "1.0";
- }
-
- /** Returns the grid cells that the components in <code>parentContainer</code> has.
- * @param parentContainer The parent container. It is an object since MigLayout is GUI toolkit
- * independent.
- * @return A new hashmap with the components mapped to an array [x, y, spanx, spany].
- * <p>
- * Dock components will always have x and y less than -30000 or more than 30000. This is since they
- * are actually part of the grid, but on the outer edges.
- * <p>
- * Components that span the "rest of the row/column" have really large span values. Actually 30000-x or
- * 30000-y.
- * <p>
- * Generally, the grid does not need to have the upper left at 0, 0. Though it normally does if you
- * don't set the cells explicitly to other values. Rows and columns that are completely empty and
- * that does not have an explicit row/column constraint will be totally disregarded.
- */
- public static HashMap<Object, int[]> getGridPositions(Object parentContainer)
- {
- return Grid.getGridPositions(parentContainer);
- }
-
- /** Returns the sizes of the rows and gaps for a container.
- * There will be two arrays returned [0] and [1].
- * <p>
- * The first array will be the indexes of the rows where indexes that
- * are less than 30000 or larger than 30000 is docking rows. There might be extra docking rows that aren't
- * visible but they always have size 0. Non docking indexes will probably always be 0, 1, 2, 3, etc..
- * <p>
- * The second array is the sizes of the form:<br>
- * <code>[left inset][row size 1][gap 1][row size 2][gap 2][row size n][right inset]</code>.
- * <p>
- * The returned sizes will be the ones calculated in the last layout cycle.
- * @param parentContainer The container to retuern the row sizes and gaps for. In Swing it will be a {@link java.awt.Container} and
- * in SWT it will be a {@link org.eclipse.swt.widgets.Composite}.
- * @return The sizes or <code>null</code> if {@link LayoutUtil#isDesignTime(ContainerWrapper)} is <code>false</code> or
- * <code>parentContainer</code> does not have a MigLayout layout manager.
- * The returned sizes will be the ones calculated in the last layout cycle.
- * @see LayoutUtil#isDesignTime(ContainerWrapper)
- */
- public static int[][] getRowSizes(Object parentContainer)
- {
- return Grid.getSizesAndIndexes(parentContainer, true);
- }
-
- /** Returns the sizes of the columns and gaps for a container.
- * There will be two arrays returned [0] and [1].
- * <p>
- * The first array will be the indexes of the columns where indexes that
- * are less than 30000 or larger than 30000 is docking columns. There might be extra docking columns that aren't
- * visible but they always have size 0. Non docking indexes will probably always be 0, 1, 2, 3, etc..
- * <p>
- * The second array is the sizes of the form:<br>
- * <code>[top inset][column size 1][gap 1][column size 2][gap 2][column size n][bottom inset]</code>.
- * <p>
- * The returned sizes will be the ones calculated in the last layout cycle.
- * @param parentContainer The container to retuern the column sizes and gaps for. In Swing it will be a {@link java.awt.Container} and
- * in SWT it will be a {@link org.eclipse.swt.widgets.Composite}.
- * @return The sizes and indexes or <code>null</code> if {@link LayoutUtil#isDesignTime(ContainerWrapper)} is <code>false</code> or
- * <code>parentContainer</code> does not have a MigLayout layout manager.
- * The returned sizes will be the ones calculated in the last layout cycle.
- * @see LayoutUtil#isDesignTime(ContainerWrapper)
- */
- public static int[][] getColumnSizes(Object parentContainer)
- {
- return Grid.getSizesAndIndexes(parentContainer, false);
- }
-
- /** Returns the a constraint string that can be re-parsed to be the exact same AxisConstraint.
- * @param ac The axis constraint to return as a constraint string.
- * @param asAPI If the returned string should be of API type (e.g. .flowX().gap("rel").align("right")) or
- * as a String type (e.g. "flowx, gap rel, right").
- * @param isCols The the constraint should be returned for columns rather than rows.
- * @return A String. Never <code>null</code>.
- */
- public static String getConstraintString(AC ac, boolean asAPI, boolean isCols)
- {
- StringBuffer sb = new StringBuffer(32);
-
- DimConstraint[] dims = ac.getConstaints();
- BoundSize defGap = isCols ? PlatformDefaults.getGridGapX() : PlatformDefaults.getGridGapY();
-
- for (int i = 0; i < dims.length; i++) {
- DimConstraint dc = dims[i];
-
- addRowDimConstraintString(dc, sb, asAPI);
-
- if (i < dims.length - 1) {
- BoundSize gap = dc.getGapAfter();
-
- if (gap == defGap || gap == null)
- gap = dims[i + 1].getGapBefore();
-
- if (gap != null) {
- String gapStr = getBS(gap);
- if (asAPI) {
- sb.append(".gap(\"").append(gapStr).append("\")");
- } else {
- sb.append(gapStr);
- }
- } else {
- if (asAPI)
- sb.append(".gap()");
- }
- }
- }
-
- return sb.toString();
- }
-
- /** Adds the a constraint string that can be re-parsed to be the exact same DimConstraint.
- * @param dc The layout constraint to return as a constraint string.
- * @param asAPI If the returned string should be of API type (e.g. .flowX().gap("rel").align("right")) or
- * as a String type (e.g. "flowx, gap rel, right").
- */
- private static void addRowDimConstraintString(DimConstraint dc, StringBuffer sb, boolean asAPI)
- {
- int gp = dc.getGrowPriority();
-
- int firstComma = sb.length();
-
- BoundSize size = dc.getSize();
- if (size.isUnset() == false) {
- if (asAPI) {
- sb.append(".size(\"").append(getBS(size)).append("\")");
- } else {
- sb.append(',').append(getBS(size));
- }
- }
-
- if (gp != 100) {
- if (asAPI) {
- sb.append(".growPrio(").append(gp).append("\")");
- } else {
- sb.append(",growprio ").append(gp);
- }
- }
-
- Float gw = dc.getGrow();
- if (gw != null) {
- String g = gw != 100f ? floatToString(gw, asAPI) : "";
- if (asAPI) {
- if (g.length() == 0) {
- sb.append(".grow()");
- } else {
- sb.append(".grow(\"").append(g).append("\")");
- }
- } else {
- sb.append(",grow").append(g.length() > 0 ? (" " + g) : "");
- }
- }
-
- int sp = dc.getShrinkPriority();
- if (sp != 100) {
- if (asAPI) {
- sb.append(".shrinkPrio(").append(sp).append("\")");
- } else {
- sb.append(",shrinkprio ").append(sp);
- }
- }
-
- Float sw = dc.getShrink();
- if (sw != null && sw.intValue() != 100) {
- String s = floatToString(sw, asAPI);
- if (asAPI) {
- sb.append(".shrink(\"").append(s).append("\")");
- } else {
- sb.append(",shrink ").append(s);
- }
- }
-
- String eg = dc.getEndGroup();
- if (eg != null) {
- if (asAPI) {
- sb.append(".endGroup(\"").append(eg).append("\")");
- } else {
- sb.append(",endgroup ").append(eg);
- }
- }
-
- String sg = dc.getSizeGroup();
- if (sg != null) {
- if (asAPI) {
- sb.append(".sizeGroup(\"").append(sg).append("\")");
- } else {
- sb.append(",sizegroup ").append(sg);
- }
- }
-
- UnitValue al = dc.getAlign();
- if (al != null) {
- if (asAPI) {
- sb.append(".align(\"").append(getUV(al)).append("\")");
- } else {
- String s = getUV(al);
- String alKw = (s.equals("top") || s.equals("bottom") || s.equals("left") || s.equals("label") ||
- s.equals("leading") || s.equals("center") || s.equals("trailing") ||
- s.equals("right") || s.equals("baseline")) ? "" : "align ";
- sb.append(',').append(alKw).append(s);
- }
- }
-
- if (dc.isNoGrid()) {
- if (asAPI) {
- sb.append(".noGrid()");
- } else {
- sb.append(",nogrid");
- }
- }
-
- if (dc.isFill()) {
- if (asAPI) {
- sb.append(".fill()");
- } else {
- sb.append(",fill");
- }
- }
-
- if (asAPI == false) {
- if (sb.length() > firstComma) {
- sb.setCharAt(firstComma, '[');
- sb.append(']');
- } else {
- sb.append("[]");
- }
- }
- }
-
- /** Returns the a constraint string that can be re-parsed to be the exact same DimConstraint.
- * @param dc The layout constraint to return as a constraint string.
- * @param asAPI If the returned string should be of API type (e.g. .flowX().gap("rel").align("right")) or
- * as a String type (e.g. "flowx, gap rel, right").
- * @param isHor The the DimConstraint is decoration something horizontal (column or x).
- * @param noGrowAdd If <code>true</code> no grow constraints will be added.
- * @return A constraint string. Never <code>null</code>.
- */
- private static void addComponentDimConstraintString(DimConstraint dc, StringBuffer sb, boolean asAPI, boolean isHor, boolean noGrowAdd)
- {
- int gp = dc.getGrowPriority();
- if (gp != 100) {
- if (asAPI) {
- sb.append(isHor ? ".growPrioX(" : ".growPrioY(").append(gp).append(')');
- } else {
- sb.append(isHor ? ",growpriox " : ",growprioy ").append(gp);
- }
- }
-
- if (noGrowAdd == false) {
- Float gw = dc.getGrow();
- if (gw != null) {
- String g = gw != 100f ? floatToString(gw, asAPI) : "";
- if (asAPI) {
- sb.append(isHor ? ".growX(" : ".growY(").append(g).append(')');
- } else {
- sb.append(isHor ? ",growx" : ",growy").append(g.length() > 0 ? (" " + g) : "");
- }
- }
- }
-
- int sp = dc.getShrinkPriority();
- if (sp != 100) {
- if (asAPI) {
- sb.append(isHor ? ".shrinkPrioX(" : ".shrinkPrioY(").append(sp).append(')');
- } else {
- sb.append(isHor ? ",shrinkpriox " : ",shrinkprioy ").append(sp);
- }
- }
-
- Float sw = dc.getShrink();
- if (sw != null && sw.intValue() != 100) {
- String s = floatToString(sw, asAPI);
- if (asAPI) {
- sb.append(isHor ? ".shrinkX(" : ".shrinkY(").append(s).append(')');
- } else {
- sb.append(isHor ? ",shrinkx " : ",shrinky ").append(s);
- }
- }
-
- String eg = dc.getEndGroup();
- if (eg != null) {
- if (asAPI) {
- sb.append(isHor ? ".endGroupX(\"" : ".endGroupY(\"").append(eg).append("\")");
- } else {
- sb.append(isHor ? ",endgroupx " : ",endgroupy ").append(eg);
- }
- }
-
- String sg = dc.getSizeGroup();
- if (sg != null) {
- if (asAPI) {
- sb.append(isHor ? ".sizeGroupX(\"" : ".sizeGroupY(\"").append(sg).append("\")");
- } else {
- sb.append(isHor ? ",sizegroupx " : ",sizegroupy ").append(sg);
- }
- }
-
- appendBoundSize(dc.getSize(), sb, isHor, asAPI);
-
- UnitValue al = dc.getAlign();
- if (al != null) {
- if (asAPI) {
- sb.append(isHor ? ".alignX(\"" : ".alignY(\"").append(getUV(al)).append("\")");
- } else {
- sb.append(isHor ? ",alignx " : ",aligny ").append(getUV(al));
- }
- }
-
- BoundSize gapBef = dc.getGapBefore();
- BoundSize gapAft= dc.getGapAfter();
- if (gapBef != null || gapAft != null) {
- if (asAPI) {
- sb.append(isHor ? ".gapX(\"" : ".gapY(\"").append(getBS(gapBef)).append("\", \"").append(getBS(gapAft)).append("\")");
- } else {
- sb.append(isHor ? ",gapx " : ",gapy ").append(getBS(gapBef));
- if (gapAft != null)
- sb.append(' ').append(getBS(gapAft));
- }
- }
- }
-
- private static void appendBoundSize(BoundSize size, StringBuffer sb, boolean isHor, boolean asAPI)
- {
- if (size.isUnset() == false) {
- if (size.getPreferred() == null) {
- if (size.getMin() == null) {
- if (asAPI) {
- sb.append(isHor ? ".maxWidth(\"" : ".maxHeight(\"").append(getUV(size.getMax())).append("\")");
- } else {
- sb.append(isHor ? ",wmax " : ",hmax ").append(getUV(size.getMax()));
- }
-
- } else if (size.getMax() == null) {
- if (asAPI) {
- sb.append(isHor ? ".minWidth(\"" : ".minHeight(\"").append(getUV(size.getMin())).append("\")");
- } else {
- sb.append(isHor ? ",wmin " : ",hmin ").append(getUV(size.getMin()));
- }
- } else { // None are null
- if (asAPI) {
- sb.append(isHor ? ".width(\"" : ".height(\"").append(getUV(size.getMin())).append("::").append(getUV(size.getMax())).append("\")");
- } else {
- sb.append(isHor ? ",width " : ",height ").append(getUV(size.getMin())).append("::").append(getUV(size.getMax()));
- }
- }
- } else {
- if (asAPI) {
- sb.append(isHor ? ".width(\"" : ".height(\"").append(getBS(size)).append("\")");
- } else {
- sb.append(isHor ? ",width " : ",height ").append(getBS(size));
- }
- }
- }
- }
-
- /** Returns the a constraint string that can be re-parsed to be the exact same LayoutConstraint.
- * @param cc The component constraint to return as a constraint string.
- * @param asAPI If the returned string should be of API type (e.g. .flowX().gap("rel").align("right")) or
- * as a String type (e.g. "flowx, gap rel, right").
- * @return A String. Never <code>null</code>.
- */
- public static String getConstraintString(CC cc, boolean asAPI)
- {
- StringBuffer sb = new StringBuffer(16);
-
- if (cc.isNewline())
- sb.append(asAPI ? ".newline()" : ",newline");
-
- if (cc.isExternal())
- sb.append(asAPI ? ".external()" : ",external");
-
- Boolean flowX = cc.getFlowX();
- if (flowX != null) {
- if (asAPI) {
- sb.append(flowX ? ".flowX()" : ".flowY()");
- } else {
- sb.append(flowX ? ",flowx" : ",flowy");
- }
- }
-
- UnitValue[] pad = cc.getPadding();
- if (pad != null) {
- sb.append(asAPI ? ".pad(\"" : ",pad ");
- for (int i = 0; i < pad.length; i++)
- sb.append(getUV(pad[i])).append(i < pad.length - 1 ? " " : "");
- if (asAPI)
- sb.append("\")");
- }
-
- UnitValue[] pos = cc.getPos();
- if (pos != null) {
- if (cc.isBoundsInGrid()) {
- for (int i = 0; i < 4; i++) {
- if (pos[i] != null) {
- if (asAPI) {
- sb.append('.').append(X_Y_STRINGS[i]).append("(\"").append(getUV(pos[i])).append("\")");
- } else {
- sb.append(',').append(X_Y_STRINGS[i]).append(getUV(pos[i]));
- }
- }
- }
- } else {
- sb.append(asAPI ? ".pos(\"" : ",pos ");
- int iSz = (pos[2] != null || pos[3] != null) ? 4 : 2; // "pos x y" vs "pos x1 y1 x2 y2".
- for (int i = 0; i < iSz; i++)
- sb.append(getUV(pos[i])).append(i < iSz - 1 ? " " : "");
-
- if (asAPI)
- sb.append("\")");
- }
- }
-
- String id = cc.getId();
- if (id != null) {
- if (asAPI) {
- sb.append(".id(\"").append(id).append("\")");
- } else {
- sb.append(",id ").append(id);
- }
- }
-
- String tag = cc.getTag();
- if (tag != null) {
- if (asAPI) {
- sb.append(".tag(\"").append(tag).append("\")");
- } else {
- sb.append(",tag ").append(tag);
- }
- }
-
- int hideMode = cc.getHideMode();
- if (hideMode >= 0) {
- if (asAPI) {
- sb.append(".hidemode(").append(hideMode).append(')');
- } else {
- sb.append(",hidemode ").append(hideMode);
- }
- }
-
- int skip = cc.getSkip();
- if (skip > 0) {
- if (asAPI) {
- sb.append(".skip(").append(skip).append(')');
- } else {
- sb.append(",skip ").append(skip);
- }
- }
-
- int split = cc.getSplit();
- if (split > 1) {
- String s = split == LayoutUtil.INF ? "" : String.valueOf(split);
- if (asAPI) {
- sb.append(".split(").append(s).append(')');
- } else {
- sb.append(",split ").append(s);
- }
- }
-
- int cx = cc.getCellX();
- int cy = cc.getCellY();
- int spanX = cc.getSpanX();
- int spanY = cc.getSpanY();
- if (cx >= 0 && cy >= 0) {
- if (asAPI) {
- sb.append(".cell(").append(cx).append(", ").append(cy);
- if (spanX > 1 || spanY > 1)
- sb.append(", ").append(spanX).append(", ").append(spanY);
- sb.append(')');
- } else {
- sb.append(",cell ").append(cx).append(' ').append(cy);
- if (spanX > 1 || spanY > 1)
- sb.append(' ').append(spanX).append(' ').append(spanY);
- }
- } else if (spanX > 1 || spanY > 1) {
- if (spanX > 1 && spanY > 1) {
- sb.append(asAPI ? ".span(" : ",span ").append(spanX).append(asAPI ? ", " : " ").append(spanY);
- } else if (spanX > 1) {
- sb.append(asAPI ? ".spanX(" : ",spanx ").append(spanX == LayoutUtil.INF ? "" : (String.valueOf(spanX)));
- } else if (spanY > 1) {
- sb.append(asAPI ? ".spanY(" : ",spany ").append(spanY == LayoutUtil.INF ? "" : (String.valueOf(spanY)));
- }
- if (asAPI)
- sb.append(')');
- }
-
- Float pushX = cc.getPushX();
- Float pushY = cc.getPushY();
- if (pushX != null || pushY != null) {
- if (pushX != null && pushY != null) {
- sb.append(asAPI ? ".push(" : ",push ");
- if (pushX != 100.0 || pushY != 100.0)
- sb.append(pushX).append(asAPI ? ", " : " ").append(pushY);
- } else if (pushX != null) {
- sb.append(asAPI ? ".pushX(" : ",pushx ").append(pushX == 100 ? "" : (String.valueOf(pushX)));
- } else if (pushY != null) {
- sb.append(asAPI ? ".pushY(" : ",pushy ").append(pushY == 100 ? "" : (String.valueOf(pushY)));
- }
- if (asAPI)
- sb.append(')');
- }
-
- int dock = cc.getDockSide();
- if (dock >= 0) {
- String ds = CC.DOCK_SIDES[dock];
- if (asAPI) {
- sb.append(".dock").append(Character.toUpperCase(ds.charAt(0))).append(ds.substring(1)).append("()");
- } else {
- sb.append(",").append(ds);
- }
- }
-
- boolean noGrowAdd = cc.getHorizontal().getGrow() != null && cc.getHorizontal().getGrow().intValue() == 100 &&
- cc.getVertical().getGrow() != null && cc.getVertical().getGrow().intValue() == 100;
-
- addComponentDimConstraintString(cc.getHorizontal(), sb, asAPI, true, noGrowAdd);
- addComponentDimConstraintString(cc.getVertical(), sb, asAPI, false, noGrowAdd);
- if (noGrowAdd)
- sb.append(asAPI ? ".grow()" : ",grow"); // Combine ".growX().growY()" into ".grow()".
-
- if (cc.isWrap())
- sb.append(asAPI ? ".wrap()" : ",wrap");
-
- String s = sb.toString();
- return s.length() == 0 || s.charAt(0) != ',' ? s : s.substring(1);
- }
-
- /** Returns the a constraint string that can be re-parsed to be the exact same LayoutConstraint.
- * @param lc The layout constraint to return as a constraint string.
- * @param asAPI If the returned string should be of API type (e.g. .flowX().gap("rel").align("right")) or
- * as a String type (e.g. "flowx, gap rel, right").
- * @return A String. Never <code>null</code>.
- */
- public static String getConstraintString(LC lc, boolean asAPI)
- {
- StringBuffer sb = new StringBuffer(16);
-
- if (lc.isFlowX() == false)
- sb.append(asAPI ? ".flowY()" : ",flowy");
-
- boolean fillX = lc.isFillX();
- boolean fillY = lc.isFillY();
- if (fillX || fillY) {
- if (fillX == fillY) {
- sb.append(asAPI ? ".fill()" : ",fill");
- } else {
- sb.append(asAPI ? (fillX ? ".fillX()" : ".fillY()") : (fillX ? ",fillx" : ",filly"));
- }
- }
-
- Boolean leftToRight = lc.getLeftToRight();
- if (leftToRight != null) {
- if (asAPI) {
- sb.append(".leftToRight(").append(leftToRight).append(')');
- } else {
- sb.append(leftToRight ? ",ltr" : ",rtl");
- }
- }
-
- if (!lc.getPackWidth().isUnset() || !lc.getPackHeight().isUnset()) {
- if (asAPI) {
- String w = getBS(lc.getPackWidth());
- String h = getBS(lc.getPackHeight());
- sb.append(".pack(");
- if (w.equals("pref") && h.equals("pref")) {
- sb.append(')');
- } else {
- sb.append('\"').append(w).append("\", \"").append(h).append("\")");
- }
- } else {
- sb.append(",pack");
- String size = getBS(lc.getPackWidth()) + " " + getBS(lc.getPackHeight());
- if (size.equals("pref pref") == false)
- sb.append(' ').append(size);
- }
- }
-
- if (lc.getPackWidthAlign() != 0.5f || lc.getPackHeightAlign() != 1f) {
- if (asAPI) {
- sb.append(".packAlign(").append(floatToString(lc.getPackWidthAlign(), asAPI)).append(", ").append(floatToString(lc.getPackHeightAlign(), asAPI)).append(')');
- } else {
- sb.append(",packalign ").append(floatToString(lc.getPackWidthAlign(), asAPI)).append(' ').append(floatToString(lc.getPackHeightAlign(), asAPI));
- }
- }
-
- if (lc.isTopToBottom() == false)
- sb.append(asAPI ? ".bottomToTop()" : ",btt");
-
- UnitValue[] insets = lc.getInsets();
- if (insets != null) {
- String cs = LayoutUtil.getCCString(insets);
- if (cs != null) {
- if (asAPI) {
- sb.append(".insets(\"").append(cs).append("\")");
- } else {
- sb.append(",insets ").append(cs);
- }
- } else {
- sb.append(asAPI ? ".insets(\"" : ",insets ");
- for (int i = 0; i < insets.length; i++)
- sb.append(getUV(insets[i])).append(i < insets.length - 1 ? " " : "");
- if (asAPI)
- sb.append("\")");
- }
- }
-
- if (lc.isNoGrid())
- sb.append(asAPI ? ".noGrid()" : ",nogrid");
-
- if (lc.isVisualPadding() == false)
- sb.append(asAPI ? ".noVisualPadding()" : ",novisualpadding");
-
- int hideMode = lc.getHideMode();
- if (hideMode > 0) {
- if (asAPI) {
- sb.append(".hideMode(").append(hideMode).append(')');
- } else {
- sb.append(",hideMode ").append(hideMode);
- }
- }
-
- appendBoundSize(lc.getWidth(), sb, true, asAPI);
- appendBoundSize(lc.getHeight(), sb, false, asAPI);
-
- UnitValue alignX = lc.getAlignX();
- UnitValue alignY = lc.getAlignY();
- if (alignX != null || alignY != null) {
- if (alignX != null && alignY != null) {
- sb.append(asAPI ? ".align(\"" : ",align ").append(getUV(alignX)).append(' ').append(getUV(alignY));
- } else if (alignX != null) {
- sb.append(asAPI ? ".alignX(\"" : ",alignx ").append(getUV(alignX));
- } else if (alignY != null) {
- sb.append(asAPI ? ".alignY(\"" : ",aligny ").append(getUV(alignY));
- }
- if (asAPI)
- sb.append("\")");
- }
-
- BoundSize gridGapX = lc.getGridGapX();
- BoundSize gridGapY = lc.getGridGapY();
- if (gridGapX != null || gridGapY != null) {
- if (gridGapX != null && gridGapY != null) {
- sb.append(asAPI ? ".gridGap(\"" : ",gap ").append(getBS(gridGapX)).append(' ').append(getBS(gridGapY));
- } else if (gridGapX != null) {
- sb.append(asAPI ? ".gridGapX(\"" : ",gapx ").append(getBS(gridGapX));
- } else if (gridGapY != null) {
- sb.append(asAPI ? ".gridGapY(\"" : ",gapy ").append(getBS(gridGapY));
- }
- if (asAPI)
- sb.append("\")");
- }
-
- int wrapAfter = lc.getWrapAfter();
- if (wrapAfter != LayoutUtil.INF) {
- String ws = wrapAfter > 0 ? String.valueOf(wrapAfter) : "";
- if (asAPI) {
- sb.append(".wrap(").append(ws).append(')');
- } else {
- sb.append(",wrap ").append(ws);
- }
- }
-
- int debugMillis = lc.getDebugMillis();
- if (debugMillis > 0) {
- if (asAPI) {
- sb.append(".debug(").append(debugMillis).append(')');
- } else {
- sb.append(",debug ").append(debugMillis);
- }
- }
-
- String s = sb.toString();
- return s.length() == 0 || s.charAt(0) != ',' ? s : s.substring(1);
- }
-
- private static String getUV(UnitValue uv)
- {
- return uv != null ? uv.getConstraintString() : "null";
- }
-
- private static String getBS(BoundSize bs)
- {
- return bs != null ? bs.getConstraintString() : "null";
- }
-
- /** Converts a <code>float</code> to a string and is removing the ".0" if the float is an integer.
- * @param f the float.
- * @return <code>f</code> as a string. Never <code>null</code>.
- */
- private static String floatToString(float f, boolean asAPI)
- {
- String valS = String.valueOf(f);
- return valS.endsWith(".0") ? valS.substring(0, valS.length() - 2) : (valS + (asAPI ? "f" : ""));
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/InCellGapProvider.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/InCellGapProvider.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/InCellGapProvider.java
deleted file mode 100644
index 3bffe24..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/InCellGapProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package net.miginfocom.layout;
-
-/*
- * 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
- */
-
-/** An interface to implement if you want to decide the gaps between two types of components within the same cell.
- * <p>
- * E.g.:
- *
- * <pre>
- * if (adjacentComp == null || adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.TOP)
- * return null;
- *
- * boolean isHor = (adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.RIGHT);
- *
- * if (adjacentComp.getComponentType(false) == ComponentWrapper.TYPE_LABEL && comp.getComponentType(false) == ComponentWrapper.TYPE_TEXT_FIELD)
- * return isHor ? UNRELATED_Y : UNRELATED_Y;
- *
- * return (adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.RIGHT) ? RELATED_X : RELATED_Y;
- * </pre
- */
-public interface InCellGapProvider
-{
- /** Returns the default gap between two components that <b>are in the same cell</b>.
- * @param comp The component that the gap is for. Never <code>null</code>.
- * @param adjacentComp The adjacent component if any. May be <code>null</code>.
- * @param adjacentSide What side the <code>adjacentComp</code> is on. {@link javax.swing.SwingUtilities#TOP} or
- * {@link javax.swing.SwingUtilities#LEFT} or {@link javax.swing.SwingUtilities#BOTTOM} or {@link javax.swing.SwingUtilities#RIGHT}.
- * @param tag The tag string that the component might be tagged with in the component constraints. May be <code>null</code>.
- * @param isLTR If it is left-to-right.
- * @return The default gap between two components or <code>null</code> if there should be no gap.
- */
- public abstract BoundSize getDefaultGap(ComponentWrapper comp, ComponentWrapper adjacentComp, int adjacentSide, String tag, boolean isLTR);
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LC.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LC.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LC.java
deleted file mode 100644
index 058cbff..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LC.java
+++ /dev/null
@@ -1,1032 +0,0 @@
-package net.miginfocom.layout;
-
-import java.io.*;
-/*
- * 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
- */
-
-/** Contains the constraints for an instance of the {@link LC} layout manager.
- */
-public final class LC implements Externalizable
-{
- // See the corresponding set/get method for documentation of the property!
-
- private int wrapAfter = LayoutUtil.INF;
-
- private Boolean leftToRight = null;
-
- private UnitValue[] insets = null; // Never null elememts but if unset array is null
-
- private UnitValue alignX = null, alignY = null;
-
- private BoundSize gridGapX = null, gridGapY = null;
-
- private BoundSize width = BoundSize.NULL_SIZE, height = BoundSize.NULL_SIZE;
-
- private BoundSize packW = BoundSize.NULL_SIZE, packH = BoundSize.NULL_SIZE;
-
- private float pwAlign = 0.5f, phAlign = 1.0f;
-
- private int debugMillis = 0;
-
- private int hideMode = 0;
-
- private boolean noCache = false;
-
- private boolean flowX = true;
-
- private boolean fillX = false, fillY = false;
-
- private boolean topToBottom = true;
-
- private boolean noGrid = false;
-
- private boolean visualPadding = true;
-
- /** Empty constructor.
- */
- public LC()
- {
- }
-
- // ************************************************************************
- // * JavaBean get/set methods.
- // ************************************************************************
-
-
- /** If components have sizes or positions linked to the bounds of the parent in some way (as for instance the <code>"%"</code> unit has) the cache
- * must be turned off for the panel. If components does not get the correct or expected size or position try to set this property to <code>true</code>.
- * @return <code>true</code> means no cache and slightly slower layout.
- */
- public boolean isNoCache()
- {
- return noCache;
- }
-
- /** If components have sizes or positions linked to the bounds of the parent in some way (as for instance the <code>"%"</code> unit has) the cache
- * must be turned off for the panel. If components does not get the correct or expected size or position try to set this property to <code>true</code>.
- * @param b <code>true</code> means no cache and slightly slower layout.
- */
- public void setNoCache(boolean b)
- {
- this.noCache = b;
- }
-
- /** If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components
- * in the parent. <code>null</code> is default and that means top/left alignment. The relative distances between the components will not be affected
- * by this property.
- * @return The current alignment.
- */
- public final UnitValue getAlignX()
- {
- return alignX;
- }
-
- /** If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components
- * in the parent. <code>null</code> is default and that means top/left alignment. The relative distances between the components will not be affected
- * by this property.
- * @param uv The new alignment. Use {@link ConstraintParser#parseAlignKeywords(String, boolean)} to create the {@link UnitValue}. May be <code>null</code>.
- */
- public final void setAlignX(UnitValue uv)
- {
- this.alignX = uv;
- }
-
- /** If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components
- * in the parent. <code>null</code> is default and that means top/left alignment. The relative distances between the components will not be affected
- * by this property.
- * @return The current alignment.
- */
- public final UnitValue getAlignY()
- {
- return alignY;
- }
-
- /** If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components
- * in the parent. <code>null</code> is default and that means top/left alignment. The relative distances between the components will not be affected
- * by this property.
- * @param uv The new alignment. Use {@link ConstraintParser#parseAlignKeywords(String, boolean)} to create the {@link UnitValue}. May be <code>null</code>.
- */
- public final void setAlignY(UnitValue uv)
- {
- this.alignY = uv;
- }
-
- /** If <code>> 0</code> the debug decorations will be repainted every <code>millis</code>. No debug information if <code><= 0</code> (default).
- * @return The current debug repaint interval.
- */
- public final int getDebugMillis()
- {
- return debugMillis;
- }
-
- /** If <code>> 0</code> the debug decorations will be repainted every <code>millis</code>. No debug information if <code><= 0</code> (default).
- * @param millis The new debug repaint interval.
- */
- public final void setDebugMillis(int millis)
- {
- this.debugMillis = millis;
- }
-
- /** If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.
- * @return <code>true</code> means fill. <code>false</code> is default.
- */
- public final boolean isFillX()
- {
- return fillX;
- }
-
- /** If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.
- * @param b <code>true</code> means fill. <code>false</code> is default.
- */
- public final void setFillX(boolean b)
- {
- this.fillX = b;
- }
-
- /** If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.
- * @return <code>true</code> means fill. <code>false</code> is default.
- */
- public final boolean isFillY()
- {
- return fillY;
- }
-
- /** If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.
- * @param b <code>true</code> means fill. <code>false</code> is default.
- */
- public final void setFillY(boolean b)
- {
- this.fillY = b;
- }
-
- /** The default flow direction. Normally (which is <code>true</code>) this is horizontal and that means that the "next" component
- * will be put in the cell to the right (or to the left if left-to-right is false).
- * @return <code>true</code> is the default flow horizontally.
- * @see #setLeftToRight(Boolean)
- */
- public final boolean isFlowX()
- {
- return flowX;
- }
-
- /** The default flow direction. Normally (which is <code>true</code>) this is horizontal and that means that the "next" component
- * will be put in the cell to the right (or to the left if left-to-right is false).
- * @param b <code>true</code> is the default flow horizontally.
- * @see #setLeftToRight(Boolean)
- */
- public final void setFlowX(boolean b)
- {
- this.flowX = b;
- }
-
- /** If non-<code>null</code> (<code>null</code> is default) these value will be used as the default gaps between the columns in the grid.
- * @return The default grid gap between columns in the grid. <code>null</code> if the platform default is used.
- */
- public final BoundSize getGridGapX()
- {
- return gridGapX;
- }
-
- /** If non-<code>null</code> (<code>null</code> is default) these value will be used as the default gaps between the columns in the grid.
- * @param x The default grid gap between columns in the grid. If <code>null</code> the platform default is used.
- */
- public final void setGridGapX(BoundSize x)
- {
- this.gridGapX = x;
- }
-
- /** If non-<code>null</code> (<code>null</code> is default) these value will be used as the default gaps between the rows in the grid.
- * @return The default grid gap between rows in the grid. <code>null</code> if the platform default is used.
- */
- public final BoundSize getGridGapY()
- {
- return gridGapY;
- }
-
- /** If non-<code>null</code> (<code>null</code> is default) these value will be used as the default gaps between the rows in the grid.
- * @param y The default grid gap between rows in the grid. If <code>null</code> the platform default is used.
- */
- public final void setGridGapY(BoundSize y)
- {
- this.gridGapY = y;
- }
-
- /** How a component that is hidden (not visible) should be treated by default.
- * @return The mode:<br>
- * 0 == Normal. Bounds will be caclulated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- */
- public final int getHideMode()
- {
- return hideMode;
- }
-
- /** How a component that is hidden (not visible) should be treated.
- * @param mode The mode:<br>
- * 0 == Normal. Bounds will be caclulated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- */
- public final void setHideMode(int mode)
- {
- if (mode < 0 || mode > 3)
- throw new IllegalArgumentException("Wrong hideMode: " + mode);
-
- this.hideMode = mode;
- }
-
- /** The insets for the layed out panel. The insets will be an empty space around the components in the panel. <code>null</code> values
- * means that the default panel insets for the platform is used. See {@link PlatformDefaults#setDialogInsets(net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue)}.
- * @return The insets. Of length 4 (top, left, bottom, right) or <code>null</code>. The elements (1 to 4) may be <code>null</code>. The array is a copy and can be used freely.
- * @see net.miginfocom.layout.ConstraintParser#parseInsets(String, boolean)
- */
- public final UnitValue[] getInsets()
- {
- return insets != null ? new UnitValue[] {insets[0], insets[1], insets[2], insets[3]} : null;
- }
-
- /** The insets for the layed out panel. The insets will be an empty space around the components in the panel. <code>null</code> values
- * means that the default panel insets for the platform is used. See {@link PlatformDefaults#setDialogInsets(net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue)}.
- * @param ins The new insets. Must be of length 4 (top, left, bottom, right) or <code>null</code>. The elements (1 to 4) may be <code>null</code> to use
- * the platform default for that side. The array is copied for storage.
- * @see net.miginfocom.layout.ConstraintParser#parseInsets(String, boolean)
- */
- public final void setInsets(UnitValue[] ins)
- {
- this.insets = ins != null ? new UnitValue[] {ins[0], ins[1], ins[2], ins[3]} : null;
- }
-
- /** If the layout should be forced to be left-to-right or right-to-left. A value of <code>null</code> is default and
- * means that this will be picked up from the {@link java.util.Locale} that the container being layed out is reporting.
- * @return <code>Boolean.TRUE</code> if force left-to-right. <code>Boolean.FALSE</code> if force tight-to-left. <code>null</code>
- * for the default "let the current Locale decide".
- */
- public final Boolean getLeftToRight()
- {
- return leftToRight;
- }
-
- /** If the layout should be forced to be left-to-right or right-to-left. A value of <code>null</code> is default and
- * means that this will be picked up from the {@link java.util.Locale} that the container being layed out is reporting.
- * @param b <code>Boolean.TRUE</code> to force left-to-right. <code>Boolean.FALSE</code> to force tight-to-left. <code>null</code>
- * for the default "let the current Locale decide".
- */
- public final void setLeftToRight(Boolean b)
- {
- this.leftToRight = b;
- }
-
- /** If the whole layout should be non grid based. It is the same as setting the "nogrid" property on every row/column in the grid.
- * @return <code>true</code> means not grid based. <code>false</code> is default.
- */
- public final boolean isNoGrid()
- {
- return noGrid;
- }
-
- /** If the whole layout should be non grid based. It is the same as setting the "nogrid" property on every row/column in the grid.
- * @param b <code>true</code> means no grid. <code>false</code> is default.
- */
- public final void setNoGrid(boolean b)
- {
- this.noGrid = b;
- }
-
- /** If the layout should go from the default top-to-bottom in the grid instead of the optinal bottom-to-top.
- * @return <code>true</code> for the default top-to-bottom.
- */
- public final boolean isTopToBottom()
- {
- return topToBottom;
- }
-
- /** If the layout should go from the default top-to-bottom in the grid instead of the optinal bottom-to-top.
- * @param b <code>true</code> for the default top-to-bottom.
- */
- public final void setTopToBottom(boolean b)
- {
- this.topToBottom = b;
- }
-
- /** If visual padding should be automatically used and compensated for by this layout instance.
- * @return <code>true</code> if visual padding.
- */
- public final boolean isVisualPadding()
- {
- return visualPadding;
- }
-
- /** If visual padding should be automatically used and compensated for by this layout instance.
- * @param b <code>true</code> turns on visual padding.
- */
- public final void setVisualPadding(boolean b)
- {
- this.visualPadding = b;
- }
-
- /** Returns after what cell the grid should always auto wrap.
- * @return After what cell the grid should always auto wrap. If <code>0</code> the number of columns/rows in the
- * {@link net.miginfocom.layout.AC} is used. <code>LayoutUtil.INF</code> is used for no auto wrap.
- */
- public final int getWrapAfter()
- {
- return wrapAfter;
- }
-
- /** Sets after what cell the grid should always auto wrap.
- * @param count After what cell the grid should always auto wrap. If <code>0</code> the number of columns/rows in the
- * {@link net.miginfocom.layout.AC} is used. <code>LayoutUtil.INF</code> is used for no auto wrap.
- */
- public final void setWrapAfter(int count)
- {
- this.wrapAfter = count;
- }
-
- /** Returns the "pack width" for the <b>window</b> that this container is located in. When the size of this container changes
- * the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window
- * as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred"
- * is the normal value to set here.
- * <p>
- * ":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.
- * <p>
- * E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"
- * @return The current value. Never <code>null</code>. Check if not set with <code>.isUnset()</code>.
- * @since 3.5
- */
- public final BoundSize getPackWidth()
- {
- return packW;
- }
-
- /** Sets the "pack width" for the <b>window</b> that this container is located in. When the size of this container changes
- * the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window
- * as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred"
- * is the normal value to set here.
- * <p>
- * ":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.
- * <p>
- * E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"
- * @param size The new pack size. If <code>null</code> it will be corrected to an "unset" BoundSize.
- * @since 3.5
- */
- public final void setPackWidth(BoundSize size)
- {
- packW = size != null ? size : BoundSize.NULL_SIZE;
- }
-
- /** Returns the "pack height" for the <b>window</b> that this container is located in. When the size of this container changes
- * the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window
- * as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred"
- * is the normal value to set here.
- * <p>
- * ":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.
- * <p>
- * E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"
- * @return The current value. Never <code>null</code>. Check if not set with <code>.isUnset()</code>.
- * @since 3.5
- */
- public final BoundSize getPackHeight()
- {
- return packH;
- }
-
- /** Sets the "pack height" for the <b>window</b> that this container is located in. When the size of this container changes
- * the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window
- * as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred"
- * is the normal value to set here.
- * <p>
- * ":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.
- * <p>
- * E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"
- * @param size The new pack size. If <code>null</code> it will be corrected to an "unset" BoundSize.
- * @since 3.5
- */
- public final void setPackHeight(BoundSize size)
- {
- packH = size != null ? size : BoundSize.NULL_SIZE;
- }
-
-
- /** If there is a resize of the window due to packing (see {@link #setPackHeight(BoundSize)} this value, which is between 0f and 1f,
- * decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the upper part moves up and the
- * lower side stays in the same place. 0.5f will expand/reduce the window equally upwards and downwards. 1f will do the opposite of 0f
- * of course.
- * @return The pack alignment. Always between 0f and 1f, inclusive.
- * @since 3.5
- */
- public final float getPackHeightAlign()
- {
- return phAlign;
- }
-
- /** If there is a resize of the window due to packing (see {@link #setPackHeight(BoundSize)} this value, which is between 0f and 1f,
- * decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the upper part moves up and the
- * lower side stays in the same place. 0.5f will expand/reduce the window equally upwards and downwards. 1f will do the opposite of 0f
- * of course.
- * @param align The pack alignment. Always between 0f and 1f, inclusive. Values outside this will be truncated.
- * @since 3.5
- */
- public final void setPackHeightAlign(float align)
- {
- phAlign = Math.max(0f, Math.min(1f, align));
- }
-
- /** If there is a resize of the window due to packing (see {@link #setPackHeight(BoundSize)} this value, which is between 0f and 1f,
- * decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the left part moves left and the
- * right side stays in the same place. 0.5f will expand/reduce the window equally to the right and lefts. 1f will do the opposite of 0f
- * of course.
- * @return The pack alignment. Always between 0f and 1f, inclusive.
- * @since 3.5
- */
- public final float getPackWidthAlign()
- {
- return pwAlign;
- }
-
- /** If there is a resize of the window due to packing (see {@link #setPackHeight(BoundSize)} this value, which is between 0f and 1f,
- * decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the left part moves left and the
- * right side stays in the same place. 0.5f will expand/reduce the window equally to the right and lefts. 1f will do the opposite of 0f
- * of course.
- * @param align The pack alignment. Always between 0f and 1f, inclusive. Values outside this will be truncated.
- * @since 3.5
- */
- public final void setPackWidthAlign(float align)
- {
- pwAlign = Math.max(0f, Math.min(1f, align));
- }
-
- /** Returns the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these
- * sizes that is not <code>null</code> will be returned directly instead of determining the correspondig size through
- * asking the components in this container.
- * @return The width for the container that this layout constraint is set for. Not <code>null</code> but
- * all sizes can be <code>null</code>.
- * @since 3.5
- */
- public final BoundSize getWidth()
- {
- return width;
- }
-
- /** Sets the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these
- * sizes that is not <code>null</code> will be returned directly instead of determining the correspondig size through
- * asking the components in this container.
- * @param size The width for the container that this layout constraint is set for. <code>null</code> is translated to
- * a bound size containing only null sizes.
- * @since 3.5
- */
- public final void setWidth(BoundSize size)
- {
- this.width = size != null ? size : BoundSize.NULL_SIZE;
- }
-
- /** Returns the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these
- * sizes that is not <code>null</code> will be returned directly instead of determining the correspondig size through
- * asking the components in this container.
- * @return The height for the container that this layout constraint is set for. Not <code>null</code> but
- * all sizes can be <code>null</code>.
- * @since 3.5
- */
- public final BoundSize getHeight()
- {
- return height;
- }
-
- /** Sets the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these
- * sizes that is not <code>null</code> will be returned directly instead of determining the correspondig size through
- * asking the components in this container.
- * @param size The height for the container that this layout constraint is set for. <code>null</code> is translated to
- * a bound size containing only null sizes.
- * @since 3.5
- */
- public final void setHeight(BoundSize size)
- {
- this.height = size != null ? size : BoundSize.NULL_SIZE;
- }
-
- // ************************************************************************
- // * Builder methods.
- // ************************************************************************
-
- /** Short for, and thus same as, <code>.pack("pref", "pref")</code>.
- * <p>
- * Same functionality as {@link #setPackHeight(BoundSize)} and {@link #setPackWidth(net.miginfocom.layout.BoundSize)}
- * only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.5
- */
- public final LC pack()
- {
- return pack("pref", "pref");
- }
-
- /** Sets the pack width and height.
- * <p>
- * Same functionality as {@link #setPackHeight(BoundSize)} and {@link #setPackWidth(net.miginfocom.layout.BoundSize)}
- * only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param width The pack width. May be <code>null</code>.
- * @param height The pack height. May be <code>null</code>.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.5
- */
- public final LC pack(String width, String height)
- {
- setPackWidth(width != null ? ConstraintParser.parseBoundSize(width, false, false) : BoundSize.NULL_SIZE);
- setPackHeight(height != null ? ConstraintParser.parseBoundSize(height, false, false) : BoundSize.NULL_SIZE);
- return this;
- }
-
- /** Sets the pack width and height alignment.
- * <p>
- * Same functionality as {@link #setPackHeightAlign(float)} and {@link #setPackWidthAlign(float)}
- * only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param alignX The pack width alignment. 0.5f is default.
- * @param alignY The pack height alignment. 0.5f is default.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.5
- */
- public final LC packAlign(float alignX, float alignY)
- {
- setPackWidthAlign(alignX);
- setPackHeightAlign(alignY);
- return this;
- }
-
- /** Sets a wrap after the number of columns/rows that is defined in the {@link net.miginfocom.layout.AC}.
- * <p>
- * Same functionality as {@link #setWrapAfter(int 0)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC wrap()
- {
- setWrapAfter(0);
- return this;
- }
-
- /** Same functionality as {@link #setWrapAfter(int)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param count After what cell the grid should always auto wrap. If <code>0</code> the number of columns/rows in the
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC wrapAfter(int count)
- {
- setWrapAfter(count);
- return this;
- }
-
- /** Same functionality as {@link #setNoCache(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC noCache()
- {
- setNoCache(true);
- return this;
- }
-
- /** Same functionality as {@link #setFlowX(boolean false)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC flowY()
- {
- setFlowX(false);
- return this;
- }
-
- /** Same functionality as {@link #setFlowX(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC flowX()
- {
- setFlowX(true);
- return this;
- }
-
- /** Same functionality as {@link #setFillX(boolean true)} and {@link #setFillY(boolean true)} conmbined.T his method returns
- * <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC fill()
- {
- setFillX(true);
- setFillY(true);
- return this;
- }
-
- /** Same functionality as {@link #setFillX(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC fillX()
- {
- setFillX(true);
- return this;
- }
-
- /** Same functionality as {@link #setFillY(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC fillY()
- {
- setFillY(true);
- return this;
- }
-
- /** Same functionality as {@link #setLeftToRight(Boolean)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param b <code>true</code> for forcing left-to-right. <code>false</code> for forcing right-to-left.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC leftToRight(boolean b)
- {
- setLeftToRight(b ? Boolean.TRUE : Boolean.FALSE);
- return this;
- }
-
- /** Same functionality as setLeftToRight(false) only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final LC rightToLeft()
- {
- setLeftToRight(Boolean.FALSE);
- return this;
- }
-
- /** Same functionality as {@link #setTopToBottom(boolean false)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC bottomToTop()
- {
- setTopToBottom(false);
- return this;
- }
-
- /** Same functionality as {@link #setTopToBottom(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final LC topToBottom()
- {
- setTopToBottom(true);
- return this;
- }
-
- /** Same functionality as {@link #setNoGrid(boolean true)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC noGrid()
- {
- setNoGrid(true);
- return this;
- }
-
- /** Same functionality as {@link #setVisualPadding(boolean false)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC noVisualPadding()
- {
- setVisualPadding(false);
- return this;
- }
-
- /** Sets the same inset (expressed as a <code>UnitValue</code>, e.g. "10px" or "20mm") all around.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param allSides The unit value to set for all sides. May be <code>null</code> which means that the default panel insets
- * for the platform is used.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setInsets(UnitValue[])
- */
- public final LC insetsAll(String allSides)
- {
- UnitValue insH = ConstraintParser.parseUnitValue(allSides, true);
- UnitValue insV = ConstraintParser.parseUnitValue(allSides, false);
- insets = new UnitValue[] {insV, insH, insV, insH}; // No setter to avoid copy again
- return this;
- }
-
- /** Same functionality as <code>setInsets(ConstraintParser.parseInsets(s, true))</code>. This method returns <code>this</code>
- * for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The string to parse. E.g. "10 10 10 10" or "20". If less than 4 groups the last will be used for the missing.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setInsets(UnitValue[])
- */
- public final LC insets(String s)
- {
- insets = ConstraintParser.parseInsets(s, true);
- return this;
- }
-
- /** Sets the different insets (expressed as a <code>UnitValue</code>s, e.g. "10px" or "20mm") for the corresponding sides.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param top The top inset. E.g. "10px" or "10mm" or "related". May be <code>null</code> in which case the default inset for this
- * side for the platform will be used.
- * @param left The left inset. E.g. "10px" or "10mm" or "related". May be <code>null</code> in which case the default inset for this
- * side for the platform will be used.
- * @param bottom The bottom inset. E.g. "10px" or "10mm" or "related". May be <code>null</code> in which case the default inset for this
- * side for the platform will be used.
- * @param right The right inset. E.g. "10px" or "10mm" or "related". May be <code>null</code> in which case the default inset for this
- * side for the platform will be used.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setInsets(UnitValue[])
- */
- public final LC insets(String top, String left, String bottom, String right)
- {
- insets = new UnitValue[] { // No setter to avoid copy again
- ConstraintParser.parseUnitValue(top, false),
- ConstraintParser.parseUnitValue(left, true),
- ConstraintParser.parseUnitValue(bottom, false),
- ConstraintParser.parseUnitValue(right, true)};
- return this;
- }
-
- /** Same functionality as <code>setAlignX(ConstraintParser.parseUnitValueOrAlign(unitValue, true))</code> only this method returns <code>this</code>
- * for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param align The align keyword or for instance "100px". E.g "left", "right", "leading" or "trailing".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setAlignX(UnitValue)
- */
- public final LC alignX(String align)
- {
- setAlignX(ConstraintParser.parseUnitValueOrAlign(align, true, null));
- return this;
- }
-
- /** Same functionality as <code>setAlignY(ConstraintParser.parseUnitValueOrAlign(align, false))</code> only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param align The align keyword or for instance "100px". E.g "top" or "bottom".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setAlignY(UnitValue)
- */
- public final LC alignY(String align)
- {
- setAlignY(ConstraintParser.parseUnitValueOrAlign(align, false, null));
- return this;
- }
-
- /** Sets both the alignX and alignY as the same time.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param ax The align keyword or for instance "100px". E.g "left", "right", "leading" or "trailing".
- * @param ay The align keyword or for instance "100px". E.g "top" or "bottom".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #alignX(String)
- * @see #alignY(String)
- */
- public final LC align(String ax, String ay)
- {
- if (ax != null)
- alignX(ax);
-
- if (ay != null)
- alignY(ay);
-
- return this;
- }
-
- /** Same functionality as <code>setGridGapX(ConstraintParser.parseBoundSize(boundsSize, true, true))</code> only this method
- * returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param boundsSize The <code>BoundSize</code> of the gap. This is a minimum and/or preferred and/or maximum size. E.g.
- * <code>"50:100:200"</code> or <code>"100px"</code>.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setGridGapX(BoundSize)
- */
- public final LC gridGapX(String boundsSize)
- {
- setGridGapX(ConstraintParser.parseBoundSize(boundsSize, true, true));
- return this;
- }
-
- /** Same functionality as <code>setGridGapY(ConstraintParser.parseBoundSize(boundsSize, true, false))</code> only this method
- * returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param boundsSize The <code>BoundSize</code> of the gap. This is a minimum and/or preferred and/or maximum size. E.g.
- * <code>"50:100:200"</code> or <code>"100px"</code>.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setGridGapY(BoundSize)
- */
- public final LC gridGapY(String boundsSize)
- {
- setGridGapY(ConstraintParser.parseBoundSize(boundsSize, true, false));
- return this;
- }
-
- /** Sets both grid gaps at the same time. see {@link #gridGapX(String)} and {@link #gridGapY(String)}.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param gapx The <code>BoundSize</code> of the gap. This is a minimum and/or preferred and/or maximum size. E.g.
- * <code>"50:100:200"</code> or <code>"100px"</code>.
- * @param gapy The <code>BoundSize</code> of the gap. This is a minimum and/or preferred and/or maximum size. E.g.
- * <code>"50:100:200"</code> or <code>"100px"</code>.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #gridGapX(String)
- * @see #gridGapY(String)
- */
- public final LC gridGap(String gapx, String gapy)
- {
- if (gapx != null)
- gridGapX(gapx);
-
- if (gapy != null)
- gridGapY(gapy);
-
- return this;
- }
-
- /** Same functionality as {@link #setDebugMillis(int repaintMillis)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param repaintMillis The new debug repaint interval.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setDebugMillis(int)
- */
- public final LC debug(int repaintMillis)
- {
- setDebugMillis(repaintMillis);
- return this;
- }
-
- /** Same functionality as {@link #setHideMode(int mode)} only this method returns <code>this</code> for chaining multiple calls.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param mode The mode:<br>
- * 0 == Normal. Bounds will be calculated as if the component was visible.<br>
- * 1 == If hidden the size will be 0, 0 but the gaps remain.<br>
- * 2 == If hidden the size will be 0, 0 and gaps set to zero.<br>
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- * @see #setHideMode(int)
- */
- public final LC hideMode(int mode)
- {
- setHideMode(mode);
- return this;
- }
-
- /** The minimum width for the container. The value will override any value that is set on the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.
- * @param width The width expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC minWidth(String width)
- {
- setWidth(LayoutUtil.derive(getWidth(), ConstraintParser.parseUnitValue(width, true), null, null));
- return this;
- }
-
- /** The width for the container as a min and/or preferred and/or maximum width. The value will override any value that is set on
- * the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.
- * @param width The width expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC width(String width)
- {
- setWidth(ConstraintParser.parseBoundSize(width, false, true));
- return this;
- }
-
- /** The maximum width for the container. The value will override any value that is set on the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.
- * @param width The width expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC maxWidth(String width)
- {
- setWidth(LayoutUtil.derive(getWidth(), null, null, ConstraintParser.parseUnitValue(width, true)));
- return this;
- }
-
- /** The minimum height for the container. The value will override any value that is set on the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.
- * @param height The height expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC minHeight(String height)
- {
- setHeight(LayoutUtil.derive(getHeight(), ConstraintParser.parseUnitValue(height, false), null, null));
- return this;
- }
-
- /** The height for the container as a min and/or preferred and/or maximum height. The value will override any value that is set on
- * the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcontainers.com.
- * @param height The height expressed as a <code>BoundSize</code>. E.g. "50:100px:200mm" or "100px".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC height(String height)
- {
- setHeight(ConstraintParser.parseBoundSize(height, false, false));
- return this;
- }
-
- /** The maximum height for the container. The value will override any value that is set on the container itself.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcontainers.com.
- * @param height The height expressed as a <code>UnitValue</code>. E.g. "100px" or "200mm".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new LayoutConstraint().noGrid().gap().fill()</code>.
- */
- public final LC maxHeight(String height)
- {
- setHeight(LayoutUtil.derive(getHeight(), null, null, ConstraintParser.parseUnitValue(height, false)));
- return this;
- }
-
- // ************************************************
- // 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() == LC.class)
- LayoutUtil.writeAsXML(out, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutCallback.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutCallback.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutCallback.java
deleted file mode 100644
index f685fc0..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutCallback.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package net.miginfocom.layout;
-
-/*
- * 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
- */
-
-/** A class to extend if you want to provide more control over where a component is placed or the size of it.
- * <p>
- * Note! Returned arrays from this class will never be altered. This means that caching of arrays in these methods
- * is OK.
- */
-public abstract class LayoutCallback
-{
- /** Returns a position similar to the "pos" the component constraint.
- * @param comp The component wrapper that holds the actual component (JComponent is Swing and Control in SWT).
- * <b>Should not be altered.</b>
- * @return The [x, y, x2, y2] as explained in the documentation for "pos". If <code>null</code>
- * is returned nothing is done and this is the default.
- * @see UnitValue
- * @see net.miginfocom.layout.ConstraintParser#parseUnitValue(String, boolean)
- */
- public UnitValue[] getPosition(ComponentWrapper comp)
- {
- return null;
- }
-
- /** Returns a size similar to the "width" and "height" in the component constraint.
- * @param comp The component wrapper that holds the actual component (JComponent is Swing and Control in SWT).
- * <b>Should not be altered.</b>
- * @return The [width, height] as explained in the documentation for "width" and "height". If <code>null</code>
- * is returned nothing is done and this is the default.
- * @see net.miginfocom.layout.BoundSize
- * @see net.miginfocom.layout.ConstraintParser#parseBoundSize(String, boolean, boolean)
- */
- public BoundSize[] getSize(ComponentWrapper comp)
- {
- return null;
- }
-
- /** A last minute change of the bounds. The bound for the layout cycle has been set and you can correct there
- * after any set of rules you like.
- * @param comp The component wrapper that holds the actual component (JComponent is Swing and Control in SWT).
- */
- public void correctBounds(ComponentWrapper comp)
- {
- }
-}
[05/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/MigLayout.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/MigLayout.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/MigLayout.java
deleted file mode 100644
index bde68df..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/MigLayout.java
+++ /dev/null
@@ -1,701 +0,0 @@
-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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingComponentWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingComponentWrapper.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingComponentWrapper.java
deleted file mode 100644
index f802ee4..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingComponentWrapper.java
+++ /dev/null
@@ -1,459 +0,0 @@
-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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingContainerWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingContainerWrapper.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingContainerWrapper.java
deleted file mode 100644
index 2798c2b..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/swing/SwingContainerWrapper.java
+++ /dev/null
@@ -1,109 +0,0 @@
-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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionBuilderHelper.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
deleted file mode 100644
index 0b25076..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionBuilderHelper.java
+++ /dev/null
@@ -1,241 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
deleted file mode 100644
index ab606d5..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionContainerBuilderFactory.java
+++ /dev/null
@@ -1,89 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionDropDownMenu.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
deleted file mode 100644
index b5384c6..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionDropDownMenu.java
+++ /dev/null
@@ -1,91 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionGroup.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionGroup.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionGroup.java
deleted file mode 100644
index d829446..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/ActionGroup.java
+++ /dev/null
@@ -1,131 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/Actions.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/Actions.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/Actions.java
deleted file mode 100644
index 4585553..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/Actions.java
+++ /dev/null
@@ -1,83 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/CheckAction.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/CheckAction.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/CheckAction.java
deleted file mode 100644
index 3f15b8d..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/CheckAction.java
+++ /dev/null
@@ -1,39 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/IActionContainerBuilder.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
deleted file mode 100644
index 1c5f915..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/IActionContainerBuilder.java
+++ /dev/null
@@ -1,43 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/RadioAction.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/RadioAction.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/RadioAction.java
deleted file mode 100644
index 5fb93c0..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/RadioAction.java
+++ /dev/null
@@ -1,39 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/dropdown.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/dropdown.png b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/dropdown.png
deleted file mode 100644
index 8db7022..0000000
Binary files a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/action/dropdown.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/CommandLink.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/CommandLink.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/CommandLink.java
deleted file mode 100644
index c555156..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/CommandLink.java
+++ /dev/null
@@ -1,104 +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 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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
deleted file mode 100644
index e60a71a..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ContentDesignFactory.java
+++ /dev/null
@@ -1,55 +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 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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
deleted file mode 100644
index 2f0b183..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/ICommandLinkPainter.java
+++ /dev/null
@@ -1,43 +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.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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/IContentDesign.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
deleted file mode 100644
index bdfd1df..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/IContentDesign.java
+++ /dev/null
@@ -1,127 +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 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();
-
-}
[12/13] git commit: MARMOTTA-419: Swiched UI to plain AWT/Swing
Posted by ja...@apache.org.
MARMOTTA-419: Swiched UI to plain AWT/Swing
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0c8ccdb9
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0c8ccdb9
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0c8ccdb9
Branch: refs/heads/develop
Commit: 0c8ccdb98198f92247ae330dd37c8f974931cd8f
Parents: 75f106d
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Jan 10 14:48:09 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Jan 10 15:02:53 2014 +0100
----------------------------------------------------------------------
launchers/marmotta-installer/pom.xml | 18 ++
.../src/main/resources/installer/standalone.xml | 1 +
launchers/marmotta-splash/pom.xml | 4 +
.../marmotta/splash/ProgressListener.java | 2 +-
.../marmotta/splash/SplashContextListener.java | 2 +-
.../marmotta/splash/SplashScreenListener.java | 2 +-
.../splash/SplashScreenUpdaterBase.java | 2 +-
.../marmotta/splash/common/MarmottaContext.java | 2 +-
.../splash/common/MarmottaStartupHelper.java | 2 +-
.../splash/common/ui/MessageDialog.java | 142 ++++++++++++
.../splash/common/ui/SelectionDialog.java | 215 +++++++++++++++++++
.../splash/startup/StartupListener.java | 27 ++-
.../splash/systray/SystrayListener.java | 20 +-
.../splash/startup/StartupListenerTest.java | 26 +++
14 files changed, 440 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-installer/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/pom.xml b/launchers/marmotta-installer/pom.xml
index 1840233..2478fdd 100644
--- a/launchers/marmotta-installer/pom.xml
+++ b/launchers/marmotta-installer/pom.xml
@@ -210,6 +210,24 @@
</configuration>
</execution>
<execution>
+ <id>copy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <overWrite>false</overWrite>
+ <outputDirectory>${stagingDir}/lib</outputDirectory>
+ <destFileName>apache-commons-lang3.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
<id>unpack</id>
<phase>package</phase>
<goals>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-installer/src/main/resources/installer/standalone.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/src/main/resources/installer/standalone.xml b/launchers/marmotta-installer/src/main/resources/installer/standalone.xml
index 804163f..d6d68be 100644
--- a/launchers/marmotta-installer/src/main/resources/installer/standalone.xml
+++ b/launchers/marmotta-installer/src/main/resources/installer/standalone.xml
@@ -89,6 +89,7 @@
<file src="tomcat/index.jsp" targetdir="\$INSTALL_PATH/apache-tomcat-${TOMCAT_VERSION}/webapps/ROOT" override="true" />
<file src="log/catalina.out" targetdir="\$INSTALL_PATH/apache-tomcat-${TOMCAT_VERSION}/logs" />
<file src="lib/marmotta-splash-${MARMOTTA_VERSION}.jar" targetdir="\$INSTALL_PATH/apache-tomcat-${TOMCAT_VERSION}/lib" />
+ <file src="lib/apache-commons-lang3.jar" targetdir="\$INSTALL_PATH/apache-tomcat-${TOMCAT_VERSION}/lib" />
<!-- macos specific -->
<file src="macos/Start Apache Marmotta.app" targetdir="\$INSTALL_PATH" os="mac" />
<file src="images/icon_start.icns" targetdir="\$INSTALL_PATH/Start Apache Marmotta.app/Contents/Resources" os="mac" />
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/pom.xml b/launchers/marmotta-splash/pom.xml
index af5c5db..4b1e73f 100644
--- a/launchers/marmotta-splash/pom.xml
+++ b/launchers/marmotta-splash/pom.xml
@@ -44,6 +44,10 @@
<version>7.0.27.1</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/ProgressListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/ProgressListener.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/ProgressListener.java
index 6206d88..c105dd3 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/ProgressListener.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/ProgressListener.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashContextListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashContextListener.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashContextListener.java
index 2f46be4..32ee6e1 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashContextListener.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashContextListener.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenListener.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenListener.java
index cb02101..9eb2df0 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenListener.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenListener.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenUpdaterBase.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenUpdaterBase.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenUpdaterBase.java
index 2a07610..43d0b92 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenUpdaterBase.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/SplashScreenUpdaterBase.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaContext.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaContext.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaContext.java
index edc4708..beb3402 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaContext.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaContext.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaStartupHelper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaStartupHelper.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaStartupHelper.java
index 071cdcd..2fa9533 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaStartupHelper.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/MarmottaStartupHelper.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/MessageDialog.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/MessageDialog.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/MessageDialog.java
new file mode 100644
index 0000000..e6ecf58
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/MessageDialog.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.splash.common.ui;
+
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.WindowConstants;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.text.WordUtils;
+
+public class MessageDialog {
+
+ public static final String MARMOTTA_ICON = "/org/apache/marmotta/splash/systray/systray.png";
+
+ private MessageDialog() {
+ // static access only!
+ }
+
+ public static void info(String message) {
+ show("Info", message, "");
+ }
+
+ public static void info(String title, String message) {
+ show(title, message, "");
+ }
+
+ public static void show(String title, String message, String description) {
+ final JDialog dialog = new JDialog((Frame)null, title);
+ dialog.setModal(true);
+ dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
+
+ final JPanel root = new JPanel(new GridBagLayout());
+ root.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ dialog.getRootPane().setContentPane(root);
+
+ final JButton close = new JButton("OK");
+ close.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dialog.setVisible(false);
+ }
+ });
+ GridBagConstraints cClose = new GridBagConstraints();
+ cClose.gridx = 0;
+ cClose.gridy = 2;
+ cClose.gridwidth = 2;
+ cClose.weightx = 1;
+ cClose.weighty = 0;
+ cClose.insets = new Insets(5, 5, 5, 5);
+
+ root.add(close, cClose);
+ dialog.getRootPane().setDefaultButton(close);
+
+ Icon icon = loadIcon(MARMOTTA_ICON) ;
+ if (icon != null) {
+ JLabel lblIcn = new JLabel(icon);
+
+ GridBagConstraints cIcon = new GridBagConstraints();
+ cIcon.gridx = 1;
+ cIcon.gridy = 0;
+ cIcon.gridheight = 2;
+ cIcon.fill = GridBagConstraints.NONE;
+ cIcon.weightx = 0;
+ cIcon.weighty = 1;
+ cIcon.anchor = GridBagConstraints.NORTH;
+ cIcon.insets = new Insets(10, 5, 5, 0);
+ root.add(lblIcn, cIcon);
+ }
+
+ JLabel lblMsg = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(message).replaceAll("\\n", "<br>"));
+ lblMsg.setFont(lblMsg.getFont().deriveFont(Font.BOLD, 16f));
+ GridBagConstraints cLabel = new GridBagConstraints();
+ cLabel.gridx = 0;
+ cLabel.gridy = 0;
+ cLabel.fill = GridBagConstraints.BOTH;
+ cLabel.weightx = 1;
+ cLabel.weighty = 0.5;
+ cLabel.insets = new Insets(5, 5, 5, 5);
+ root.add(lblMsg, cLabel);
+
+ JLabel lblDescr = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(description).replaceAll("\\n", "<br>"));
+ cLabel.gridy++;
+ cLabel.insets = new Insets(0, 5, 5, 5);
+ root.add(lblDescr, cLabel);
+
+
+ dialog.pack();
+ dialog.setLocationRelativeTo(null);
+
+ dialog.setVisible(true);
+ dialog.dispose();
+ }
+
+ static Icon loadIcon() {
+ return loadIcon(MARMOTTA_ICON);
+ }
+
+ static Icon loadIcon(String icon) {
+ if (icon == null) return null;
+ final URL rsc = MessageDialog.class.getResource(icon);
+ if (rsc != null) {
+ return new ImageIcon(rsc);
+ } else {
+ return null;
+ }
+ }
+
+ public static void main(String[] args) {
+ show("Hello", "This is a test",
+ WordUtils.wrap("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", 55));
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/SelectionDialog.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/SelectionDialog.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/SelectionDialog.java
new file mode 100644
index 0000000..8f287c9
--- /dev/null
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/common/ui/SelectionDialog.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.splash.common.ui;
+
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.swing.AbstractButton;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.WindowConstants;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+
+public class SelectionDialog {
+
+
+ public static int select(String title, String message, String description, List<Option> options, int defaultOption) {
+ final JDialog dialog = new JDialog((Frame)null, title);
+ dialog.setModal(true);
+ dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
+
+ final AtomicInteger result = new AtomicInteger(Math.max(defaultOption,-1));
+
+ JButton defaultBtn = null;
+
+ final JPanel root = new JPanel(new GridBagLayout());
+ root.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ dialog.getRootPane().setContentPane(root);
+
+ JLabel lblMsg = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(message).replaceAll("\\n", "<br>"));
+ lblMsg.setFont(lblMsg.getFont().deriveFont(Font.BOLD, 16f));
+ GridBagConstraints cLabel = new GridBagConstraints();
+ cLabel.gridx = 0;
+ cLabel.gridy = 0;
+ cLabel.fill = GridBagConstraints.BOTH;
+ cLabel.weightx = 1;
+ cLabel.weighty = 0.5;
+ cLabel.insets = new Insets(5, 5, 5, 5);
+ root.add(lblMsg, cLabel);
+
+ JLabel lblDescr = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(description).replaceAll("\\n", "<br>"));
+ cLabel.gridy++;
+ cLabel.insets = new Insets(0, 5, 5, 5);
+ root.add(lblDescr, cLabel);
+
+ // All the options
+ cLabel.ipadx = 10;
+ cLabel.ipady = 10;
+ cLabel.insets = new Insets(5, 15, 0, 15);
+ for (int i = 0; i < options.size(); i++) {
+ cLabel.gridy++;
+
+ final Option o = options.get(i);
+ final JButton btn = new JButton("<html>"+StringEscapeUtils.escapeHtml3(o.label).replaceAll("\\n", "<br>"), MessageDialog.loadIcon(o.icon));
+ if (StringUtils.isNotBlank(o.info)) {
+ btn.setToolTipText("<html>"+StringEscapeUtils.escapeHtml3(o.info).replaceAll("\\n", "<br>"));
+ }
+
+ btn.setHorizontalAlignment(AbstractButton.LEADING);
+ btn.setVerticalTextPosition(AbstractButton.CENTER);
+ btn.setHorizontalTextPosition(AbstractButton.TRAILING);
+
+ final int myAnswer = i;
+ btn.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ result.set(myAnswer);
+ dialog.setVisible(false);
+ }
+ });
+
+ root.add(btn, cLabel);
+ if (i == defaultOption) {
+ dialog.getRootPane().setDefaultButton(btn);
+ defaultBtn = btn;
+ }
+ }
+
+ final Icon icon = MessageDialog.loadIcon() ;
+ if (icon != null) {
+ JLabel lblIcn = new JLabel(icon);
+
+ GridBagConstraints cIcon = new GridBagConstraints();
+ cIcon.gridx = 1;
+ cIcon.gridy = 0;
+ cIcon.gridheight = 2 + options.size();
+ cIcon.fill = GridBagConstraints.NONE;
+ cIcon.weightx = 0;
+ cIcon.weighty = 1;
+ cIcon.anchor = GridBagConstraints.NORTH;
+ cIcon.insets = new Insets(10, 5, 5, 0);
+ root.add(lblIcn, cIcon);
+ }
+
+ final JButton close = new JButton("Cancel");
+ close.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ result.set(-1);
+ dialog.setVisible(false);
+ }
+ });
+ GridBagConstraints cClose = new GridBagConstraints();
+ cClose.gridx = 0;
+ cClose.gridy = 2 + options.size();
+ cClose.gridwidth = 2;
+ cClose.weightx = 1;
+ cClose.weighty = 0;
+ cClose.insets = new Insets(15, 5, 5, 5);
+
+ root.add(close, cClose);
+ if (defaultOption < 0) {
+ dialog.getRootPane().setDefaultButton(close);
+ defaultBtn = close;
+ }
+
+
+ dialog.pack();
+ dialog.setLocationRelativeTo(null);
+ defaultBtn.requestFocusInWindow();
+
+ dialog.setVisible(true);
+ dialog.dispose();
+
+
+
+
+ return result.get();
+ }
+
+ public static class Option {
+ private String label, info;
+ private String icon;
+
+ public Option(String label) {
+ this(label, "", null);
+ }
+
+ public Option(String label, String info) {
+ this(label, info, null);
+ }
+
+ public Option(String label, String info, String icon) {
+ this.label = label;
+ this.info = info;
+ this.icon = icon;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+ }
+
+ public static void main(String[] args) {
+ final List<Option> options = Arrays.asList(
+ new Option("Option1\nfoo"),
+ new Option("Option2", "this is \nalso valid"),
+ new Option("Option3", "", MessageDialog.MARMOTTA_ICON));
+ final int choice = select("Question", "Please select", "what do you prefer?", options, 1);
+ if (choice < 0) {
+ System.out.println("No coice was made!");
+ } else {
+ System.out.printf("Your choice was %d%n%s (%s)", choice, options.get(choice).label, options.get(choice).info);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/startup/StartupListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/startup/StartupListener.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/startup/StartupListener.java
index e53905e..458f7bb 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/startup/StartupListener.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/startup/StartupListener.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -37,10 +37,12 @@ import java.util.Properties;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
+import org.apache.commons.lang3.text.WordUtils;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
-import org.oxbow.swingbits.dialog.task.CommandLink;
-import org.oxbow.swingbits.dialog.task.TaskDialogs;
+import org.apache.marmotta.splash.common.ui.MessageDialog;
+import org.apache.marmotta.splash.common.ui.SelectionDialog;
+import org.apache.marmotta.splash.common.ui.SelectionDialog.Option;
/**
* Add file description here!
@@ -87,7 +89,7 @@ public class StartupListener implements LifecycleListener {
if(!checkServerName(serverName) || serverPort != getServerPort()) {
- TaskDialogs.inform(null,
+ MessageDialog.show("Warning",
"Configured server name not found",
"The host name ("+serverName+") that has been used to configure this \n" +
"installation is no longer available on this server. The system \n" +
@@ -99,16 +101,17 @@ public class StartupListener implements LifecycleListener {
} else {
// show a dialog listing all available addresses of this server and allowing the user to
// chose
- List<CommandLink> choices = new ArrayList<CommandLink>();
+ List<Option> choices = new ArrayList<>();
Map<String,List<InetAddress>> addressList = listHostAddresses();
List<String> hostNames = new ArrayList<String>(addressList.keySet());
Collections.sort(hostNames);
+ String loopback = "localhost";
for(String hostName : hostNames) {
List<InetAddress> addresses = addressList.get(hostName);
- String label = hostName + " (";
+ String label = hostName + " \n(";
for(Iterator<InetAddress> it = addresses.iterator(); it.hasNext(); ) {
label += it.next().getHostAddress();
if(it.hasNext()) {
@@ -121,17 +124,21 @@ public class StartupListener implements LifecycleListener {
if(addresses.get(0).isLoopbackAddress()) {
text = "Local IP-Address. Recommended for Laptop use or Demonstration purposes";
+ loopback = hostName;
} else {
text = "Public IP-Address. Recommended for Workstation or Server use";
}
- choices.add(new CommandLink(label,text));
+ choices.add(new Option(label, text));
}
- int choice = TaskDialogs.choice(null,
- "Select host address to use for configuring the Apache Marmotta.",
- "For demonstration purposes or laptop installations it is recommended to select \n\"localhost\" below. For server and workstation installations, please select a \npublic IP address.", 0, choices);
+ int choice = SelectionDialog.select("Select Server Address",
+ "Select host address to use for configuring the\nApache Marmotta Platform.",
+ WordUtils.wrap("For demonstration purposes or laptop installations it is recommended to select \""+loopback+"\" below. For server and workstation installations, please select a public IP address.", 60),
+ choices, 0);
+
+ if (choice < 0) return;
serverName = hostNames.get(choice);
serverPort = getServerPort();
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/systray/SystrayListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/systray/SystrayListener.java b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/systray/SystrayListener.java
index 4ccf170..17e5ca7 100644
--- a/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/systray/SystrayListener.java
+++ b/launchers/marmotta-splash/src/main/java/org/apache/marmotta/splash/systray/SystrayListener.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -47,7 +47,7 @@ import org.apache.catalina.LifecycleListener;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.marmotta.splash.common.MarmottaContext;
-import org.oxbow.swingbits.dialog.task.TaskDialogs;
+import org.apache.marmotta.splash.common.ui.MessageDialog;
/**
* Add file description here!
@@ -84,6 +84,8 @@ public class SystrayListener implements LifecycleListener {
if(event.getType().equals(Lifecycle.AFTER_START_EVENT) && SystemTray.isSupported()) {
initContextLinks();
initSysTray();
+ } else if (event.getType().equals(Lifecycle.BEFORE_STOP_EVENT) && SystemTray.isSupported()) {
+ SystemTray.getSystemTray().remove(icon);
}
}
@@ -132,8 +134,7 @@ public class SystrayListener implements LifecycleListener {
//MenuItem mainPage = createMenuItem("Start Page", "http://"+getServerName()+":"+getServerPort()+"/");
//popup.add(mainPage);
-
- popup.addSeparator();
+ //popup.addSeparator();
// launch browser action
@@ -163,8 +164,10 @@ public class SystrayListener implements LifecycleListener {
}
popup.add(shutdown);
- popup.addSeparator();
-
+
+ if (!demoLinks.isEmpty()) {
+ popup.addSeparator();
+ }
for(final Map.Entry<String,String> linkEntry : demoLinks.entrySet()) {
boolean containsEntry = false;
for(int i = 0; i < popup.getItemCount(); i++) {
@@ -182,14 +185,13 @@ public class SystrayListener implements LifecycleListener {
}
popup.addSeparator();
-
MenuItem about = new MenuItem("About");
about.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- TaskDialogs.inform(null,
+ MessageDialog.show("Apache Marmotta",
"About Apache Marmotta \n",
- "(c)2013 The Apache Software Foundation \n" +
+ "(c)2014 The Apache Software Foundation \n" +
"Visit http://marmotta.apache.org for further details");
}
});
http://git-wip-us.apache.org/repos/asf/marmotta/blob/0c8ccdb9/launchers/marmotta-splash/src/test/java/org/apache/marmotta/splash/startup/StartupListenerTest.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/test/java/org/apache/marmotta/splash/startup/StartupListenerTest.java b/launchers/marmotta-splash/src/test/java/org/apache/marmotta/splash/startup/StartupListenerTest.java
new file mode 100644
index 0000000..5bd18a1
--- /dev/null
+++ b/launchers/marmotta-splash/src/test/java/org/apache/marmotta/splash/startup/StartupListenerTest.java
@@ -0,0 +1,26 @@
+package org.apache.marmotta.splash.startup;
+
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.marmotta.splash.common.MarmottaContext;
+
+public class StartupListenerTest {
+
+ private final StartupListener sl;
+ private final MarmottaContext marmotta;
+
+ public StartupListenerTest() {
+ sl = new StartupListener();
+ marmotta = new MarmottaContext();
+ }
+
+ public void testLifecycleEvent() {
+ sl.lifecycleEvent(new LifecycleEvent(marmotta, Lifecycle.AFTER_START_EVENT, null));
+ }
+
+ public static void main(String[] args) {
+ new StartupListenerTest().testLifecycleEvent();
+ }
+
+
+}
[03/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/TaskDialogContent.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/TaskDialogContent.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/TaskDialogContent.java
deleted file mode 100644
index 8d9890e..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/TaskDialogContent.java
+++ /dev/null
@@ -1,385 +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.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.Icon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.KeyStroke;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-import javax.swing.UIManager;
-
-import net.miginfocom.swing.MigLayout;
-
-import org.oxbow.swingbits.dialog.task.IContentDesign;
-import org.oxbow.swingbits.dialog.task.TaskDialog;
-import org.oxbow.swingbits.util.Markup;
-import org.oxbow.swingbits.util.Strings;
-import org.oxbow.swingbits.util.swing.Icons;
-
-public class TaskDialogContent extends JPanel implements TaskDialog.Details, TaskDialog.Footer {
-
- private static final long serialVersionUID = 1L;
-
- final JLabel lbIcon = hidden( new JLabel());
- final JLabel lbInstruction = hidden( new JLabel());
- final JLabel lbText = hidden( new JLabel());
- final JPanel pExpandable = hidden( new JPanel( new BorderLayout()));
- final JPanel pComponent = hidden( new JPanel( new BorderLayout()));
-
- final DetailsToggleButton cbDetails = hidden( new DetailsToggleButton());
- final JCheckBox cbFooterCheck = hidden( new JCheckBox());
- final JLabel lbFooter = hidden( new JLabel());
- final JPanel pCommands = new JPanel( new MigLayout( "ins 0, nogrid, fillx, aligny 100%, gapy unrel" ));
- final JPanel pFooter = hidden( new JPanel( new MigLayout()));
- final JPanel pCommandPane = new JPanel( new MigLayout());
-
- private final String[] detailsText = new String[2];
- private String instruction = null;
- private String text;
- private boolean alwaysExpanded;
-
- private static <T extends JComponent> T hidden( T c ) {
- c.setVisible(false);
- return c;
- }
-
- public TaskDialogContent() {
-
- pExpandable.setOpaque(false);
- pComponent.setOpaque(false);
-
- cbDetails.addItemListener( new ItemListener() {
-
- @Override
- public void itemStateChanged(ItemEvent e) {
-
- final boolean selected = e.getStateChange() == ItemEvent.SELECTED;
-
- cbDetails.setText( selected? getExpandedLabel():getCollapsedLabel() );
- SwingUtilities.invokeLater( new Runnable(){
-
- @Override
- public void run() {
- pExpandable.setVisible(selected);
- SwingUtilities.getWindowAncestor(TaskDialogContent.this).pack();
- }}
- );
-
- }
- });
-
-
- }
-
-
- public void setInstruction( String instruction ) {
- this.instruction = instruction;
-
- boolean visible = instruction != null && instruction.trim().length() > 0;
- lbInstruction.setVisible(visible);
- if (visible) lbInstruction.setText( Markup.toHTML(instruction) );
- }
-
- public String getInstruction() {
- return instruction;
- }
-
- public void setCommands( Set<? extends TaskDialog.Command> commands, boolean lockButtonSize ) {
-
- pCommands.removeAll();
-
- String group = lockButtonSize? "sgx commands, ": "";
- TaskDialog owner = getOwner();
- for( final TaskDialog.Command c: commands) {
- String tag = c.getTag() == null? "": c.getTag().toString();
- JButton button = new JButton( new CommandAction(c, owner) );
- pCommands.add( button, group + "aligny top, " + tag );
- }
-
- }
-
- public boolean isCommandsVisible() {
- return pCommandPane.isVisible();
- }
-
- public void setCommandsVisible( boolean visible ) {
- pCommandPane.setVisible(visible);
- }
-
- public void setMainText( String text ) {
- this.text = text;
- boolean isEmtpy = Strings.isEmpty(text);
- lbText.setText( Markup.toHTML(text) );
- lbText.setVisible( !isEmtpy );
- }
-
- public String getMainText() {
- return text;
- }
-
- private TaskDialog getOwner() {
- return TaskDialog.getInstance(this);
- }
-
- @Override
- public String getCollapsedLabel() {
- return Strings.isEmpty( detailsText[0])?
- getOwner().getString( UIManager.getString(IContentDesign.TEXT_MORE_DETAILS)): detailsText[0];
- }
-
- @Override
- public void setCollapsedLabel(String collapsedLabel) {
- detailsText[0] = collapsedLabel;
- }
-
- @Override
- public String getExpandedLabel() {
- return Strings.isEmpty(detailsText[1])?
- getOwner().getString(UIManager.getString(IContentDesign.TEXT_FEWER_DETAILS)): detailsText[1];
- }
-
- @Override
- public void setExpandedLabel(String expandedLabel) {
- detailsText[1] = expandedLabel;
- }
-
- @Override
- public JComponent getExpandableComponent() {
- return pExpandable.getComponentCount() == 0? null: (JComponent)pExpandable.getComponent(0);
- }
-
- @Override
- public void setExpandableComponent(JComponent c) {
- pExpandable.removeAll();
- if ( c != null ) pExpandable.add( c );
- cbDetails.setVisible(c != null && !alwaysExpanded);
- }
-
- @Override
- public boolean isExpanded() {
- return cbDetails.isSelected();
- }
-
- @Override
- public void setExpanded(boolean expanded) {
- cbDetails.setSelected( !expanded );
- cbDetails.setSelected( expanded );
- pExpandable.setVisible(expanded);
- }
-
- @Override
- public void setAlwaysExpanded( boolean alwaysExpanded ) {
- if (alwaysExpanded) {
- setExpanded(true);
- }
- cbDetails.setVisible(getExpandableComponent() != null && !alwaysExpanded);
- this.alwaysExpanded = alwaysExpanded;
- }
-
- @Override
- public boolean isAlwaysExpanded() {
- return alwaysExpanded;
- }
-
- @Override
- public String getCheckBoxText() {
- return cbFooterCheck.getText();
- }
-
- private Icon icon;
-
-
- public void setMainIcon( Icon icon ) {
- lbIcon.setVisible( icon != null );
- lbIcon.setIcon(icon);
- }
-
- public Icon getMainIcon() {
- return lbIcon.getIcon();
- }
-
- @Override
- public Icon getIcon() {
- return icon;
- }
-
- @Override
- public void setIcon(Icon icon) {
- this.icon = icon; // stored to preserve actual size
- lbFooter.setIcon( Icons.scale(icon, 16, 16));
- }
-
- @Override
- public String getText() {
- return lbFooter.getText();
- }
-
- @Override
- public void setText(String text) {
- boolean footerLabelVisible = !Strings.isEmpty(text);
- pFooter.setVisible( footerLabelVisible );
- lbFooter.setVisible(footerLabelVisible);
- lbFooter.setText(Markup.toHTML(text));
- }
-
- public void setComponent( JComponent c ) {
- pComponent.removeAll();
- if ( c != null ) pComponent.add( c );
- pComponent.setVisible(c != null);
- }
-
- public JComponent getComponent() {
- return pComponent.getComponentCount() == 0? null: (JComponent)pComponent.getComponent(0);
- }
-
- @Override
- public boolean isCheckBoxSelected() {
- return cbFooterCheck.isVisible() && cbFooterCheck.isSelected();
- }
-
- @Override
- public void setCheckBoxSelected(boolean selected) {
- cbFooterCheck.setSelected(selected);
- }
-
- @Override
- public void setCheckBoxText(String text) {
- cbFooterCheck.setVisible( !Strings.isEmpty( text ) );
- cbFooterCheck.setText( text == null? "": text );
- }
-
- class CommandAction extends AbstractAction implements TaskDialog.ValidationListener {
-
- private static final long serialVersionUID = 1L;
-
- private final TaskDialog.Command command;
- private final TaskDialog dlg;
- private Timer timer;
- private int counter;
-
- public CommandAction( TaskDialog.Command command, TaskDialog dlg ) {
- super( dlg.getString( command.getTitle()) );
-
- this.command = command;
- this.dlg = dlg;
- this.counter = command.getWaitInterval();
-
- // setup default keystrokes
- KeyStroke keyStroke = command.getKeyStroke();
- if ( keyStroke != null ) {
- String actionID = "TaskDialog.Command." + UUID.randomUUID().toString();
- TaskDialogContent.this.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(keyStroke,actionID);
- TaskDialogContent.this.getActionMap().put(actionID,this);
- }
-
-
- dlg.addValidationListener(this);
-
- putValue( Action.NAME, getTitle() );
-
- if ( counter > 0 ) {
-
- setEnabled( false );
-
- timer = new Timer(1000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- tick();
- }
-
- });
-
- dlg.addPropertyListener("visible", new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if ( Boolean.TRUE.equals(e.getNewValue())) {
- timer.start();
- }
- }
- });
- }
-
- }
-
- @Override
- public void validationFinished(boolean validationResult) {
-
- setEnabled( command.isEnabled(validationResult) );
-
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- dlg.setResult( command );
- if ( command.isClosing() ) dlg.setVisible(false);
-
- }
-
- private String getTitle() {
- String title = dlg.getString( command.getTitle());
- return counter > 0? String.format( "%s (%d)", title, counter): title;
- }
-
- private void tick() {
- if ( --counter <= 0 ) {
- timer.stop();
- }
- putValue( Action.NAME, getTitle() );
- setEnabled(counter <= 0);
- }
-
- }
-
-
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsCommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsCommandLinkPainter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsCommandLinkPainter.java
deleted file mode 100644
index b7c893d..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsCommandLinkPainter.java
+++ /dev/null
@@ -1,65 +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;
-
-public class WindowsCommandLinkPainter extends DefaultCommandLinkPainter {
-
- private LinkChrome selectedChrome = new LinkChrome(
- new Color(0xFBFBFC),
- new Color(0xE6E6E6),
- new Color(0xDADADA),
- 1, 7 );
-
- private LinkChrome armedChrome = new LinkChrome(
- new Color(0xFCFDFF),
- new Color(0xEDF5FF),
- new Color(0xB9D7FC),
- 1, 7 );
-
- private LinkChrome rolloverChrome = new LinkChrome(
- new Color(0xFCFDFF),
- new Color(0xEDF5FF),
- new Color(0xB9D7FC),
- 1, 7 );
-
- protected LinkChrome getLinkChrome( LinkState linkState ) {
- switch( linkState ) {
- case SELECTED: return selectedChrome;
- case ARMED : return armedChrome;
- case ROLLOVER: return rolloverChrome;
- default : return selectedChrome;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsContentDesign.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsContentDesign.java
deleted file mode 100644
index cd05367..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/WindowsContentDesign.java
+++ /dev/null
@@ -1,66 +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.Font;
-
-import javax.swing.UIManager;
-
-import org.oxbow.swingbits.dialog.task.ICommandLinkPainter;
-
-public class WindowsContentDesign extends DefaultContentDesign {
-
- @Override
- public void updateUIDefaults() {
-
- super.updateUIDefaults();
-
- UIManager.put( COLOR_INSTRUCTION_FOREGROUND, new Color(0x0033A0));
-
- Font fontBase = new Font("Segoe UI", 0, 11);
- UIManager.put( FONT_INSTRUCTION,
- fontBase.deriveFont( fontBase.getStyle(), fontBase.getSize2D() * 1.4f ) );
-
- }
-
-
- @Override
- public ICommandLinkPainter getCommandLinkPainter() {
- if (commandButtonPainter == null) {
- commandButtonPainter = new WindowsCommandLinkPainter();
- }
- return commandButtonPainter;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ActionCheckListModel.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ActionCheckListModel.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ActionCheckListModel.java
deleted file mode 100644
index b12e726..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ActionCheckListModel.java
+++ /dev/null
@@ -1,188 +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.list;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListDataListener;
-
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-
-public class ActionCheckListModel<T> implements ICheckListModel<T> {
-
- private final List<ListDataListener> listeners = Collections.synchronizedList( new ArrayList<ListDataListener>());
- private final ICheckListModel<T> originalModel;
-
- private final ICheckListAction<T> actionCheckAll = new ICheckListAction.CheckAll<T>();
-
- @SuppressWarnings("unchecked")
- private final List<ICheckListAction<T>> actionItems = Arrays.asList( actionCheckAll );
- private final Set<ICheckListAction<T>> checks = new HashSet<ICheckListAction<T>>();
-
- public ActionCheckListModel( final ICheckListModel<T> originalModel ) {
-
- if ( originalModel == null ) throw new NullPointerException();
- this.originalModel = originalModel;
-
- //react on original model changes
- this.originalModel.addListDataListener( new ListDataListener () {
-
- @Override
- public void intervalAdded(ListDataEvent e) {
- ListDataEvent event = toDecoratedEvent(e);
- for( ListDataListener l: listeners ) {
- l.intervalAdded(event);
- }
- }
-
- @Override
- public void intervalRemoved(ListDataEvent e) {
- ListDataEvent event = toDecoratedEvent(e);
- for( ListDataListener l: listeners ) {
- l.intervalRemoved(event);
- }
- }
-
- @Override
- public void contentsChanged(ListDataEvent e) {
- ListDataEvent event = toDecoratedEvent(e);
- for( ListDataListener l: listeners ) {
- l.contentsChanged(event);
- }
- if ( originalModel.getCheckedItems().size() < originalModel.getSize() ) {
- checks.remove(actionCheckAll);
- } else {
- checks.add(actionCheckAll);
- }
- fireListDataChanged();
- }
- });
- }
-
- @Override
- public int getSize() {
- return originalModel.getSize() + actionItems.size();
- }
-
- @Override
- public Object getElementAt(int index) {
- if ( isDecoratedIndex(index)) {
- return actionItems.get(index);
- } else {
- return originalModel.getElementAt( toOriginalIndex(index));
- }
- }
-
- private int toOriginalIndex( int index ) {
- return index - actionItems.size();
- }
-
- private int toDecoratedIndex( int index ) {
- return index + actionItems.size();
- }
-
- private boolean isDecoratedIndex( int index ) {
- int size = actionItems.size();
- return size > 0 && index >= 0 && index < size;
- }
-
-
- @Override
- public void addListDataListener(ListDataListener l) {
- listeners.add(l);
- }
-
- @Override
- public void removeListDataListener(ListDataListener l) {
- listeners.remove(l);
- }
-
- private void fireListDataChanged() {
- ListDataEvent e = new ListDataEvent( this, 0, 0, getSize() );
- for( ListDataListener l: listeners ) {
- l.contentsChanged(e);
- }
- }
-
- private ListDataEvent toDecoratedEvent( ListDataEvent e ) {
- return new ListDataEvent(
- e.getSource(),
- e.getType(),
- toDecoratedIndex(e.getIndex0()),
- toDecoratedIndex(e.getIndex1()));
- }
-
- @Override
- public boolean isCheckedIndex(int index) {
- if ( isDecoratedIndex(index)) {
- return checks.contains(actionItems.get(index));
- } else {
- return originalModel.isCheckedIndex( toOriginalIndex(index));
- }
-
- }
-
- @Override
- public void setCheckedIndex(int index, boolean value) {
- if ( isDecoratedIndex(index)) {
- ICheckListAction<T> item = actionItems.get(index);
- item.check(originalModel, value);
- if ( value ) checks.add(item); else checks.remove(item);
- fireListDataChanged();
- } else {
- originalModel.setCheckedIndex( toOriginalIndex(index), value);
- }
- }
-
- @Override
- public Collection<T> getCheckedItems() {
- return originalModel.getCheckedItems();
- }
-
- @Override
- public void setCheckedItems(Collection<T> items) {
- originalModel.setCheckedItems(items);
- }
-
- @Override
- public void filter(String filter, IObjectToStringTranslator translator, CheckListFilterType filterType) {
- originalModel.filter(filter, translator, filterType);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckList.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckList.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckList.java
deleted file mode 100644
index bf4983e..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckList.java
+++ /dev/null
@@ -1,173 +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.list;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseListener;
-import java.util.Collection;
-
-import javax.swing.AbstractAction;
-import javax.swing.JList;
-import javax.swing.KeyStroke;
-import javax.swing.ListSelectionModel;
-
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-
-/**
- * The decorator for JList which makes it work like check list
- * UI can be designed using JList and which can be later decorated to become a check list
- * @author Eugene Ryzhikov
- *
- * @param <T> list item type
- */
-public class CheckList<T> {
-
- private final JList list;
- private static final MouseAdapter checkBoxEditor = new CheckListEditor();
-
- public static class Builder {
-
- private JList list;
-
- public Builder( JList list ) {
- this.list = list == null? new JList(): list;
- }
-
- public Builder() {
- this( null );
- }
-
- public <T> CheckList<T> build() {
- return new CheckList<T>(list);
- }
-
- }
-
-
- /**
- * Wraps the standard JList and makes it work like check list
- * @param list
- */
- private CheckList(final JList list) {
-
- if (list == null) throw new NullPointerException();
- this.list = list;
- this.list.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION);
-
- if ( !isEditorAttached() ) list.addMouseListener(checkBoxEditor);
- this.list.setCellRenderer(new CheckListRenderer());
-
- setupKeyboardActions(list);
-
- }
-
- @SuppressWarnings("serial")
- private void setupKeyboardActions(final JList list) {
- String actionKey = "toggle-check";
- list.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,0), actionKey);
- list.getActionMap().put(actionKey, new AbstractAction(){
-
- @Override
- public void actionPerformed(ActionEvent e) {
- toggleIndex(list.getSelectedIndex());
- }});
- }
-
- private boolean isEditorAttached() {
-
- for( MouseListener ml: list.getMouseListeners() ) {
- if ( ml instanceof CheckListEditor ) return true;
- }
- return false;
-
- }
-
- public JList getList() {
- return list;
- }
-
- /**
- * Sets data to a check list. Simplification for setting new the model
- * @param data
- */
- public void setData( Collection<T> data ) {
- setModel( new DefaultCheckListModel<T>(data));
- }
-
- /**
- * Sets the model for check list.
- * @param model
- */
- public void setModel( ICheckListModel<T> model ) {
- list.setModel(model);
- }
-
- @SuppressWarnings("unchecked")
- public ICheckListModel<T> getModel() {
- return (ICheckListModel<T>) list.getModel();
- }
-
- /**
- * Returns a collection of checked items.
- * @return collection of checked items. Empty collection if nothing is selected
- */
- public Collection<T> getCheckedItems() {
- return getModel().getCheckedItems();
- }
-
- /**
- * Resets checked elements
- * @param elements
- */
- public void setCheckedItems( Collection<T> elements ) {
- getModel().setCheckedItems(elements);
- }
-
- /**
- * Filters list view without losing actual data
- * @param filter
- * @param translator
- */
- public void filter( String filter, IObjectToStringTranslator translator, CheckListFilterType filterType ) {
- getModel().filter(filter, translator, filterType);
- }
-
- public void toggleIndex( int index ) {
- if ( index >= 0 && index < list.getModel().getSize()) {
- ICheckListModel<T> model = getModel();
- model.setCheckedIndex(index, !model.isCheckedIndex(index));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListEditor.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListEditor.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListEditor.java
deleted file mode 100644
index 86beab8..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListEditor.java
+++ /dev/null
@@ -1,84 +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.list;
-
-import java.awt.Rectangle;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.Arrays;
-
-import javax.swing.JList;
-import javax.swing.SwingUtilities;
-
-
-/**
- * Determines mouse click and
- * 1. Toggles the check on selected item if clicked once
- * 2. Clears checks and checks selected item if clicked more then once
- *
- * Created on Feb 4, 2011
- * @author Eugene Ryzhikov
- *
- */
-final class CheckListEditor extends MouseAdapter {
- @Override
- public void mouseClicked(MouseEvent e) {
-
- if (!SwingUtilities.isLeftMouseButton(e)) return;
-
- JList list = (JList) e.getSource();
- if ( !list.isEnabled() || (!(list.getModel() instanceof ICheckListModel<?>))) return;
-
- int index = list.locationToIndex(e.getPoint());
- if (index < 0) return;
-
- Rectangle bounds = list.getCellBounds(index, index);
-
- if ( bounds.contains(e.getPoint()) ) {
-
- @SuppressWarnings("unchecked")
- ICheckListModel<Object> model = (ICheckListModel<Object>) list.getModel();
-
- if ( e.getClickCount() > 1 ) {
- // clear all and check selected for more then 1 clicks
- model.setCheckedItems( Arrays.asList( model.getElementAt(index)));
- } else {
- // simple toggle for 1 click
- model.setCheckedIndex(index, !model.isCheckedIndex(index));
- }
- e.consume();
- }
-
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListFilterType.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListFilterType.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListFilterType.java
deleted file mode 100644
index 80f433c..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListFilterType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.oxbow.swingbits.list;
-
-public enum CheckListFilterType {
-
- STARTS_WITH {
-
- @Override
- public boolean include( String element, String filter ) {
-
- if ( element == null || filter == null ) return false;
- return element.startsWith(filter);
-
- }
-
- },
-
- CONTAINS {
-
- @Override
- public boolean include( String element, String filter ) {
-
- if ( element == null || filter == null ) return false;
- return element.contains(filter);
-
- }
-
- };
-
- public abstract boolean include( String element, String filter );
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListRenderer.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListRenderer.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListRenderer.java
deleted file mode 100644
index c9527a6..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/CheckListRenderer.java
+++ /dev/null
@@ -1,228 +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.list;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Rectangle;
-import java.io.Serializable;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-
-public class CheckListRenderer extends JCheckBox implements ListCellRenderer, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final Border NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
- private static final Border SAFE_NO_FOCUS_BORDER = NO_FOCUS_BORDER; // may change in the feature
-
- /**
- * Constructs a default renderer object for an item in a list.
- */
- public CheckListRenderer() {
- super();
- setOpaque(true);
- setBorder(getNoFocusBorder());
- }
-
- private static Border getNoFocusBorder() {
- if (System.getSecurityManager() != null) {
- return SAFE_NO_FOCUS_BORDER;
- } else {
- return NO_FOCUS_BORDER;
- }
- }
-
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
- boolean cellHasFocus) {
-
- setComponentOrientation(list.getComponentOrientation());
-
- Color bg = null;
- Color fg = null;
-
- JList.DropLocation dropLocation = list.getDropLocation();
- if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) {
-
- bg = UIManager.getColor("List.dropCellBackground");
- fg = UIManager.getColor("List.dropCellForeground");
-
- isSelected = true;
- }
-
- if (isSelected) {
- setBackground(bg == null ? list.getSelectionBackground() : bg);
- setForeground(fg == null ? list.getSelectionForeground() : fg);
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
- }
-
- if (value instanceof Icon) {
- setIcon((Icon) value);
- setText("");
- } else {
- setIcon(null);
- setText(getObjectAsText(value));
- }
-
- setSelected( isChecked(list, index));
-
- setEnabled(list.isEnabled());
- setFont(list.getFont());
-
- Border border = null;
- if (cellHasFocus) {
- if (isSelected) {
- border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
- }
- if (border == null) {
- border = UIManager.getBorder("List.focusCellHighlightBorder");
- }
- } else {
- border = getNoFocusBorder();
- }
- setBorder(border);
-
- return this;
- }
-
- protected String getObjectAsText(Object obj) {
- return (obj == null) ? "" : obj.toString();
- }
-
- private boolean isChecked(JList list, int index) {
-
- if (list.getModel() instanceof ICheckListModel<?>) {
- return ((ICheckListModel<?>) list.getModel()).isCheckedIndex(index);
- } else {
- return false;
- }
-
- }
-
- /**
- * @return true if the background is opaque and differs from the JList's background; false otherwise
- */
- @Override
- public boolean isOpaque() {
- Color back = getBackground();
- Component p = getParent();
- if (p != null) {
- p = p.getParent();
- }
- // p should now be the JList.
- boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque();
- return !colorMatch && super.isOpaque();
- }
-
- @Override
- protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
-
- if ("text".equals(propertyName) ||
- (("font".equals(propertyName) || "foreground".equals(propertyName)) &&
- oldValue != newValue && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
-
- super.firePropertyChange(propertyName, oldValue, newValue);
- }
- }
-
- // Methods below are overridden for performance reasons.
-
- @Override
- public void validate() {
- }
-
- @Override
- public void invalidate() {
- }
-
- @Override
- public void repaint() {
- }
-
- @Override
- public void revalidate() {
- }
-
- @Override
- public void repaint(long tm, int x, int y, int width, int height) {
- }
-
- @Override
- public void repaint(Rectangle r) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, char oldValue, char newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, short oldValue, short newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, int oldValue, int newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, long oldValue, long newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, float oldValue, float newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, double oldValue, double newValue) {
- }
-
- @Override
- public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
- }
-
- @SuppressWarnings("serial")
- public static class UIResource extends DefaultListCellRenderer implements javax.swing.plaf.UIResource {
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/DefaultCheckListModel.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/DefaultCheckListModel.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/DefaultCheckListModel.java
deleted file mode 100644
index b1676b7..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/DefaultCheckListModel.java
+++ /dev/null
@@ -1,175 +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.list;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.AbstractListModel;
-
-import org.oxbow.swingbits.util.DefaultObjectToStringTranslator;
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-import org.oxbow.swingbits.util.IValueWrapper;
-
-/**
- * Default model for check list. It is based on the list of items
- * Implementation of checks is based on HashSet of checked items
- *
- * @author Eugene Ryzhikov
- *
- * @param <T> list element type
- */
-public class DefaultCheckListModel<T> extends AbstractListModel implements ICheckListModel<T> {
-
- private static final long serialVersionUID = 1L;
-
- private final List<T> data = new ArrayList<T>();
- private final Set<T> checks = new HashSet<T>();
-
- public static IObjectToStringTranslator DEFAULT_TRANSLATOR = new DefaultObjectToStringTranslator();
- private List<T> filteredData = null;
-
- public DefaultCheckListModel( Collection<? extends T> data ) {
-
- if ( data == null ) return;
- for (T object : data) {
- this.data.add( object );
- checks.clear();
- }
- }
-
- public DefaultCheckListModel( T... data ) {
- this( Arrays.asList( data ));
- }
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#getSize()
- */
- @Override
- public int getSize() {
- return data().size();
- }
-
- private List<T> data() {
- return filteredData == null? data: filteredData;
- }
-
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#getElementAt(int)
- */
- @Override
- public Object getElementAt(int index) {
- return data().get(index);
- }
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#isChecked(int)
- */
- @Override
- public boolean isCheckedIndex( int index ) {
- return checks.contains( data().get(index));
- }
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(int, boolean)
- */
- @Override
- public void setCheckedIndex( int index, boolean value ) {
- T o = data().get(index);
- if ( value ) checks.add(o); else checks.remove(o);
- fireContentsChanged(this, index, index);
- }
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#getChecked()
- */
- @Override
- public Collection<T> getCheckedItems() {
- List<T> items = new ArrayList<T>(checks);
- items.retainAll(data);
- return Collections.unmodifiableList( items );
- }
-
- /* (non-Javadoc)
- * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(java.util.Collection)
- */
- @Override
- public void setCheckedItems( Collection<T> items ) {
-
-// if ( CollectionUtils.isEmpty(items)) return;
-
- List<T> correctedItems = new ArrayList<T>(items);
- correctedItems.retainAll(data);
-
- checks.clear();
- checks.addAll( correctedItems );
- fireContentsChanged(this, 0, checks.size()-1);
-
-
- }
-
- public void filter( String filter, IObjectToStringTranslator translator, CheckListFilterType filterType ) {
-
- if ( filter == null || filter.trim().length() == 0 ) {
- filteredData = null;
- } else {
-
- CheckListFilterType ft = filterType == null? CheckListFilterType.CONTAINS: filterType;
-
- IObjectToStringTranslator t = translator == null? DEFAULT_TRANSLATOR: translator;
- String f = filter.toLowerCase();
-
- List<T> fData = new ArrayList<T>();
-
- Object value;
- for( T o: data ) {
- //if ( t.translate(o).startsWith(f)) {
- value = o instanceof IValueWrapper? ((IValueWrapper<?>)o).getValue(): o;
- if ( ft.include(t.translate(value), f)) {
- fData.add(o);
- }
- }
- filteredData = fData;
- }
-
- fireContentsChanged( this, 0, data.size()-1);
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListAction.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListAction.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListAction.java
deleted file mode 100644
index 57804ef..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.oxbow.swingbits.list;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-
-public interface ICheckListAction<T> {
-
- void check( ICheckListModel<T> model, boolean value );
-
- public static class CheckAll<T> implements ICheckListAction<T> {
-
- @Override
- public String toString() {
- return "(All)";
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void check(ICheckListModel<T> model, boolean value) {
- Collection<T> items = new ArrayList<T>();
- if (value) {
- for( int i=0, s=model.getSize(); i<s; i++ ) {
- items.add((T) model.getElementAt(i));
- }
- }
- model.setCheckedItems( items );
-
- }
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListModel.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListModel.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListModel.java
deleted file mode 100644
index 95bb118..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/list/ICheckListModel.java
+++ /dev/null
@@ -1,77 +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.list;
-
-import java.util.Collection;
-
-import javax.swing.ListModel;
-
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-
-public interface ICheckListModel<T> extends ListModel{
-
- /**
- * Returns the check state of the element at specified position
- * @param index element index
- * @return true if element at specified position is checked
- * @throws IndexOutOfBoundsException if index is out of range
- */
- boolean isCheckedIndex(int index);
-
- /**
- * Sets the check state of the element at specified position
- * @param index element index
- * @param value
- * @throws IndexOutOfBoundsException if index is out of range
- */
- void setCheckedIndex(int index, boolean value);
-
- /**
- * Returns a collections of checked items
- * @return
- */
- Collection<T> getCheckedItems();
-
- /**
- * Sets checked items
- * @param items
- */
- void setCheckedItems(Collection<T> items);
-
- /**
- * Allows filtered view. Setting empty or null filter will clear filter and show all items
- * @param filter filter string
- * @param translator object to string translator to aid the search
- */
- void filter( String filter, IObjectToStringTranslator translator, CheckListFilterType filterType );
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/JSearchTextField.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/JSearchTextField.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/JSearchTextField.java
deleted file mode 100644
index e973de4..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/JSearchTextField.java
+++ /dev/null
@@ -1,72 +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.misc;
-
-import java.awt.Graphics;
-import java.awt.Image;
-
-import javax.swing.ImageIcon;
-import javax.swing.JTextField;
-
-/**
- * A text field with search symbol painted to indicate
- * that it is used as search field
- *
- * @author Eugene Ryzhikov
- *
- */
-public class JSearchTextField extends JTextField {
-
- private static final String ICON_NAME = "search.png";
- private static final long serialVersionUID = 1L;
-
- private static ImageIcon icon;
-
- private static Image getScaledImage( int size ) {
-
- if (icon == null) {
- icon = new ImageIcon( JSearchTextField.class.getResource(ICON_NAME));
- }
- return new ImageIcon(icon.getImage().getScaledInstance( size, size, Image.SCALE_SMOOTH )).getImage();
- }
-
- private static int PAD = 4;
- private static int PAD2 = PAD*2;
-
- @Override
- public void paint(Graphics g) {
- super.paint(g);
- int size = getHeight()-PAD2;
- g.drawImage( getScaledImage(size), getWidth()-size-PAD, PAD, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/search.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/search.png b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/search.png
deleted file mode 100644
index d239597..0000000
Binary files a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/misc/search.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/popup/PopupWindow.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/popup/PopupWindow.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/popup/PopupWindow.java
deleted file mode 100644
index 63e2684..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/popup/PopupWindow.java
+++ /dev/null
@@ -1,331 +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.popup;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.Icon;
-import javax.swing.JComponent;
-import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
-
-public abstract class PopupWindow {
-
- private final JPopupMenu menu;
- private Dimension defaultSize = new Dimension(100,100);
-
- public PopupWindow( boolean resizable ) {
- menu = new ResizablePopupMenu( resizable ) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
- if ( menu.getComponentCount() == 0 ) {
- JComponent content = buildContent();
- defaultSize = content.getPreferredSize();
-
- menu.add( content );
-
- }
- beforeShow();
- }
-
- @Override
- public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
- beforeHide();
- }
-
- };
- }
-
- public final Dimension getDefaultSize() {
- return defaultSize;
- }
-
- public final Dimension getPreferredSize() {
- return menu.getPreferredSize();
- }
-
- public final void setPreferredSize( Dimension preferredSize ) {
- menu.setPreferredSize(preferredSize);
- }
-
- /**
- * Override this method to add content yo the owner.
- * This method is only executed when owner has no subcomponents
- * @param owner
- */
- protected abstract JComponent buildContent();
-
- /**
- * Shows Popup in predefined location
- * @param invoker
- * @param x
- * @param y
- */
- public void show( Component invoker, int x, int y ) {
- menu.show( invoker, x, y );
- }
-
- /**
- * Shows popup in predefined location
- * @param invoker
- * @param location
- */
- public void show( Component invoker, Point location ) {
- show( invoker, location.x, location.y );
- }
-
- /**
- * Hides popup
- */
- public final void hide() {
- menu.setVisible(false);
- }
-
- protected void beforeShow() {}
-
- protected void beforeHide() {}
-
-
- /**
- * Simple action to for the popup window.
- * To use - override perform method.
- *
- * Created on Feb 4, 2011
- * @author Eugene Ryzhikov
- *
- */
- public class CommandAction extends AbstractAction {
-
- private static final long serialVersionUID = 1L;
-
- public CommandAction(String name, Icon icon) {
- super(name, icon);
-
- if ( icon != null ) {
- putValue(Action.SHORT_DESCRIPTION, name);
- putValue(Action.NAME, null);
- }
-
- }
-
- public CommandAction( String name ) {
- super(name);
- }
-
- @Override
- public final void actionPerformed(ActionEvent e) {
- if ( perform() ) hide();
- }
-
- /**
- * Preforms action
- * @return true if popup should be closed
- */
- protected boolean perform(){
- return true;
- }
- }
-
-}
-
-class ResizablePopupMenu extends JPopupMenu implements PopupMenuListener {
-
- private static final long serialVersionUID = 1L;
-
- private static final int DOT_SIZE = 2;
- private static final int DOT_START = 2;
- private static final int DOT_STEP = 4;
-
- private final boolean resizable;
-
- public ResizablePopupMenu( boolean resizable ) {
- super();
- this.resizable = resizable;
- if ( resizable ) PopupMenuResizer.decorate(this);
- addPopupMenuListener(this);
- }
-
- @Override
- public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
-
- @Override
- public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
-
- @Override
- public void popupMenuCanceled(PopupMenuEvent e) {}
-
- @Override
- public void paintChildren(Graphics g) {
- super.paintChildren(g);
- if ( resizable ) drawResizer(g);
- }
-
- private void drawResizer(Graphics g) {
-
- int x = getWidth()-2;
- int y = getHeight()-2;
-
- Graphics g2 = g.create();
-
- try {
- for ( int dy = DOT_START, j = 2; j > 0; j--, dy += DOT_STEP ) {
- for( int dx = DOT_START, i = 0; i < j; i++, dx += DOT_STEP ) {
- drawDot( g2, x-dx, y-dy );
- }
- }
- } finally {
- g2.dispose();
- }
-
- };
-
- private void drawDot( Graphics g, int x, int y) {
- g.setColor(Color.WHITE);
- g.fillRect( x, y, DOT_SIZE, DOT_SIZE);
- g.setColor(Color.LIGHT_GRAY);
- g.fillRect( x-1, y-1, DOT_SIZE, DOT_SIZE);
- }
-
-}
-
-/**
- * Allows to resize popup with the mouse.
- *
- * Created on Aug 6, 2010
- * @author exr0bs5
- *
- */
-final class PopupMenuResizer extends MouseAdapter {
-
- private final JPopupMenu menu;
-
- private static final int REZSIZE_SPOT_SIZE = 10;
-
- private Point mouseStart = new Point( Integer.MIN_VALUE, Integer.MIN_VALUE );
-
- private Dimension startSize;
-
- private boolean isResizing = false;
-
-
- public static void decorate( JPopupMenu menu ) {
- new PopupMenuResizer( menu );
- }
-
- private PopupMenuResizer( JPopupMenu menu ) {
- this.menu = menu;
- this.menu.setLightWeightPopupEnabled(true);
- menu.addMouseListener(this);
- menu.addMouseMotionListener(this);
- }
-
- private boolean isInResizeSpot( Point point ) {
-
- if ( point == null ) return false;
-
- Rectangle resizeSpot = new Rectangle(
- menu.getWidth()-REZSIZE_SPOT_SIZE,
- menu.getHeight()-REZSIZE_SPOT_SIZE,
- REZSIZE_SPOT_SIZE,
- REZSIZE_SPOT_SIZE );
-
- return resizeSpot.contains(point);
-
- }
-
- @Override
- public void mouseMoved(MouseEvent e) {
-
- menu.setCursor(
- Cursor.getPredefinedCursor(
- isInResizeSpot( e.getPoint() )? Cursor.SE_RESIZE_CURSOR: Cursor.DEFAULT_CURSOR ));
- }
-
- private Point toScreen( MouseEvent e ) {
-
- Point p = e.getPoint();
- SwingUtilities.convertPointToScreen(p, e.getComponent());
- return p;
-
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- mouseStart = toScreen(e);
- startSize = menu.getSize();
- isResizing = isInResizeSpot(e.getPoint());
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- mouseStart = new Point( Integer.MIN_VALUE, Integer.MIN_VALUE );
- isResizing = false;
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
-
- if ( !isResizing ) return;
-
- Point p = toScreen(e);
-
- int dx = p.x - mouseStart.x;
- int dy = p.y - mouseStart.y;
-
-
- Dimension minDim = menu.getMinimumSize();
-// Dimension maxDim = menu.getMaximumSize();
- Dimension newDim = new Dimension(startSize.width + dx, startSize.height + dy);
-
- if ( newDim.width >= minDim.width && newDim.height >= minDim.height /*&&
- newDim.width <= maxDim.width && newDim.height <= maxDim.height*/ ) {
- menu.setPopupSize( newDim );
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/TableHeaderRenderer.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/TableHeaderRenderer.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/TableHeaderRenderer.java
deleted file mode 100644
index 57bb572..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/TableHeaderRenderer.java
+++ /dev/null
@@ -1,77 +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.table;
-
-import java.awt.Component;
-
-import javax.swing.JComponent;
-import javax.swing.JTable;
-import javax.swing.table.TableCellRenderer;
-
-/**
- * Common class for customizing table header renderer without loosing its L&F
- *
- * Created on Aug 10, 2010
- * @author Eugene Ryzhikov
- *
- */
-public class TableHeaderRenderer extends JComponent implements TableCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
- boolean hasFocus, int row, int column) {
-
- // returns component used for default header rendering
- // makes it independent on current L&F
-
- return table.getTableHeader().getDefaultRenderer().
- getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-
- }
-
- // following methods are overriden for performance reasons
-
- @Override
- public void validate() {}
-
- @Override
- public void revalidate() {}
-
- @Override
- public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
-
- @Override
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {}
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/AbstractTableFilter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/AbstractTableFilter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/AbstractTableFilter.java
deleted file mode 100644
index 313e684..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/AbstractTableFilter.java
+++ /dev/null
@@ -1,191 +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.table.filter;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JTable;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.TableModel;
-
-import static org.oxbow.swingbits.util.CollectionUtils.*;
-
-/**
- * Partial implementation of table filter
- *
- * Created on Feb 10, 2011
- * @author Eugene Ryzhikov
- *
- * @param <T>
- */
-@SuppressWarnings("serial")
-public abstract class AbstractTableFilter<T extends JTable> implements ITableFilter<T> {
-
- private final Set<IFilterChangeListener> listeners = Collections.synchronizedSet( new HashSet<IFilterChangeListener>());
-
- private final Map<Integer, Collection<DistinctColumnItem>> distinctItemCache =
- Collections.synchronizedMap(new HashMap<Integer, Collection<DistinctColumnItem>>());
-
- private final T table;
- private final TableFilterState filterState = new TableFilterState();
-
- public AbstractTableFilter( T table ) {
- this.table = table;
- setupDistinctItemCacheRefresh();
- }
-
- private void setupDistinctItemCacheRefresh() {
- clearDistinctItemCache();
- this.table.addPropertyChangeListener("model", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- clearDistinctItemCache();
- TableModel model = (TableModel) e.getNewValue();
- if ( model != null ) {
- model.addTableModelListener( new TableModelListener() {
-
- @Override
- public void tableChanged(TableModelEvent e) {
- clearDistinctItemCache();
- }
- });
- }
- }
- });
- }
-
-
- private void clearDistinctItemCache() {
- distinctItemCache.clear();
- }
-
- @Override
- public T getTable() {
- return table;
- }
-
- protected abstract boolean execute(int col, Collection<DistinctColumnItem> items);
-
- @Override
- public boolean apply(int col, Collection<DistinctColumnItem> items) {
- setFilterState(col, items);
- boolean result = false;
- if ( result = execute( col, items ) ) fireFilterChange();
- return result;
- }
-
-
- @Override
- public final void addChangeListener( IFilterChangeListener listener ) {
- if ( listener != null ) listeners.add(listener);
- }
-
- @Override
- public final void removeChnageListener( IFilterChangeListener listener ) {
- if ( listener != null ) listeners.remove(listener);
- }
-
- public final void fireFilterChange() {
- for( IFilterChangeListener l: listeners ) {
- l.filterChanged(AbstractTableFilter.this);
- }
- }
-
- @Override
- public Collection<DistinctColumnItem> getDistinctColumnItems( int column ) {
- Collection<DistinctColumnItem> result = distinctItemCache.get(column);
- if ( result == null ) {
- result = collectDistinctColumnItems( column );
- distinctItemCache.put(column, result);
- }
- return result;
-
- }
-
- private Collection<DistinctColumnItem> collectDistinctColumnItems( int column ) {
- Set<DistinctColumnItem> set = new HashSet<DistinctColumnItem>(); // to collect unique items
- int nullIndex = -1;
- for( int row=0; row<table.getModel().getRowCount(); row++) {
- Object value = table.getModel().getValueAt( row, column);
- // adding null to TreeSet will produce NPE, just remember we had it
- if ( value == null ) {
- nullIndex = row;
- } else {
- set.add( new DistinctColumnItem(value, row ));
- }
- }
- List<DistinctColumnItem> result = new ArrayList<DistinctColumnItem>(set);
- if ( nullIndex >= 0 ) result.add(0, new DistinctColumnItem(null, nullIndex)); // add null to resulting collection if we had it
-
- return trySort(result);
- }
-
- @Override
- public Collection<DistinctColumnItem> getFilterState( int column ) {
- return filterState.getValues(column);
- }
-
- @Override
- public boolean isFiltered( int column ) {
- Collection<DistinctColumnItem> checks = getFilterState( column );
- return !isEmpty(checks) && getDistinctColumnItems( column ).size() != checks.size();
- }
-
- @Override
- public boolean includeRow( ITableFilter.Row row ) {
- return filterState.include(row);
- }
-
- public void setFilterState(int column, Collection<DistinctColumnItem> values ) {
- filterState.setValues(column, values);
- }
-
- public void clear() {
- filterState.clear();
- Collection<DistinctColumnItem> items = Collections.emptyList();
- for( int column=0; column<table.getModel().getColumnCount(); column++) {
- execute(column, items);
- }
- fireFilterChange();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/DistinctColumnItem.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/DistinctColumnItem.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/DistinctColumnItem.java
deleted file mode 100644
index 57ec538..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/DistinctColumnItem.java
+++ /dev/null
@@ -1,115 +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.table.filter;
-
-import java.math.BigDecimal;
-
-import org.oxbow.swingbits.util.IValueWrapper;
-
-public class DistinctColumnItem implements Comparable<DistinctColumnItem>, IValueWrapper<Object> {
-
- private final Object value;
- private final int row;
-
- public DistinctColumnItem( Object value, int row) {
- this.value = value;
- this.row = row;
- }
-
- public Object getValue() {
- return value;
- }
-
- public int getRow() {
- return row;
- }
-
- @Override
- public String toString() {
- return value == null? "": value.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- DistinctColumnItem other = (DistinctColumnItem) obj;
- if (value == null) {
- if (other.value != null)
- return false;
- } else if (!value.equals(other.value))
- return false;
- return true;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public int compareTo(DistinctColumnItem o) {
-
- if ( value == null ) {
- return ( o == null || o.value == null )? 0: -1;
- }
- if ( o == null || o.value == null ) return 1;
-
- if ( value.getClass() == o.value.getClass() ) {
- if ( value instanceof Comparable) {
- return ((Comparable<Object>)value).compareTo(o.value);
- } else {
- return value.toString().compareTo(o.value.toString());
- }
- } else {
-
- if ( value instanceof Number && o.value instanceof Number) {
- BigDecimal a = new BigDecimal(value.toString());
- BigDecimal b = new BigDecimal(o.value.toString());
- return a.compareTo(b);
- }
-
- return value.getClass().getName().compareTo(o.getClass().getName());
- }
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/FilterTableHeaderRenderer.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/FilterTableHeaderRenderer.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/FilterTableHeaderRenderer.java
deleted file mode 100644
index b74e9e2..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/FilterTableHeaderRenderer.java
+++ /dev/null
@@ -1,103 +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.table.filter;
-
-import java.awt.Component;
-import java.awt.Image;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-
-import org.oxbow.swingbits.table.TableHeaderRenderer;
-import org.oxbow.swingbits.util.swing.CompoundIcon;
-
-/**
- * Table header renderer to show the column filter state
- *
- * Created on Feb 10, 2011
- * @author Eugene Ryzhikov
- *
- */
-class FilterTableHeaderRenderer extends TableHeaderRenderer {
-
- private static final long serialVersionUID = 1L;
-
- private ImageIcon icon;
- private final ITableFilter<?> tableFilter;
- private boolean rendererInit = true;
- private int originalHorizontalTextPosition;
-
- public FilterTableHeaderRenderer( ITableFilter<?> tableFilter ) {
- this.tableFilter = tableFilter;
- }
-
- private Icon getFilterIcon() {
-
- if (icon == null) {
- icon = new ImageIcon( getClass().getResource("funnel.png"));
- icon = new ImageIcon( icon.getImage().getScaledInstance( 12, 12, Image.SCALE_SMOOTH ));
- }
- return icon;
-
- }
-
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
- boolean hasFocus, int row, int column) {
-
- final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
- if ( rendererInit ) {
- originalHorizontalTextPosition = label.getHorizontalTextPosition();
- rendererInit = false;
- }
-
- int modelColumn = table.convertColumnIndexToModel(column);
- if ( tableFilter.isFiltered(modelColumn) ) {
-
- Icon originalIcon = label.getIcon();
- if ( originalIcon == null ) {
- label.setIcon( getFilterIcon() );
- } else {
- label.setIcon( new CompoundIcon( getFilterIcon(), originalIcon ) );
- }
- label.setHorizontalTextPosition( JLabel.TRAILING );
-
- } else {
- label.setHorizontalTextPosition( originalHorizontalTextPosition );
- }
-
- return label;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/IFilterChangeListener.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/IFilterChangeListener.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/IFilterChangeListener.java
deleted file mode 100644
index 42f20ad..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/IFilterChangeListener.java
+++ /dev/null
@@ -1,37 +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.table.filter;
-
-public interface IFilterChangeListener {
-
- void filterChanged( ITableFilter<?> filter );
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/ITableFilter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/ITableFilter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/ITableFilter.java
deleted file mode 100644
index a237228..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/ITableFilter.java
+++ /dev/null
@@ -1,99 +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.table.filter;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import javax.swing.JTable;
-import javax.swing.table.TableModel;
-
-public interface ITableFilter<T extends JTable> extends Serializable {
-
- /**
- * The table under filter
- * @return
- */
- T getTable();
-
- /**
- *
- * @param column model column index
- * @return
- */
- Collection<DistinctColumnItem> getDistinctColumnItems( int column );
-
- /**
- *
- * @param column model column index
- * @return
- */
- Collection<DistinctColumnItem> getFilterState( int column );
-
- /**
- * Checks if column is filtered
- * @param column model column index
- * @return true if column is filtered
- */
- boolean isFiltered( int column );
-
- boolean includeRow( Row entry );
-
- /**
- * Apply filter for specified column based on collection of distinct items
- * @param col
- * @param items
- * @return
- */
- boolean apply( int col, Collection<DistinctColumnItem> items );
-
- public interface Row {
- int getValueCount();
- Object getValue( int column );
- }
-
- void addChangeListener( IFilterChangeListener listener );
- void removeChnageListener( IFilterChangeListener listener );
-
- /**
- * Clear the filter
- */
- void clear();
-
- /**
- * Describes what filter has to do when table model changes
- * @param model
- */
- void modelChanged( TableModel model );
-
-}
[11/13] git commit: MARMOTTA-419: removed 3rd-party source-code from
the tree (and from N&L)
Posted by ja...@apache.org.
MARMOTTA-419: removed 3rd-party source-code from the tree (and from N&L)
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/60ae655a
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/60ae655a
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/60ae655a
Branch: refs/heads/develop
Commit: 60ae655ac8d185bb5b372f32cc077a53dc3c44b8
Parents: 0c8ccdb
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Jan 10 15:01:58 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Jan 10 15:02:53 2014 +0100
----------------------------------------------------------------------
LICENSE.txt | 71 -
.../src/main/resources/installer/LICENSE.txt | 72 -
launchers/marmotta-splash/pom.xml | 28 -
.../src/ext/java/net/miginfocom/layout/AC.java | 564 -----
.../java/net/miginfocom/layout/BoundSize.java | 273 --
.../src/ext/java/net/miginfocom/layout/CC.java | 1833 --------------
.../net/miginfocom/layout/ComponentWrapper.java | 297 ---
.../net/miginfocom/layout/ConstraintParser.java | 1464 -----------
.../net/miginfocom/layout/ContainerWrapper.java | 69 -
.../net/miginfocom/layout/DimConstraint.java | 471 ----
.../ext/java/net/miginfocom/layout/Grid.java | 2350 ------------------
.../ext/java/net/miginfocom/layout/IDEUtil.java | 789 ------
.../miginfocom/layout/InCellGapProvider.java | 65 -
.../src/ext/java/net/miginfocom/layout/LC.java | 1032 --------
.../net/miginfocom/layout/LayoutCallback.java | 77 -
.../java/net/miginfocom/layout/LayoutUtil.java | 566 -----
.../java/net/miginfocom/layout/LinkHandler.java | 200 --
.../net/miginfocom/layout/PlatformDefaults.java | 772 ------
.../net/miginfocom/layout/ResizeConstraint.java | 92 -
.../net/miginfocom/layout/UnitConverter.java | 59 -
.../java/net/miginfocom/layout/UnitValue.java | 637 -----
.../java/net/miginfocom/swing/MigLayout.java | 701 ------
.../miginfocom/swing/SwingComponentWrapper.java | 459 ----
.../miginfocom/swing/SwingContainerWrapper.java | 109 -
.../swingbits/action/ActionBuilderHelper.java | 241 --
.../action/ActionContainerBuilderFactory.java | 89 -
.../swingbits/action/ActionDropDownMenu.java | 91 -
.../org/oxbow/swingbits/action/ActionGroup.java | 131 -
.../org/oxbow/swingbits/action/Actions.java | 83 -
.../org/oxbow/swingbits/action/CheckAction.java | 39 -
.../action/IActionContainerBuilder.java | 43 -
.../org/oxbow/swingbits/action/RadioAction.java | 39 -
.../org/oxbow/swingbits/action/dropdown.png | Bin 1227 -> 0 bytes
.../swingbits/dialog/task/CommandLink.java | 104 -
.../dialog/task/ContentDesignFactory.java | 55 -
.../dialog/task/ICommandLinkPainter.java | 43 -
.../swingbits/dialog/task/IContentDesign.java | 127 -
.../oxbow/swingbits/dialog/task/TaskDialog.java | 968 --------
.../dialog/task/TaskDialogException.java | 53 -
.../swingbits/dialog/task/TaskDialogs.java | 666 -----
.../dialog/task/design/CommandLinkButton.java | 147 --
.../task/design/CommandLinkButtonGroup.java | 53 -
.../task/design/DefaultCommandLinkPainter.java | 162 --
.../task/design/DefaultContentDesign.java | 192 --
.../dialog/task/design/DetailsToggleButton.java | 49 -
.../dialog/task/design/LinuxContentDesign.java | 75 -
.../task/design/MacOsCommandLinkPainter.java | 48 -
.../dialog/task/design/MacOsContentDesign.java | 137 -
.../dialog/task/design/TaskDialogContent.java | 385 ---
.../task/design/WindowsCommandLinkPainter.java | 65 -
.../task/design/WindowsContentDesign.java | 66 -
.../swingbits/list/ActionCheckListModel.java | 188 --
.../org/oxbow/swingbits/list/CheckList.java | 173 --
.../oxbow/swingbits/list/CheckListEditor.java | 84 -
.../swingbits/list/CheckListFilterType.java | 31 -
.../oxbow/swingbits/list/CheckListRenderer.java | 228 --
.../swingbits/list/DefaultCheckListModel.java | 175 --
.../oxbow/swingbits/list/ICheckListAction.java | 33 -
.../oxbow/swingbits/list/ICheckListModel.java | 77 -
.../oxbow/swingbits/misc/JSearchTextField.java | 72 -
.../java/org/oxbow/swingbits/misc/search.png | Bin 851 -> 0 bytes
.../org/oxbow/swingbits/popup/PopupWindow.java | 331 ---
.../swingbits/table/TableHeaderRenderer.java | 77 -
.../table/filter/AbstractTableFilter.java | 191 --
.../table/filter/DistinctColumnItem.java | 115 -
.../table/filter/FilterTableHeaderRenderer.java | 103 -
.../table/filter/IFilterChangeListener.java | 37 -
.../swingbits/table/filter/ITableFilter.java | 99 -
.../swingbits/table/filter/JTableFilter.java | 116 -
.../filter/TableAwareCheckListRenderer.java | 86 -
.../table/filter/TableFilterColumnPopup.java | 317 ---
.../table/filter/TableFilterState.java | 129 -
.../table/filter/TableRowFilterSupport.java | 166 --
.../org/oxbow/swingbits/table/filter/funnel.png | Bin 797 -> 0 bytes
.../swingbits/table/filter/funnel_delete.png | Bin 906 -> 0 bytes
.../oxbow/swingbits/util/CollectionUtils.java | 64 -
.../java/org/oxbow/swingbits/util/DeepCopy.java | 94 -
.../oxbow/swingbits/util/DeepCopyException.java | 57 -
.../util/DefaultObjectToStringTranslator.java | 42 -
.../util/IObjectToStringTranslator.java | 38 -
.../org/oxbow/swingbits/util/IValueWrapper.java | 7 -
.../java/org/oxbow/swingbits/util/Markup.java | 123 -
.../oxbow/swingbits/util/OperatingSystem.java | 97 -
.../org/oxbow/swingbits/util/Preconditions.java | 58 -
.../org/oxbow/swingbits/util/Screenshot.java | 143 --
.../java/org/oxbow/swingbits/util/Strings.java | 102 -
.../util/copy/FastByteArrayInputStream.java | 92 -
.../util/copy/FastByteArrayOutputStream.java | 117 -
.../swingbits/util/swing/AncestorAdapter.java | 51 -
.../swingbits/util/swing/BeanProperty.java | 93 -
.../swingbits/util/swing/CompoundIcon.java | 302 ---
.../oxbow/swingbits/util/swing/EmptyIcon.java | 104 -
.../org/oxbow/swingbits/util/swing/Icons.java | 98 -
.../oxbow/swingbits/util/swing/SwingBean.java | 76 -
.../src/ext/resources/META-INF/LICENSE | 208 --
.../src/ext/resources/META-INF/NOTICE | 11 -
.../swingbits/dialog/task/arrowGreenRight.png | Bin 3526 -> 0 bytes
.../swingbits/dialog/task/fewerDetails.png | Bin 933 -> 0 bytes
.../swingbits/dialog/task/fewerDetailsMac.png | Bin 458 -> 0 bytes
.../oxbow/swingbits/dialog/task/linux_error.png | Bin 1998 -> 0 bytes
.../oxbow/swingbits/dialog/task/linux_info.png | Bin 2328 -> 0 bytes
.../swingbits/dialog/task/linux_question.png | Bin 2671 -> 0 bytes
.../swingbits/dialog/task/linux_warning.png | Bin 2169 -> 0 bytes
.../oxbow/swingbits/dialog/task/moreDetails.png | Bin 912 -> 0 bytes
.../swingbits/dialog/task/moreDetailsMac.png | Bin 468 -> 0 bytes
.../src/main/resources/META-INF/LICENSE | 284 ---
.../src/main/resources/META-INF/NOTICE | 11 -
.../src/main/resources/task-dialog.properties | 34 -
.../main/resources/task-dialog_de_DE.properties | 16 -
.../main/resources/task-dialog_es_ES.properties | 16 -
.../main/resources/task-dialog_fr_FR.properties | 16 -
.../main/resources/task-dialog_it_IT.properties | 16 -
.../main/resources/task-dialog_pl_PL.properties | 16 -
.../main/resources/task-dialog_pt_BR.properties | 16 -
.../main/resources/task-dialog_pt_PT.properties | 16 -
.../main/resources/task-dialog_zh_CN.properties | 16 -
.../src/main/webapp/META-INF/LICENSE | 72 -
.../src/main/webapp/META-INF/LICENSE | 72 -
118 files changed, 22607 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index f08ca02..7779dd8 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -398,77 +398,6 @@ external projects with separate copyright notices and license terms. Your use of
the code for the these subcomponents is subject to the terms and conditions of
the following licenses.
-For the MigLayout component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2004 MiG InfoCom AB, http://www.migcalendar.com/miglayout
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
-For the SwingBits component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2006 EzWare, http://swingbits.sourceforge.net
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
For the ROME component,
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt b/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
index 7dbafbf..ac64adc 100644
--- a/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
+++ b/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
@@ -2537,78 +2537,6 @@ external projects with separate copyright notices and license terms. Your use of
the code for the these subcomponents is subject to the terms and conditions of
the following licenses.
-For the MigLayout component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2004 MiG InfoCom AB, http://www.migcalendar.com/miglayout
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
-For the SwingBits component,
-
- located at:
- launchers/marmotta-splash/src/ext/java
-
- Copyright (c) 2006 EzWare, http://swingbits.sourceforge.net
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. 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.
-
- 3. 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 HOLDER 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.
-
-
For the ROME component,
located at:
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/pom.xml b/launchers/marmotta-splash/pom.xml
index 4b1e73f..b13ea48 100644
--- a/launchers/marmotta-splash/pom.xml
+++ b/launchers/marmotta-splash/pom.xml
@@ -50,32 +50,4 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals><goal>add-source</goal></goals>
- <configuration>
- <sources>
- <source>src/ext/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>src/ext/resources</directory>
- </resource>
- </resources>
- </build>
-
</project>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/AC.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/AC.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/AC.java
deleted file mode 100644
index c526ef4..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/AC.java
+++ /dev/null
@@ -1,564 +0,0 @@
-package net.miginfocom.layout;
-
-import java.io.*;
-import java.util.ArrayList;
-
-/*
- * 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
- */
-
-/** A constraint that holds the column <b>or</b> row constraints for the grid. It also holds the gaps between the rows and columns.
- * <p>
- * This class is a holder and builder for a number of {@link net.miginfocom.layout.DimConstraint}s.
- * <p>
- * For a more thorough explanation of what these constraints do, and how to build the constraints, see the White Paper or Cheat Sheet at www.migcomponents.com.
- * <p>
- * Note that there are two way to build this constraint. Through String (e.g. <code>"[100]3[200,fill]"</code> or through API (E.g.
- * <code>new AxisConstraint().size("100").gap("3").size("200").fill()</code>.
- */
-public final class AC implements Externalizable
-{
- private final ArrayList<DimConstraint> cList = new ArrayList<DimConstraint>(8);
-
- private transient int curIx = 0;
-
- /** Constructor. Creates an instance that can be configured manually. Will be initialized with a default
- * {@link net.miginfocom.layout.DimConstraint}.
- */
- public AC()
- {
- cList.add(new DimConstraint());
- }
-
- /** Property. The different {@link net.miginfocom.layout.DimConstraint}s that this object consists of.
- * These <code><DimConstraints/code> contains all information in this class.
- * <p>
- * Yes, we are embarrassingly aware that the method is misspelled.
- * @return The different {@link net.miginfocom.layout.DimConstraint}s that this object consists of. A new list and
- * never <code>null</code>.
- */
- public final DimConstraint[] getConstaints()
- {
- return cList.toArray(new DimConstraint[cList.size()]);
- }
-
- /** Sets the different {@link net.miginfocom.layout.DimConstraint}s that this object should consists of.
- * <p>
- * Yes, we are embarrassingly aware that the method is misspelled.
- * @param constr The different {@link net.miginfocom.layout.DimConstraint}s that this object consists of. The list
- * will be copied for storage. <code>null</code> or and emty array will reset the constraints to one <code>DimConstraint</code>
- * with default values.
- */
- public final void setConstaints(DimConstraint[] constr)
- {
- if (constr == null || constr.length < 1 )
- constr = new DimConstraint[] {new DimConstraint()};
-
- cList.clear();
- cList.ensureCapacity(constr.length);
- for (DimConstraint c : constr)
- cList.add(c);
- }
-
- /** Returns the number of rows/columns that this constraints currently have.
- * @return The number of rows/columns that this constraints currently have. At least 1.
- */
- public int getCount()
- {
- return cList.size();
- }
-
- /** Sets the total number of rows/columns to <code>size</code>. If the number of rows/columns is already more
- * than <code>size</code> nothing will happen.
- * @param size The total number of rows/columns
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC count(int size)
- {
- makeSize(size);
- return this;
- }
-
- /** Specifies that the current row/column should not be grid-like. The while row/colum will have its components layed out
- * in one single cell. It is the same as to say that the cells in this column/row will all be merged (a.k.a spanned).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC noGrid()
- {
- return noGrid(curIx);
- }
-
- /** Specifies that the indicated rows/columns should not be grid-like. The while row/colum will have its components layed out
- * in one single cell. It is the same as to say that the cells in this column/row will all be merged (a.k.a spanned).
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC noGrid(int... indexes)
- {
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setNoGrid(true);
- }
- return this;
- }
-
- /** Sets the current row/column to <code>i</code>. If the current number of rows/columns is less than <code>i</code> a call
- * to {@link #count(int)} will set the size accordingly.
- * <p>
- * The next call to any of the constraint methods (e.g. {@link net.miginfocom.layout.AC#noGrid}) will be carried
- * out on this new row/column.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param i The new current row/column.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC index(int i)
- {
- makeSize(i);
- curIx = i;
- return this;
- }
-
- /** Specifies that the current row/column's component should grow by default. It does not affect the size of the row/column.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC fill()
- {
- return fill(curIx);
- }
-
- /** Specifies that the indicated rows'/columns' component should grow by default. It does not affect the size of the row/column.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC fill(int... indexes)
- {
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setFill(true);
- }
- return this;
- }
-
-// /** Specifies that the current row/column should be put in the end group <code>s</code> and will thus share the same ending
-// * coordinate within the group.
-// * <p>
-// * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
-// * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
-// * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
-// */
-// public final AxisConstraint endGroup(String s)
-// {
-// return endGroup(s, curIx);
-// }
-//
-// /** Specifies that the indicated rows/columns should be put in the end group <code>s</code> and will thus share the same ending
-// * coordinate within the group.
-// * <p>
-// * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
-// * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
-// * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
-// * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
-// */
-// public final AxisConstraint endGroup(String s, int... indexes)
-// {
-// for (int i = indexes.length - 1; i >= 0; i--) {
-// int ix = indexes[i];
-// makeSize(ix);
-// cList.get(ix).setEndGroup(s);
-// }
-// return this;
-// }
-
- /** Specifies that the current row/column should be put in the size group <code>s</code> and will thus share the same size
- * constraints as the other components in the group.
- * <p>
- * Same as <code>sizeGroup("")</code>
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final AC sizeGroup()
- {
- return sizeGroup("", curIx);
- }
-
- /** Specifies that the current row/column should be put in the size group <code>s</code> and will thus share the same size
- * constraints as the other components in the group.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC sizeGroup(String s)
- {
- return sizeGroup(s, curIx);
- }
-
- /** Specifies that the indicated rows/columns should be put in the size group <code>s</code> and will thus share the same size
- * constraints as the other components in the group.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s A name to associate on the group that should be the same for other rows/columns in the same group.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC sizeGroup(String s, int... indexes)
- {
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setSizeGroup(s);
- }
- return this;
- }
-
- /** Specifies the current row/column's min and/or preferred and/or max size. E.g. <code>"10px"</code> or <code>"50:100:200"</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param s The minimum and/or preferred and/or maximum size of this row. The string will be interpreted
- * as a <b>BoundSize</b>. For more info on how <b>BoundSize</b> is formatted see the documentation.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC size(String s)
- {
- return size(s, curIx);
- }
-
- /** Specifies the indicated rows'/columns' min and/or preferred and/or max size. E.g. <code>"10px"</code> or <code>"50:100:200"</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size The minimum and/or preferred and/or maximum size of this row. The string will be interpreted
- * as a <b>BoundSize</b>. For more info on how <b>BoundSize</b> is formatted see the documentation.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC size(String size, int... indexes)
- {
- BoundSize bs = ConstraintParser.parseBoundSize(size, false, true);
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setSize(bs);
- }
- return this;
- }
-
- /** Specifies the gap size to be the default one <b>AND</b> moves to the next column/row. The method is called <code>.gap()</code>
- * rather the more natural <code>.next()</code> to indicate that it is very much related to the other <code>.gap(..)</code> methods.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC gap()
- {
- curIx++;
- return this;
- }
-
- /** Specifies the gap size to <code>size</code> <b>AND</b> moves to the next column/row.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size minimum and/or preferred and/or maximum size of the gap between this and the next row/column.
- * The string will be interpreted as a <b>BoundSize</b>. For more info on how <b>BoundSize</b> is formatted see the documentation.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC gap(String size)
- {
- return gap(size, curIx++);
- }
-
- /** Specifies the indicated rows'/columns' gap size to <code>size</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param size minimum and/or preferred and/or maximum size of the gap between this and the next row/column.
- * The string will be interpreted as a <b>BoundSize</b>. For more info on how <b>BoundSize</b> is formatted see the documentation.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC gap(String size, int... indexes)
- {
- BoundSize bsa = size != null ? ConstraintParser.parseBoundSize(size, true, true) : null;
-
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- if (bsa != null)
- cList.get(ix).setGapAfter(bsa);
- }
- return this;
- }
-
- /** Specifies the current row/column's columns default alignment <b>for its components</b>. It does not affect the positioning
- * or size of the columns/row itself. For columns it is the horizonal alignment (e.g. "left") and for rows it is the vertical
- * alignment (e.g. "top").
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param side The default side to align the components. E.g. "top" or "left", or "leading" or "trailing" or "bottom" or "right".
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC align(String side)
- {
- return align(side, curIx);
- }
-
- /** Specifies the indicated rows'/columns' columns default alignment <b>for its components</b>. It does not affect the positioning
- * or size of the columns/row itself. For columns it is the horizonal alignment (e.g. "left") and for rows it is the vertical
- * alignment (e.g. "top").
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param side The default side to align the components. E.g. "top" or "left", or "before" or "after" or "bottom" or "right".
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC align(String side, int... indexes)
- {
- UnitValue al = ConstraintParser.parseAlignKeywords(side, true);
- if (al == null)
- al = ConstraintParser.parseAlignKeywords(side, false);
-
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setAlign(al);
- }
- return this;
- }
-
- /** Specifies the current row/column's grow priority.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new grow priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC growPrio(int p)
- {
- return growPrio(p, curIx);
- }
-
- /** Specifies the indicated rows'/columns' grow priority.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new grow priority.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC growPrio(int p, int... indexes)
- {
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setGrowPriority(p);
- }
- return this;
- }
-
- /** Specifies the current row/column's grow weight within columns/rows with the <code>grow priority</code> 100f.
- * <p>
- * Same as <code>grow(100f)</code>
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final AC grow()
- {
- return grow(1f, curIx);
- }
-
- /** Specifies the current row/column's grow weight within columns/rows with the same <code>grow priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new grow weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC grow(float w)
- {
- return grow(w, curIx);
- }
-
- /** Specifies the indicated rows'/columns' grow weight within columns/rows with the same <code>grow priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param w The new grow weight.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC grow(float w, int... indexes)
- {
- Float gw = new Float(w);
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setGrow(gw);
- }
- return this;
- }
-
- /** Specifies the current row/column's shrink priority.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new shrink priority.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC shrinkPrio(int p)
- {
- return shrinkPrio(p, curIx);
- }
-
- /** Specifies the indicated rows'/columns' shrink priority.
- * <p>
- * For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
- * @param p The new shrink priority.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- */
- public final AC shrinkPrio(int p, int... indexes)
- {
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setShrinkPriority(p);
- }
- return this;
- }
-
- /** Specifies that the current row/column's shrink weight withing the columns/rows with the <code>shrink priority</code> 100f.
- * <p>
- * Same as <code>shrink(100f)</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final AC shrink()
- {
- return shrink(100f, curIx);
- }
-
- /** Specifies that the current row/column's shrink weight withing the columns/rows with the same <code>shrink priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.
- * @param w The shrink weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final AC shrink(float w)
- {
- return shrink(w, curIx);
- }
-
- /** Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same <code>shrink priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.
- * @param w The shrink weight.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @since 3.7.2
- */
- public final AC shrink(float w, int... indexes)
- {
- Float sw = new Float(w);
- for (int i = indexes.length - 1; i >= 0; i--) {
- int ix = indexes[i];
- makeSize(ix);
- cList.get(ix).setShrink(sw);
- }
- return this;
- }
-
- /** Specifies that the current row/column's shrink weight withing the columns/rows with the same <code>shrink priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.
- * @param w The shrink weight.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @deprecated in 3.7.2. Use {@link #shrink(float)} instead.
- */
- public final AC shrinkWeight(float w)
- {
- return shrink(w);
- }
-
- /** Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same <code>shrink priority</code>.
- * <p>
- * For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.
- * @param w The shrink weight.
- * @param indexes The index(es) (0-based) of the columns/rows that should be affected by this constraint.
- * @return <code>this</code> so it is possible to chain calls. E.g. <code>new AxisConstraint().noGrid().gap().fill()</code>.
- * @deprecated in 3.7.2. Use {@link #shrink(float, int...)} instead.
- */
- public final AC shrinkWeight(float w, int... indexes)
- {
- return shrink(w, indexes);
- }
-
- private void makeSize(int sz)
- {
- if (cList.size() <= sz) {
- cList.ensureCapacity(sz);
- for (int i = cList.size(); i <= sz; i++)
- cList.add(new DimConstraint());
- }
- }
-
- // ************************************************
- // 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() == AC.class)
- LayoutUtil.writeAsXML(out, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/BoundSize.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/BoundSize.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/BoundSize.java
deleted file mode 100644
index 924a644..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/BoundSize.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package net.miginfocom.layout;
-
-import java.beans.Encoder;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
-import java.io.*;
-/*
- * 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
- */
-
-/** A size that contains minimum, preferred and maximum size of type {@link UnitValue}.
- * <p>
- * This class is a simple value container and it is immutable.
- * <p>
- * If a size is missing (i.e., <code>null</code>) that boundary should be considered "not in use".
- * <p>
- * You can create a BoundSize from a String with the use of {@link ConstraintParser#parseBoundSize(String, boolean, boolean)}
- */
-public class BoundSize implements Serializable
-{
- public static final BoundSize NULL_SIZE = new BoundSize(null, null);
- public static final BoundSize ZERO_PIXEL = new BoundSize(UnitValue.ZERO, "0px");
-
- private final transient UnitValue min;
- private final transient UnitValue pref;
- private final transient UnitValue max;
- private final transient boolean gapPush;
-
- /** Constructor that use the same value for min/preferred/max size.
- * @param minMaxPref The value to use for min/preferred/max size.
- * @param createString The string used to create the BoundsSize.
- */
- public BoundSize(UnitValue minMaxPref, String createString)
- {
- this(minMaxPref, minMaxPref, minMaxPref, createString);
- }
-
- /** Constructor. <b>This method is here for serilization only and should normally not be used. Use
- * {@link ConstraintParser#parseBoundSize(String, boolean, boolean)} instead.
- * @param min The minimum size. May be <code>null</code>.
- * @param preferred The preferred size. May be <code>null</code>.
- * @param max The maximum size. May be <code>null</code>.
- * @param createString The string used to create the BoundsSize.
- */
- public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, String createString) // Bound to old delegate!!!!!
- {
- this(min, preferred, max, false, createString);
- }
-
- /** Constructor. <b>This method is here for serilization only and should normally not be used. Use
- * {@link ConstraintParser#parseBoundSize(String, boolean, boolean)} instead.
- * @param min The minimum size. May be <code>null</code>.
- * @param preferred The preferred size. May be <code>null</code>.
- * @param max The maximum size. May be <code>null</code>.
- * @param gapPush If the size should be hinted as "pushing" and thus want to occupy free space if no one else is claiming it.
- * @param createString The string used to create the BoundsSize.
- */
- public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, boolean gapPush, String createString)
- {
- this.min = min;
- this.pref = preferred;
- this.max = max;
- this.gapPush = gapPush;
-
- LayoutUtil.putCCString(this, createString); // this escapes!!
- }
-
- /** Returns the minimum size as sent into the constructor.
- * @return The minimum size as sent into the constructor. May be <code>null</code>.
- */
- public final UnitValue getMin()
- {
- return min;
- }
-
- /** Returns the preferred size as sent into the constructor.
- * @return The preferred size as sent into the constructor. May be <code>null</code>.
- */
- public final UnitValue getPreferred()
- {
- return pref;
- }
-
- /** Returns the maximum size as sent into the constructor.
- * @return The maximum size as sent into the constructor. May be <code>null</code>.
- */
- public final UnitValue getMax()
- {
- return max;
- }
-
- /** If the size should be hinted as "pushing" and thus want to occupy free space if noone else is claiming it.
- * @return The value.
- */
- public boolean getGapPush()
- {
- return gapPush;
- }
-
- /** Returns if this bound size has no min, preferred and maximum size set (they are all <code>null</code>)
- * @return If unset.
- */
- public boolean isUnset()
- {
- // Most common case by far is this == ZERO_PIXEL...
- return this == ZERO_PIXEL || (pref == null && min == null && max == null && gapPush == false);
- }
-
- /** Makes sure that <code>size</code> is within min and max of this size.
- * @param size The size to constrain.
- * @param refValue The reference to use for relative sizes.
- * @param parent The parent container.
- * @return The size, constrained within min and max.
- */
- public int constrain(int size, float refValue, ContainerWrapper parent)
- {
- if (max != null)
- size = Math.min(size, max.getPixels(refValue, parent, parent));
- if (min != null)
- size = Math.max(size, min.getPixels(refValue, parent, parent));
- return size;
- }
-
- /** Returns the minimum, preferred or maximum size for this bounded size.
- * @param sizeType The type. <code>LayoutUtil.MIN</code>, <code>LayoutUtil.PREF</code> or <code>LayoutUtil.MAX</code>.
- * @return
- */
- final UnitValue getSize(int sizeType)
- {
- switch(sizeType) {
- case LayoutUtil.MIN:
- return min;
- case LayoutUtil.PREF:
- return pref;
- case LayoutUtil.MAX:
- return max;
- default:
- throw new IllegalArgumentException("Unknown size: " + sizeType);
- }
- }
-
- /** Convert the bound sizes to pixels.
- * <p>
- * <code>null</code> bound sizes will be 0 for min and preferred and {@link net.miginfocom.layout.LayoutUtil#INF} for max.
- * @param refSize The reference size.
- * @param parent The parent. Not <code>null</code>.
- * @param comp The component, if applicable, can be <code>null</code>.
- * @return An array of lenth three (min,pref,max).
- */
- final int[] getPixelSizes(float refSize, ContainerWrapper parent, ComponentWrapper comp)
- {
- return new int[] {
- min != null ? min.getPixels(refSize, parent, comp) : 0,
- pref != null ? pref.getPixels(refSize, parent, comp) : 0,
- max != null ? max.getPixels(refSize, parent, comp) : LayoutUtil.INF
- };
- }
-
- /** Returns the a constraint string that can be re-parsed to be the exact same UnitValue.
- * @return A String. Never <code>null</code>.
- */
- String getConstraintString()
- {
- String cs = LayoutUtil.getCCString(this);
- if (cs != null)
- return cs;
-
- if (min == pref && pref == max)
- return min != null ? (min.getConstraintString() + "!") : "null";
-
- StringBuilder sb = new StringBuilder(16);
-
- if (min != null)
- sb.append(min.getConstraintString()).append(':');
-
- if (pref != null) {
- if (min == null && max != null)
- sb.append(":");
- sb.append(pref.getConstraintString());
- } else if (min != null) {
- sb.append('n');
- }
-
- if (max != null)
- sb.append(sb.length() == 0 ? "::" : ":").append(max.getConstraintString());
-
- if (gapPush) {
- if (sb.length() > 0)
- sb.append(':');
- sb.append("push");
- }
-
- return sb.toString();
- }
-
- void checkNotLinked()
- {
- if (min != null && min.isLinkedDeep() || pref != null && pref.isLinkedDeep() || max != null && max.isLinkedDeep())
- throw new IllegalArgumentException("Size may not contain links");
- }
-
- static {
- if(LayoutUtil.HAS_BEANS){
- LayoutUtil.setDelegate(BoundSize.class, new PersistenceDelegate() {
- protected Expression instantiate(Object oldInstance, Encoder out)
- {
- BoundSize bs = (BoundSize) oldInstance;
- if (Grid.TEST_GAPS) {
- return new Expression(oldInstance, BoundSize.class, "new", new Object[] {
- bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getGapPush(), bs.getConstraintString()
- });
- } else {
- return new Expression(oldInstance, BoundSize.class, "new", new Object[] {
- bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getConstraintString()
- });
- }
- }
- });
- }
- }
-
- // ************************************************
- // Persistence Delegate and Serializable combined.
- // ************************************************
-
- private static final long serialVersionUID = 1L;
-
- protected Object readResolve() throws ObjectStreamException
- {
- return LayoutUtil.getSerializedObject(this);
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException
- {
- if (getClass() == BoundSize.class)
- LayoutUtil.writeAsXML(out, this);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
- {
- LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
- }
-}
[04/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialog.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialog.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialog.java
deleted file mode 100644
index 542e4b9..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogException.java
deleted file mode 100644
index b6a2e91..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/TaskDialogs.java
deleted file mode 100644
index ee938f4..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButton.java
deleted file mode 100644
index 245c15f..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/CommandLinkButtonGroup.java
deleted file mode 100644
index 7bea6b6..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultCommandLinkPainter.java
deleted file mode 100644
index 5227328..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DefaultContentDesign.java
deleted file mode 100644
index 37e8e26..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/DetailsToggleButton.java
deleted file mode 100644
index 159b0db..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/LinuxContentDesign.java
deleted file mode 100644
index e2fe9bb..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsCommandLinkPainter.java
deleted file mode 100644
index 906620c..0000000
--- a/launchers/marmotta-splash/src/ext/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/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/dialog/task/design/MacOsContentDesign.java
deleted file mode 100644
index 3facbc9..0000000
--- a/launchers/marmotta-splash/src/ext/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;
- }
-
-
-}
[06/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutUtil.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutUtil.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutUtil.java
deleted file mode 100644
index 895a459..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LayoutUtil.java
+++ /dev/null
@@ -1,566 +0,0 @@
-package net.miginfocom.layout;
-
-import java.beans.*;
-import java.io.*;
-import java.util.IdentityHashMap;
-import java.util.TreeSet;
-import java.util.WeakHashMap;
-/*
- * 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
- */
-
-/** A utility class that has only static helper methods.
- */
-public final class LayoutUtil
-{
- /** A substitute value for aa really large value. Integer.MAX_VALUE is not used since that means a lot of defensive code
- * for potential overflow must exist in many places. This value is large enough for being unreasonable yet it is hard to
- * overflow.
- */
- public static final int INF = (Integer.MAX_VALUE >> 10) - 100; // To reduce likelihood of overflow errors when calculating.
-
- /** Tag int for a value that in considered "not set". Used as "null" element in int arrays.
- */
- static final int NOT_SET = Integer.MIN_VALUE + 12346; // Magic value...
-
- // Index for the different sizes
- public static final int MIN = 0;
- public static final int PREF = 1;
- public static final int MAX = 2;
-
- private static volatile WeakHashMap<Object, String> CR_MAP = null;
- private static volatile WeakHashMap<Object, Boolean> DT_MAP = null; // The Containers that have design time. Value not used.
- private static int eSz = 0;
- private static int globalDebugMillis = 0;
- public static final boolean HAS_BEANS = hasBeans();
-
- private static boolean hasBeans()
- {
- try {
- LayoutUtil.class.getClassLoader().loadClass("java.beans.Beans");
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
-
- private LayoutUtil()
- {
- }
-
- /** Returns the current version of MiG Layout.
- * @return The current version of MiG Layout. E.g. "3.6.3" or "4.0"
- */
- public static String getVersion()
- {
- return "4.0";
- }
-
- /** If global debug should be on or off. If > 0 then debug is turned on for all MigLayout
- * instances.
- * @return The current debug milliseconds.
- * @see LC#setDebugMillis(int)
- */
- public static int getGlobalDebugMillis()
- {
- return globalDebugMillis;
- }
-
- /** If global debug should be on or off. If > 0 then debug is turned on for all MigLayout
- * instances.
- * <p>
- * Note! This is a passive value and will be read by panels when the needed, which is normally
- * when they repaint/layout.
- * @param millis The new debug milliseconds. 0 turns of global debug and leaves debug up to every
- * individual panel.
- * @see LC#setDebugMillis(int)
- */
- public static void setGlobalDebugMillis(int millis)
- {
- globalDebugMillis = millis;
- }
-
- /** Sets if design time is turned on for a Container in {@link ContainerWrapper}.
- * @param cw The container to set design time for. <code>null</code> is legal and can be used as
- * a key to turn on/off design time "in general". Note though that design time "in general" is
- * always on as long as there is at least one ContainerWrapper with design time.
- * <p>
- * <strong>If this method has not ever been called it will default to what
- * <code>Beans.isDesignTime()</code> returns.</strong> This means that if you call
- * this method you indicate that you will take responsibility for the design time value.
- * @param b <code>true</code> means design time on.
- */
- public static void setDesignTime(ContainerWrapper cw, boolean b)
- {
- if (DT_MAP == null)
- DT_MAP = new WeakHashMap<Object, Boolean>();
-
- DT_MAP.put((cw != null ? cw.getComponent() : null), b);
- }
-
- /** Returns if design time is turned on for a Container in {@link ContainerWrapper}.
- * @param cw The container to set design time for. <code>null</code> is legal will return <code>true</code>
- * if there is at least one <code>ContainerWrapper</code> (or <code>null</code>) that have design time
- * turned on.
- * @return If design time is set for <code>cw</code>.
- */
- public static boolean isDesignTime(ContainerWrapper cw)
- {
- if (DT_MAP == null)
- return HAS_BEANS && Beans.isDesignTime();
-
- if (cw != null && DT_MAP.containsKey(cw.getComponent()) == false)
- cw = null;
-
- Boolean b = DT_MAP.get(cw != null ? cw.getComponent() : null);
- return b != null && b;
- }
-
- /** The size of an empty row or columns in a grid during design time.
- * @return The number of pixels. Default is 15.
- */
- public static int getDesignTimeEmptySize()
- {
- return eSz;
- }
-
- /** The size of an empty row or columns in a grid during design time.
- * @param pixels The number of pixels. Default is 0 (it was 15 prior to v3.7.2, but since that meant different behaviour
- * under design time by default it was changed to be 0, same as non-design time). IDE vendors can still set it to 15 to
- * get the old behaviour.
- */
- public static void setDesignTimeEmptySize(int pixels)
- {
- eSz = pixels;
- }
-
- /** Associates <code>con</code> with the creation string <code>s</code>. The <code>con</code> object should
- * probably have an equals method that compares identities or <code>con</code> objects that .equals() will only
- * be able to have <b>one</b> creation string.
- * <p>
- * If {@link LayoutUtil#isDesignTime(ContainerWrapper)} returns <code>false</code> the method does nothing.
- * @param con The object. if <code>null</code> the method does nothing.
- * @param s The creation string. if <code>null</code> the method does nothing.
- */
- static void putCCString(Object con, String s)
- {
- if (s != null && con != null && isDesignTime(null)) {
- if (CR_MAP == null)
- CR_MAP = new WeakHashMap<Object, String>(64);
-
- CR_MAP.put(con, s);
- }
- }
-
- /** Sets/add the persistence delegates to be used for a class.
- * @param c The class to set the registered deligate for.
- * @param del The new delegate or <code>null</code> to erase to old one.
- */
- static synchronized void setDelegate(Class c, PersistenceDelegate del)
- {
- try {
- Introspector.getBeanInfo(c, Introspector.IGNORE_ALL_BEANINFO).getBeanDescriptor().setValue("persistenceDelegate", del);
- } catch (Exception ignored) {
- }
- }
-
- /** Returns strings set with {@link #putCCString(Object, String)} or <code>null</code> if nothing is associated or
- * {@link LayoutUtil#isDesignTime(ContainerWrapper)} returns <code>false</code>.
- * @param con The constrain object.
- * @return The creation string or <code>null</code> if nothing is registered with the <code>con</code> object.
- */
- static String getCCString(Object con)
- {
- return CR_MAP != null ? CR_MAP.get(con) : null;
- }
-
- static void throwCC()
- {
- throw new IllegalStateException("setStoreConstraintData(true) must be set for strings to be saved.");
- }
-
- /** Takes a number on min/preferred/max sizes and resize constraints and returns the calculated sizes which sum should add up to <code>bounds</code>. Whether the sum
- * will actually equal <code>bounds</code> is dependent om the pref/max sizes and resize constraints.
- * @param sizes [ix],[MIN][PREF][MAX]. Grid.CompWrap.NOT_SET will be treated as N/A or 0. A "[MIN][PREF][MAX]" array with null elements will be interpreted as very flexible (no bounds)
- * but if the array itself is null it will not get any size.
- * @param resConstr Elements can be <code>null</code> and the whole array can be <code>null</code>. <code>null</code> means that the size will not be flexible at all.
- * Can have length less than <code>sizes</code> in which case the last element should be used for the elements missing.
- * @param defPushWeights If there is no grow weight for a resConstr the corresponding value of this array is used.
- * These forced resConstr will be grown last though and only if needed to fill to the bounds.
- * @param startSizeType The initial size to use. E.g. {@link net.miginfocom.layout.LayoutUtil#MIN}.
- * @param bounds To use for relative sizes.
- * @return The sizes. Array length will match <code>sizes</code>.
- */
- static int[] calculateSerial(int[][] sizes, ResizeConstraint[] resConstr, Float[] defPushWeights, int startSizeType, int bounds)
- {
- float[] lengths = new float[sizes.length]; // heights/widths that are set
- float usedLength = 0.0f;
-
- // Give all preferred size to start with
- for (int i = 0; i < sizes.length; i++) {
- if (sizes[i] != null) {
- float len = sizes[i][startSizeType] != NOT_SET ? sizes[i][startSizeType] : 0;
- int newSizeBounded = getBrokenBoundary(len, sizes[i][MIN], sizes[i][MAX]);
- if (newSizeBounded != NOT_SET)
- len = newSizeBounded;
-
- usedLength += len;
- lengths[i] = len;
- }
- }
-
- int useLengthI = Math.round(usedLength);
- if (useLengthI != bounds && resConstr != null) {
- boolean isGrow = useLengthI < bounds;
-
- // Create a Set with the available priorities
- TreeSet<Integer> prioList = new TreeSet<Integer>();
- for (int i = 0; i < sizes.length; i++) {
- ResizeConstraint resC = (ResizeConstraint) getIndexSafe(resConstr, i);
- if (resC != null)
- prioList.add(isGrow ? resC.growPrio : resC.shrinkPrio);
- }
- Integer[] prioIntegers = prioList.toArray(new Integer[prioList.size()]);
-
- for (int force = 0; force <= ((isGrow && defPushWeights != null) ? 1 : 0); force++) { // Run twice if defGrow and the need for growing.
- for (int pr = prioIntegers.length - 1; pr >= 0; pr--) {
- int curPrio = prioIntegers[pr];
-
- float totWeight = 0f;
- Float[] resizeWeight = new Float[sizes.length];
- for (int i = 0; i < sizes.length; i++) {
- if (sizes[i] == null) // if no min/pref/max size at all do not grow or shrink.
- continue;
-
- ResizeConstraint resC = (ResizeConstraint) getIndexSafe(resConstr, i);
- if (resC != null) {
- int prio = isGrow ? resC.growPrio : resC.shrinkPrio;
-
- if (curPrio == prio) {
- if (isGrow) {
- resizeWeight[i] = (force == 0 || resC.grow != null) ? resC.grow : (defPushWeights[i < defPushWeights.length ? i : defPushWeights.length - 1]);
- } else {
- resizeWeight[i] = resC.shrink;
- }
- if (resizeWeight[i] != null)
- totWeight += resizeWeight[i];
- }
- }
- }
-
- if (totWeight > 0f) {
- boolean hit;
- do {
- float toChange = bounds - usedLength;
- hit = false;
- float changedWeight = 0f;
- for (int i = 0; i < sizes.length && totWeight > 0.0001f; i++) {
-
- Float weight = resizeWeight[i];
- if (weight != null) {
- float sizeDelta = toChange * weight / totWeight;
- float newSize = lengths[i] + sizeDelta;
-
- if (sizes[i] != null) {
- int newSizeBounded = getBrokenBoundary(newSize, sizes[i][MIN], sizes[i][MAX]);
- if (newSizeBounded != NOT_SET) {
- resizeWeight[i] = null;
- hit = true;
- changedWeight += weight;
- newSize = newSizeBounded;
- sizeDelta = newSize - lengths[i];
- }
- }
-
- lengths[i] = newSize;
- usedLength += sizeDelta;
- }
- }
- totWeight -= changedWeight;
- } while (hit);
- }
- }
- }
- }
- return roundSizes(lengths);
- }
-
- static Object getIndexSafe(Object[] arr, int ix)
- {
- return arr != null ? arr[ix < arr.length ? ix : arr.length - 1] : null;
- }
-
- /** Returns the broken boundary if <code>sz</code> is outside the boundaries <code>lower</code> or <code>upper</code>. If both boundaries
- * are broken, the lower one is returned. If <code>sz</code> is < 0 then <code>new Float(0f)</code> is returned so that no sizes can be
- * negative.
- * @param sz The size to check
- * @param lower The lower boundary (or <code>null</code> fo no boundary).
- * @param upper The upper boundary (or <code>null</code> fo no boundary).
- * @return The broken boundary.
- */
- private static int getBrokenBoundary(float sz, int lower, int upper)
- {
- if (lower != NOT_SET) {
- if (sz < lower)
- return lower;
- } else if (sz < 0f) {
- return 0;
- }
-
- if (upper != NOT_SET && sz > upper)
- return upper;
-
- return NOT_SET;
- }
-
-
- static int sum(int[] terms, int start, int len)
- {
- int s = 0;
- for (int i = start, iSz = start + len; i < iSz; i++)
- s += terms[i];
- return s;
- }
-
- static int sum(int[] terms)
- {
- return sum(terms, 0, terms.length);
- }
-
- public static int getSizeSafe(int[] sizes, int sizeType)
- {
- if (sizes == null || sizes[sizeType] == NOT_SET)
- return sizeType == MAX ? LayoutUtil.INF : 0;
- return sizes[sizeType];
- }
-
- static BoundSize derive(BoundSize bs, UnitValue min, UnitValue pref, UnitValue max)
- {
- if (bs == null || bs.isUnset())
- return new BoundSize(min, pref, max, null);
-
- return new BoundSize(
- min != null ? min : bs.getMin(),
- pref != null ? pref : bs.getPreferred(),
- max != null ? max : bs.getMax(),
- bs.getGapPush(),
- null);
- }
-
- /** Returns if left-to-right orientation is used. If not set explicitly in the layout constraints the Locale
- * of the <code>parent</code> is used.
- * @param lc The constraint if there is one. Can be <code>null</code>.
- * @param container The parent that may be used to get the left-to-right if ffc does not specify this.
- * @return If left-to-right orientation is currently used.
- */
- public static boolean isLeftToRight(LC lc, ContainerWrapper container)
- {
- if (lc != null && lc.getLeftToRight() != null)
- return lc.getLeftToRight();
-
- return container == null || container.isLeftToRight();
- }
-
- /** Round a number of float sizes into int sizes so that the total length match up
- * @param sizes The sizes to round
- * @return An array of equal length as <code>sizes</code>.
- */
- static int[] roundSizes(float[] sizes)
- {
- int[] retInts = new int[sizes.length];
- float posD = 0;
-
- for (int i = 0; i < retInts.length; i++) {
- int posI = (int) (posD + 0.5f);
-
- posD += sizes[i];
-
- retInts[i] = (int) (posD + 0.5f) - posI;
- }
-
- return retInts;
- }
-
- /** Safe equals. null == null, but null never equals anything else.
- * @param o1 The first object. May be <code>null</code>.
- * @param o2 The second object. May be <code>null</code>.
- * @return Returns <code>true</code> if <code>o1</code> and <code>o2</code> are equal (using .equals()) or both are <code>null</code>.
- */
- static boolean equals(Object o1, Object o2)
- {
- return o1 == o2 || (o1 != null && o2 != null && o1.equals(o2));
- }
-
-// static int getBaselineCorrect(Component comp)
-// {
-// Dimension pSize = comp.getPreferredSize();
-// int baseline = comp.getBaseline(pSize.width, pSize.height);
-// int nextBaseline = comp.getBaseline(pSize.width, pSize.height + 1);
-//
-// // Amount to add to height when calculating where baseline
-// // lands for a particular height:
-// int padding = 0;
-//
-// // Where the baseline is relative to the mid point
-// int baselineOffset = baseline - pSize.height / 2;
-// if (pSize.height % 2 == 0 && baseline != nextBaseline) {
-// padding = 1;
-// } else if (pSize.height % 2 == 1 && baseline == nextBaseline) {
-// baselineOffset--;
-// padding = 1;
-// }
-//
-// // The following calculates where the baseline lands for
-// // the height z:
-// return (pSize.height + padding) / 2 + baselineOffset;
-// }
-
-
- /** Returns the inset for the side.
- * @param side top == 0, left == 1, bottom = 2, right = 3.
- * @param getDefault If <code>true</code> the default insets will get retrieved if <code>lc</code> has none set.
- * @return The inset for the side. Never <code>null</code>.
- */
- static UnitValue getInsets(LC lc, int side, boolean getDefault)
- {
- UnitValue[] i = lc.getInsets();
- return (i != null && i[side] != null) ? i[side] : (getDefault ? PlatformDefaults.getPanelInsets(side) : UnitValue.ZERO);
- }
-
- /** Writes the objet and CLOSES the stream. Uses the persistence delegate registered in this class.
- * @param os The stream to write to. Will be closed.
- * @param o The object to be serialized.
- * @param listener The listener to recieve the exeptions if there are any. If <code>null</code> not used.
- */
- static void writeXMLObject(OutputStream os, Object o, ExceptionListener listener)
- {
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(LayoutUtil.class.getClassLoader());
-
- XMLEncoder encoder = new XMLEncoder(os);
-
- if (listener != null)
- encoder.setExceptionListener(listener);
-
- encoder.writeObject(o);
- encoder.close(); // Must be closed to write.
-
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
-
- private static ByteArrayOutputStream writeOutputStream = null;
- /** Writes an object to XML.
- * @param out The boject out to write to. Will not be closed.
- * @param o The object to write.
- */
- public static synchronized void writeAsXML(ObjectOutput out, Object o) throws IOException
- {
- if (writeOutputStream == null)
- writeOutputStream = new ByteArrayOutputStream(16384);
-
- writeOutputStream.reset();
-
- writeXMLObject(writeOutputStream, o, new ExceptionListener() {
- public void exceptionThrown(Exception e) {
- e.printStackTrace();
- }});
-
- byte[] buf = writeOutputStream.toByteArray();
-
- out.writeInt(buf.length);
- out.write(buf);
- }
-
- private static byte[] readBuf = null;
- /** Reads an object from <code>in</code> using the
- * @param in The object input to read from.
- * @return The object. Never <code>null</code>.
- * @throws IOException If there was a problem saving as XML
- */
- public static synchronized Object readAsXML(ObjectInput in) throws IOException
- {
- if (readBuf == null)
- readBuf = new byte[16384];
-
- Thread cThread = Thread.currentThread();
- ClassLoader oldCL = null;
-
- try {
- oldCL = cThread.getContextClassLoader();
- cThread.setContextClassLoader(LayoutUtil.class.getClassLoader());
- } catch(SecurityException ignored) {
- }
-
- Object o = null;
- try {
- int length = in.readInt();
- if (length > readBuf.length)
- readBuf = new byte[length];
-
- in.readFully(readBuf, 0, length);
-
- o = new XMLDecoder(new ByteArrayInputStream(readBuf, 0, length)).readObject();
-
- } catch(EOFException ignored) {
- }
-
- if (oldCL != null)
- cThread.setContextClassLoader(oldCL);
-
- return o;
- }
-
- private static final IdentityHashMap<Object, Object> SER_MAP = new IdentityHashMap<Object, Object>(2);
-
- /** Sets the serialized object and associates it with <code>caller</code>.
- * @param caller The object created <code>o</code>
- * @param o The just serialized object.
- */
- public static void setSerializedObject(Object caller, Object o)
- {
- synchronized(SER_MAP) {
- SER_MAP.put(caller, o);
- }
- }
-
- /** Returns the serialized object that are associated with <code>caller</code>. It also removes it from the list.
- * @param caller The original creator of the object.
- * @return The object.
- */
- public static Object getSerializedObject(Object caller)
- {
- synchronized(SER_MAP) {
- return SER_MAP.remove(caller);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LinkHandler.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LinkHandler.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LinkHandler.java
deleted file mode 100644
index 5e748b8..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/LinkHandler.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package net.miginfocom.layout;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.HashMap;
-/*
- * 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
- */
-
-/**
- */
-public final class LinkHandler
-{
- public static final int X = 0;
- public static final int Y = 1;
- public static final int WIDTH = 2;
- public static final int HEIGHT = 3;
- public static final int X2 = 4;
- public static final int Y2 = 5;
-
- private static final ArrayList<WeakReference<Object>> LAYOUTS = new ArrayList<WeakReference<Object>>(4);
- private static final ArrayList<HashMap<String, int[]>> VALUES = new ArrayList<HashMap<String, int[]>>(4);
- private static final ArrayList<HashMap<String, int[]>> VALUES_TEMP = new ArrayList<HashMap<String, int[]>>(4);
-
- private LinkHandler()
- {
- }
-
- public synchronized static Integer getValue(Object layout, String key, int type)
- {
- Integer ret = null;
- boolean cont = true;
-
- for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
- Object l = LAYOUTS.get(i).get();
- if (ret == null && l == layout) {
- int[] rect = VALUES_TEMP.get(i).get(key);
- if (cont && rect != null && rect[type] != LayoutUtil.NOT_SET) {
- ret = rect[type];
- } else {
- rect = VALUES.get(i).get(key);
- ret = (rect != null && rect[type] != LayoutUtil.NOT_SET) ? rect[type] : null;
- }
- cont = false;
- }
-
- if (l == null) {
- LAYOUTS.remove(i);
- VALUES.remove(i);
- VALUES_TEMP.remove(i);
- }
- }
- return ret;
- }
-
- /** Sets a key that can be linked to from any component.
- * @param layout The MigLayout instance
- * @param key The key to link to. This is the same as the ID in a component constraint.
- * @param x x
- * @param y y
- * @param width Width
- * @param height Height
- * @return If the value was changed
- */
- public synchronized static boolean setBounds(Object layout, String key, int x, int y, int width, int height)
- {
- return setBounds(layout, key, x, y, width, height, false, false);
- }
-
- synchronized static boolean setBounds(Object layout, String key, int x, int y, int width, int height, boolean temporary, boolean incCur)
- {
- for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
- Object l = LAYOUTS.get(i).get();
- if (l == layout) {
- HashMap<String, int[]> map = (temporary ? VALUES_TEMP : VALUES).get(i);
- int[] old = map.get(key);
-
- if (old == null || old[X] != x || old[Y] != y || old[WIDTH] != width || old[HEIGHT] != height) {
- if (old == null || incCur == false) {
- map.put(key, new int[] {x, y, width, height, x + width, y + height});
- return true;
- } else {
- boolean changed = false;
-
- if (x != LayoutUtil.NOT_SET) {
- if (old[X] == LayoutUtil.NOT_SET || x < old[X]) {
- old[X] = x;
- old[WIDTH] = old[X2] - x;
- changed = true;
- }
-
- if (width != LayoutUtil.NOT_SET) {
- int x2 = x + width;
- if (old[X2] == LayoutUtil.NOT_SET || x2 > old[X2]) {
- old[X2] = x2;
- old[WIDTH] = x2 - old[X];
- changed = true;
- }
- }
- }
-
- if (y != LayoutUtil.NOT_SET) {
- if (old[Y] == LayoutUtil.NOT_SET || y < old[Y]) {
- old[Y] = y;
- old[HEIGHT] = old[Y2] - y;
- changed = true;
- }
-
- if (height != LayoutUtil.NOT_SET) {
- int y2 = y + height;
- if (old[Y2] == LayoutUtil.NOT_SET || y2 > old[Y2]) {
- old[Y2] = y2;
- old[HEIGHT] = y2 - old[Y];
- changed = true;
- }
- }
- }
- return changed;
- }
- }
- return false;
- }
- }
-
- LAYOUTS.add(new WeakReference<Object>(layout));
- int[] bounds = new int[] {x, y, width, height, x + width, y + height};
-
- HashMap<String, int[]> values = new HashMap<String, int[]>(4);
- if (temporary)
- values.put(key, bounds);
- VALUES_TEMP.add(values);
-
- values = new HashMap<String, int[]>(4);
- if (temporary == false)
- values.put(key, bounds);
- VALUES.add(values);
-
- return true;
- }
-
- /** This method clear any weak references right away instead of waiting for the GC. This might be advantageous
- * if lots of layout are created and disposed of quickly to keep memory consumption down.
- * @since 3.7.4
- */
- public synchronized static void clearWeakReferencesNow()
- {
- LAYOUTS.clear();
- }
-
- public synchronized static boolean clearBounds(Object layout, String key)
- {
- for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
- Object l = LAYOUTS.get(i).get();
- if (l == layout)
- return VALUES.get(i).remove(key) != null;
- }
- return false;
- }
-
- synchronized static void clearTemporaryBounds(Object layout)
- {
- for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
- Object l = LAYOUTS.get(i).get();
- if (l == layout) {
- VALUES_TEMP.get(i).clear();
- return;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/PlatformDefaults.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/PlatformDefaults.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/PlatformDefaults.java
deleted file mode 100644
index c0edfff..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/PlatformDefaults.java
+++ /dev/null
@@ -1,772 +0,0 @@
-package net.miginfocom.layout;
-
-import javax.swing.*;
-import java.util.HashMap;
-/*
- * 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
- * @author Xxxx Xxxx, Xxxx - Gnome support
- * Date: 2008-jan-16
- */
-
-/** Currently handles Windows, Mac OS X, and GNOME spacing.
- */
-public final class PlatformDefaults
-{
- private static int DEF_H_UNIT = UnitValue.LPX;
- private static int DEF_V_UNIT = UnitValue.LPY;
-
- private static InCellGapProvider GAP_PROVIDER = null;
-
- private static volatile int MOD_COUNT = 0;
-
- private static final UnitValue LPX4 = new UnitValue(4, UnitValue.LPX, null);
- private static final UnitValue LPX6 = new UnitValue(6, UnitValue.LPX, null);
- private static final UnitValue LPX7 = new UnitValue(7, UnitValue.LPX, null);
-// private static final UnitValue LPX8 = new UnitValue(8, UnitValue.LPX, null);
- private static final UnitValue LPX9 = new UnitValue(9, UnitValue.LPX, null);
- private static final UnitValue LPX10 = new UnitValue(10, UnitValue.LPX, null);
- private static final UnitValue LPX11 = new UnitValue(11, UnitValue.LPX, null);
- private static final UnitValue LPX12 = new UnitValue(12, UnitValue.LPX, null);
- private static final UnitValue LPX14 = new UnitValue(14, UnitValue.LPX, null);
- private static final UnitValue LPX16 = new UnitValue(16, UnitValue.LPX, null);
- private static final UnitValue LPX18 = new UnitValue(18, UnitValue.LPX, null);
- private static final UnitValue LPX20 = new UnitValue(20, UnitValue.LPX, null);
-
- private static final UnitValue LPY4 = new UnitValue(4, UnitValue.LPY, null);
- private static final UnitValue LPY6 = new UnitValue(6, UnitValue.LPY, null);
- private static final UnitValue LPY7 = new UnitValue(7, UnitValue.LPY, null);
-// private static final UnitValue LPY8 = new UnitValue(8, UnitValue.LPY, null);
- private static final UnitValue LPY9 = new UnitValue(9, UnitValue.LPY, null);
- private static final UnitValue LPY10 = new UnitValue(10, UnitValue.LPY, null);
- private static final UnitValue LPY11 = new UnitValue(11, UnitValue.LPY, null);
- private static final UnitValue LPY12 = new UnitValue(12, UnitValue.LPY, null);
- private static final UnitValue LPY14 = new UnitValue(14, UnitValue.LPY, null);
- private static final UnitValue LPY16 = new UnitValue(16, UnitValue.LPY, null);
- private static final UnitValue LPY18 = new UnitValue(18, UnitValue.LPY, null);
- private static final UnitValue LPY20 = new UnitValue(20, UnitValue.LPY, null);
-
- public static final int WINDOWS_XP = 0;
- public static final int MAC_OSX = 1;
- public static final int GNOME = 2;
-// private static final int KDE = 3;
-
- private static int CUR_PLAF = WINDOWS_XP;
-
- // Used for holding values.
- private final static UnitValue[] PANEL_INS = new UnitValue[4];
- private final static UnitValue[] DIALOG_INS = new UnitValue[4];
-
- private static String BUTTON_FORMAT = null;
-
- private static final HashMap<String, UnitValue> HOR_DEFS = new HashMap<String, UnitValue>(32);
- private static final HashMap<String, UnitValue> VER_DEFS = new HashMap<String, UnitValue>(32);
- private static BoundSize DEF_VGAP = null, DEF_HGAP = null;
- static BoundSize RELATED_X = null, RELATED_Y = null, UNRELATED_X = null, UNRELATED_Y = null;
- private static UnitValue BUTT_WIDTH = null;
-
- private static Float horScale = null, verScale = null;
-
- /** I value indicating that the size of the font for the container of the component
- * will be used as a base for calculating the logical pixel size. This is much as how
- * Windows calculated DLU (dialog units).
- * @see net.miginfocom.layout.UnitValue#LPX
- * @see net.miginfocom.layout.UnitValue#LPY
- * @see #setLogicalPixelBase(int)
- */
- public static final int BASE_FONT_SIZE = 100;
-
- /** I value indicating that the screen DPI will be used as a base for calculating the
- * logical pixel size.
- * <p>
- * This is the default value.
- * @see net.miginfocom.layout.UnitValue#LPX
- * @see net.miginfocom.layout.UnitValue#LPY
- * @see #setLogicalPixelBase(int)
- * @see #setVerticalScaleFactor(Float)
- * @see #setHorizontalScaleFactor(Float)
- */
- public static final int BASE_SCALE_FACTOR = 101;
-
- /** I value indicating that the size of a logical pixel should always be a real pixel
- * and thus no compensation will be made.
- * @see net.miginfocom.layout.UnitValue#LPX
- * @see net.miginfocom.layout.UnitValue#LPY
- * @see #setLogicalPixelBase(int)
- */
- public static final int BASE_REAL_PIXEL = 102;
-
- private static int LP_BASE = BASE_SCALE_FACTOR;
-
- private static Integer BASE_DPI_FORCED = null;
- private static int BASE_DPI = 96;
-
- private static boolean dra = true;
-
- static {
- setPlatform(getCurrentPlatform());
- MOD_COUNT = 0;
- }
-
- /** Returns the platform that the JRE is running on currently.
- * @return The platform that the JRE is running on currently. E.g. {@link #MAC_OSX}, {@link #WINDOWS_XP}, or {@link #GNOME}.
- */
- public static int getCurrentPlatform()
- {
- final String os = System.getProperty("os.name");
- if (os.startsWith("Mac OS")) {
- return MAC_OSX;
- } else if (os.startsWith("Linux")) {
- return GNOME;
- } else {
- return WINDOWS_XP;
- }
- }
-
- private PlatformDefaults()
- {
- }
-
- /** Set the defaults to the default for the platform
- * @param plaf The platform. <code>PlatformDefaults.WINDOWS_XP</code>,
- * <code>PlatformDefaults.MAC_OSX</code>, or
- * <code>PlatformDefaults.GNOME</code>.
- */
- public static void setPlatform(int plaf)
- {
- switch (plaf) {
- case WINDOWS_XP:
- setRelatedGap(LPX4, LPY4);
- setUnrelatedGap(LPX7, LPY9);
- setParagraphGap(LPX14, LPY14);
- setIndentGap(LPX9, LPY9);
- setGridCellGap(LPX4, LPY4);
-
- setMinimumButtonWidth(new UnitValue(75, UnitValue.LPX, null));
- setButtonOrder("L_E+U+YNBXOCAH_R");
- setDialogInsets(LPY11, LPX11, LPY11, LPX11);
- setPanelInsets(LPY7, LPX7, LPY7, LPX7);
- break;
- case MAC_OSX:
- setRelatedGap(LPX4, LPY4);
- setUnrelatedGap(LPX7, LPY9);
- setParagraphGap(LPX14, LPY14);
- setIndentGap(LPX10, LPY10);
- setGridCellGap(LPX4, LPY4);
-
- setMinimumButtonWidth(new UnitValue(68, UnitValue.LPX, null));
- setButtonOrder("L_HE+U+NYBXCOA_R");
- setDialogInsets(LPY14, LPX20, LPY20, LPX20);
- setPanelInsets(LPY16, LPX16, LPY16, LPX16);
-
-// setRelatedGap(LPX8, LPY8);
-// setUnrelatedGap(LPX12, LPY12);
-// setParagraphGap(LPX16, LPY16);
-// setIndentGap(LPX10, LPY10);
-// setGridCellGap(LPX8, LPY8);
-//
-// setMinimumButtonWidth(new UnitValue(68, UnitValue.LPX, null));
-// setButtonOrder("L_HE+U+NYBXCOA_R");
-// setDialogInsets(LPY14, LPX20, LPY20, LPX20);
-// setPanelInsets(LPY16, LPX16, LPY16, LPX16);
- break;
- case GNOME:
- setRelatedGap(LPX6, LPY6); // GNOME HIG 8.2.3
- setUnrelatedGap(LPX12, LPY12); // GNOME HIG 8.2.3
- setParagraphGap(LPX18, LPY18); // GNOME HIG 8.2.3
- setIndentGap(LPX12, LPY12); // GNOME HIG 8.2.3
- setGridCellGap(LPX6, LPY6); // GNOME HIG 8.2.3
-
- // GtkButtonBox, child-min-width property default value
- setMinimumButtonWidth(new UnitValue(85, UnitValue.LPX, null));
- setButtonOrder("L_HE+UNYACBXIO_R"); // GNOME HIG 3.4.2, 3.7.1
- setDialogInsets(LPY12, LPX12, LPY12, LPX12); // GNOME HIG 3.4.3
- setPanelInsets(LPY6, LPX6, LPY6, LPX6); // ???
- break;
- default:
- throw new IllegalArgumentException("Unknown platform: " + plaf);
- }
- CUR_PLAF = plaf;
- BASE_DPI = BASE_DPI_FORCED != null ? BASE_DPI_FORCED : getPlatformDPI(plaf);
- }
-
- private static int getPlatformDPI(int plaf)
- {
- switch (plaf) {
- case WINDOWS_XP:
- case GNOME:
- return 96;
- case MAC_OSX:
- try {
- return System.getProperty("java.version").compareTo("1.6") < 0 ? 72 : 96; // Default DPI was 72 prior to JSE 1.6
- } catch (Throwable t) {
- return 72;
- }
- default:
- throw new IllegalArgumentException("Unknown platform: " + plaf);
- }
- }
-
- /** Returns the current platform
- * @return <code>PlatformDefaults.WINDOWS</code> or <code>PlatformDefaults.MAC_OSX</code>
- */
- public static int getPlatform()
- {
- return CUR_PLAF;
- }
-
- public static int getDefaultDPI()
- {
- return BASE_DPI;
- }
-
- /** Sets the default platform DPI. Normally this is set in the {@link #setPlatform(int)} for the different platforms
- * but it can be tweaked here. For instance SWT on Mac does this.
- * <p>
- * Note that this is not the actual current DPI, but the base DPI for the toolkit.
- * @param dpi The base DPI. If null the default DPI is reset to the platform base DPI.
- */
- public static void setDefaultDPI(Integer dpi)
- {
- BASE_DPI = dpi != null ? dpi : getPlatformDPI(CUR_PLAF);
- BASE_DPI_FORCED = dpi;
- }
-
- /** The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
- * with. If <code>null</code> this will default to a scale that will scale the current screen to the default screen resolution
- * (72 DPI for Mac and 92 DPI for Windows).
- * @return The forced scale or <code>null</code> for default scaling.
- * @see #getHorizontalScaleFactor()
- * @see ComponentWrapper#getHorizontalScreenDPI()
- */
- public static Float getHorizontalScaleFactor()
- {
- return horScale;
- }
-
- /** The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
- * with. If <code>null</code> this will default to a scale that will scale the current screen to the default screen resolution
- * (72 DPI for Mac and 92 DPI for Windows).
- * @param f The forced scale or <code>null</code> for default scaling.
- * @see #getHorizontalScaleFactor()
- * @see ComponentWrapper#getHorizontalScreenDPI()
- */
- public static void setHorizontalScaleFactor(Float f)
- {
- if (LayoutUtil.equals(horScale, f) == false) {
- horScale = f;
- MOD_COUNT++;
- }
- }
-
- /** The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
- * with. If <code>null</code> this will default to a scale that will scale the current screen to the default screen resolution
- * (72 DPI for Mac and 92 DPI for Windows).
- * @return The forced scale or <code>null</code> for default scaling.
- * @see #getHorizontalScaleFactor()
- * @see ComponentWrapper#getVerticalScreenDPI()
- */
- public static Float getVerticalScaleFactor()
- {
- return verScale;
- }
-
- /** The forced scale factor that all screen relative units (e.g. millimeters, inches and logical pixels) will be multiplied
- * with. If <code>null</code> this will default to a scale that will scale the current screen to the default screen resolution
- * (72 DPI for Mac and 92 DPI for Windows).
- * @param f The forced scale or <code>null</code> for default scaling.
- * @see #getHorizontalScaleFactor()
- * @see ComponentWrapper#getVerticalScreenDPI()
- */
- public static void setVerticalScaleFactor(Float f)
- {
- if (LayoutUtil.equals(verScale, f) == false) {
- verScale = f;
- MOD_COUNT++;
- }
- }
-
- /** What base value should be used to calculate logical pixel sizes.
- * @return The current base. Default is {@link #BASE_SCALE_FACTOR}
- * @see #BASE_FONT_SIZE
- * @see #BASE_SCALE_FACTOR
- * @see #BASE_REAL_PIXEL
-*/
- public static int getLogicalPixelBase()
- {
- return LP_BASE;
- }
-
- /** What base value should be used to calculate logical pixel sizes.
- * @param base The new base. Default is {@link #BASE_SCALE_FACTOR}
- * @see #BASE_FONT_SIZE
- * @see #BASE_SCALE_FACTOR
- * @see #BASE_REAL_PIXEL
- */
- public static void setLogicalPixelBase(int base)
- {
- if (LP_BASE != base) {
- if (base < BASE_FONT_SIZE || base > BASE_SCALE_FACTOR)
- throw new IllegalArgumentException("Unrecognized base: " + base);
-
- LP_BASE = base;
- MOD_COUNT++;
- }
- }
-
- /** Sets gap value for components that are "related".
- * @param x The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- * @param y The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- */
- public static void setRelatedGap(UnitValue x, UnitValue y)
- {
- setUnitValue(new String[] {"r", "rel", "related"}, x, y);
-
- RELATED_X = new BoundSize(x, x, null, "rel:rel");
- RELATED_Y = new BoundSize(y, y, null, "rel:rel");
- }
-
- /** Sets gap value for components that are "unrelated".
- * @param x The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- * @param y The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- */
- public static void setUnrelatedGap(UnitValue x, UnitValue y)
- {
- setUnitValue(new String[] {"u", "unrel", "unrelated"}, x, y);
-
- UNRELATED_X = new BoundSize(x, x, null, "unrel:unrel");
- UNRELATED_Y = new BoundSize(y, y, null, "unrel:unrel");
- }
-
- /** Sets paragraph gap value for components.
- * @param x The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- * @param y The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- */
- public static void setParagraphGap(UnitValue x, UnitValue y)
- {
- setUnitValue(new String[] {"p", "para", "paragraph"}, x, y);
- }
-
- /** Sets gap value for components that are "intended".
- * @param x The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- * @param y The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- */
- public static void setIndentGap(UnitValue x, UnitValue y)
- {
- setUnitValue(new String[] {"i", "ind", "indent"}, x, y);
- }
-
- /** Sets gap between two cells in the grid. Note that this is not a gap between component IN a cell, that has to be set
- * on the component constraints. The value will be the min and preferred size of the gap.
- * @param x The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- * @param y The value that will be transformed to pixels. If <code>null</code> the current value will not change.
- */
- public static void setGridCellGap(UnitValue x, UnitValue y)
- {
- if (x != null)
- DEF_HGAP = new BoundSize(x, x, null, null);
-
- if (y != null)
- DEF_VGAP = new BoundSize(y, y, null, null);
-
- MOD_COUNT++;
- }
-
- /** Sets the recommended minimum button width.
- * @param width The recommended minimum button width.
- */
- public static void setMinimumButtonWidth(UnitValue width)
- {
- BUTT_WIDTH = width;
- MOD_COUNT++;
- }
-
- /** Returns the recommended minimum button width depending on the current set platform.
- * @return The recommended minimum button width depending on the current set platform.
- */
- public static UnitValue getMinimumButtonWidth()
- {
- return BUTT_WIDTH;
- }
-
- /** Returns the unit value associated with the unit. (E.i. "related" or "indent"). Must be lower case.
- * @param unit The unit string.
- * @return The unit value associated with the unit. <code>null</code> for unrecognized units.
- */
- public static UnitValue getUnitValueX(String unit)
- {
- return HOR_DEFS.get(unit);
- }
-
- /** Returns the unit value associated with the unit. (E.i. "related" or "indent"). Must be lower case.
- * @param unit The unit string.
- * @return The unit value associated with the unit. <code>null</code> for unrecognized units.
- */
- public static UnitValue getUnitValueY(String unit)
- {
- return VER_DEFS.get(unit);
- }
-
- /** Sets the unit value associated with a unit string. This may be used to store values for new unit strings
- * or modify old. Note that if a built in unit (such as "related") is modified all versions of it must be
- * set (I.e. "r", "rel" and "related"). The build in values will be reset to the default ones if the platform
- * is re-set.
- * @param unitStrings The unit strings. E.g. "mu", "myunit". Will be converted to lower case and trimmed. Not <code>null</code>.
- * @param x The value for the horizontal dimension. If <code>null</code> the value is not changed.
- * @param y The value for the vertical dimension. Might be same object as for <code>x</code>. If <code>null</code> the value is not changed.
- */
- public static final void setUnitValue(String[] unitStrings, UnitValue x, UnitValue y)
- {
- for (String unitString : unitStrings) {
- String s = unitString.toLowerCase().trim();
- if (x != null)
- HOR_DEFS.put(s, x);
- if (y != null)
- VER_DEFS.put(s, y);
- }
- MOD_COUNT++;
- }
-
- /** Understands ("r", "rel", "related") OR ("u", "unrel", "unrelated") OR ("i", "ind", "indent") OR ("p", "para", "paragraph").
- */
- static int convertToPixels(float value, String unit, boolean isHor, float ref, ContainerWrapper parent, ComponentWrapper comp)
- {
- UnitValue uv = (isHor ? HOR_DEFS : VER_DEFS).get(unit);
- return uv != null ? Math.round(value * uv.getPixels(ref, parent, comp)) : UnitConverter.UNABLE;
- }
-
- /** Returns the order for the typical buttons in a standard button bar. It is one letter per button type.
- * @return The button order.
- * @see #setButtonOrder(String)
- */
- public static String getButtonOrder()
- {
- return BUTTON_FORMAT;
- }
-
- /** Sets the order for the typical buttons in a standard button bar. It is one letter per button type.
- * <p>
- * Letter in upper case will get the minimum button width that the {@link #getMinimumButtonWidth()} specifies
- * and letters in lower case will get the width the current look&feel specifies.
- * <p>
- * Gaps will never be added to before the first component or after the last component. However, '+' (push) will be
- * applied before and after as well, but with a minimum size of 0 if first/last so there will not be a gap
- * before or after.
- * <p>
- * If gaps are explicitly set on buttons they will never be reduced, but they may be increased.
- * <p>
- * These are the characters that can be used:
- * <ul>
- * <li><code>'L'</code> - Buttons with this style tag will staticall end up on the left end of the bar.
- * <li><code>'R'</code> - Buttons with this style tag will staticall end up on the right end of the bar.
- * <li><code>'H'</code> - A tag for the "help" button that normally is supposed to be on the right.
- * <li><code>'E'</code> - A tag for the "help2" button that normally is supposed to be on the left.
- * <li><code>'Y'</code> - A tag for the "yes" button.
- * <li><code>'N'</code> - A tag for the "no" button.
- * <li><code>'X'</code> - A tag for the "next >" or "forward >" button.
- * <li><code>'B'</code> - A tag for the "< back>" or "< previous" button.
- * <li><code>'I'</code> - A tag for the "finish".
- * <li><code>'A'</code> - A tag for the "apply" button.
- * <li><code>'C'</code> - A tag for the "cancel" or "close" button.
- * <li><code>'O'</code> - A tag for the "ok" or "done" button.
- * <li><code>'U'</code> - All Uncategorized, Other, or "Unknown" buttons. Tag will be "other".
- * <li><code>'+'</code> - A glue push gap that will take as much space as it can and at least an "unrelated" gap. (Platform dependant)
- * <li><code>'_'</code> - (underscore) An "unrelated" gap. (Platform dependant)
- * </ul>
- * <p>
- * Even though the style tags are normally applied to buttons this works with all components.
- * <p>
- * The normal style for MAC OS X is <code>"L_HE+U+FBI_NYCOA_R"</code>,
- * for Windows is <code>"L_E+U+FBI_YNOCAH_R"</code>, and for GNOME is
- * <code>"L_HE+UNYACBXIO_R"</code>.
- *
- * @param order The new button order for the current platform.
- */
- public static void setButtonOrder(String order)
- {
- BUTTON_FORMAT = order;
- MOD_COUNT++;
- }
-
- /** Returns the tag (used in the {@link CC}) for a char. The char is same as used in {@link #getButtonOrder()}.
- * @param c The char. Must be lower case!
- * @return The tag that corresponds to the char or <code>null</code> if the char is unrecognized.
- */
- static String getTagForChar(char c)
- {
- switch (c) {
- case 'o':
- return "ok";
- case 'c':
- return "cancel";
- case 'h':
- return "help";
- case 'e':
- return "help2";
- case 'y':
- return "yes";
- case 'n':
- return "no";
- case 'a':
- return "apply";
- case 'x':
- return "next"; // a.k.a forward
- case 'b':
- return "back"; // a.k.a. previous
- case 'i':
- return "finish";
- case 'l':
- return "left";
- case 'r':
- return "right";
- case 'u':
- return "other";
- default:
- return null;
- }
- }
-
- /** Returns the platform recommended inter-cell gap in the horizontal (x) dimension..
- * @return The platform recommended inter-cell gap in the horizontal (x) dimension..
- */
- public static BoundSize getGridGapX()
- {
- return DEF_HGAP;
- }
-
- /** Returns the platform recommended inter-cell gap in the vertical (x) dimension..
- * @return The platform recommended inter-cell gap in the vertical (x) dimension..
- */
- public static BoundSize getGridGapY()
- {
- return DEF_VGAP;
- }
-
- /** Returns the default dialog inset depending of the current platform.
- * @param side top == 0, left == 1, bottom = 2, right = 3.
- * @return The inset. Never <code>null</code>.
- */
- public static UnitValue getDialogInsets(int side)
- {
- return DIALOG_INS[side];
- }
-
- /** Sets the default insets for a dialog. Values that are null will not be changed.
- * @param top The top inset. May be <code>null</code>.
- * @param left The left inset. May be <code>null</code>.
- * @param bottom The bottom inset. May be <code>null</code>.
- * @param right The right inset. May be <code>null</code>.
- */
- public static void setDialogInsets(UnitValue top, UnitValue left, UnitValue bottom, UnitValue right)
- {
- if (top != null)
- DIALOG_INS[0] = top;
-
- if (left != null)
- DIALOG_INS[1] = left;
-
- if (bottom != null)
- DIALOG_INS[2] = bottom;
-
- if (right != null)
- DIALOG_INS[3] = right;
-
- MOD_COUNT++;
- }
-
- /** Returns the default panel inset depending of the current platform.
- * @param side top == 0, left == 1, bottom = 2, right = 3.
- * @return The inset. Never <code>null</code>.
- */
- public static UnitValue getPanelInsets(int side)
- {
- return PANEL_INS[side];
- }
-
- /** Sets the default insets for a dialog. Values that are null will not be changed.
- * @param top The top inset. May be <code>null</code>.
- * @param left The left inset. May be <code>null</code>.
- * @param bottom The bottom inset. May be <code>null</code>.
- * @param right The right inset. May be <code>null</code>.
- */
- public static void setPanelInsets(UnitValue top, UnitValue left, UnitValue bottom, UnitValue right)
- {
- if (top != null)
- PANEL_INS[0] = top;
-
- if (left != null)
- PANEL_INS[1] = left;
-
- if (bottom != null)
- PANEL_INS[2] = bottom;
-
- if (right != null)
- PANEL_INS[3] = right;
-
- MOD_COUNT++;
- }
-
- /** Returns the percentage used for alignment for labels (0 is left, 50 is center and 100 is right).
- * @return The percentage used for alignment for labels
- */
- public static float getLabelAlignPercentage()
- {
- return CUR_PLAF == MAC_OSX ? 1f : 0f;
- }
-
- /** Returns the default gap between two components that <b>are in the same cell</b>.
- * @param comp The component that the gap is for. Never <code>null</code>.
- * @param adjacentComp The adjacent component if any. May be <code>null</code>.
- * @param adjacentSide What side the <code>adjacentComp</code> is on. {@link javax.swing.SwingUtilities#TOP} or
- * {@link javax.swing.SwingUtilities#LEFT} or {@link javax.swing.SwingUtilities#BOTTOM} or {@link javax.swing.SwingUtilities#RIGHT}.
- * @param tag The tag string that the component might be tagged with in the component constraints. May be <code>null</code>.
- * @param isLTR If it is left-to-right.
- * @return The default gap between two components or <code>null</code> if there should be no gap.
- */
- static BoundSize getDefaultComponentGap(ComponentWrapper comp, ComponentWrapper adjacentComp, int adjacentSide, String tag, boolean isLTR)
- {
- if (GAP_PROVIDER != null)
- return GAP_PROVIDER.getDefaultGap(comp, adjacentComp, adjacentSide, tag, isLTR);
-
- if (adjacentComp == null)
- return null;
-
-// if (adjacentComp == null || adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.TOP)
-// return null;
-
- return (adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.RIGHT) ? RELATED_X : RELATED_Y;
- }
-
- /** Returns the current gap provider or <code>null</code> if none is set and "related" should always be used.
- * @return The current gap provider or <code>null</code> if none is set and "related" should always be used.
- */
- public static InCellGapProvider getGapProvider()
- {
- return GAP_PROVIDER;
- }
-
- /** Sets the current gap provider or <code>null</code> if none is set and "related" should always be used.
- * @param provider The current gap provider or <code>null</code> if none is set and "related" should always be used.
- */
- public static void setGapProvider(InCellGapProvider provider)
- {
- GAP_PROVIDER = provider;
- }
-
- /** Returns how many times the defaults has been changed. This can be used as a light weight check to
- * see if layout caches needs to be refreshed.
- * @return How many times the defaults has been changed.
- */
- public static int getModCount()
- {
- return MOD_COUNT;
- }
-
- /** Tells all layout manager instances to revalidate and recalculated everything.
- */
- public void invalidate()
- {
- MOD_COUNT++;
- }
-
- /** Returns the current default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @return The current default unit.
- * @see UnitValue#PIXEL
- * @see UnitValue#LPX
- */
- public static int getDefaultHorizontalUnit()
- {
- return DEF_H_UNIT;
- }
-
- /** Sets the default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @param unit The new default unit.
- * @see UnitValue#PIXEL
- * @see UnitValue#LPX
- */
- public static void setDefaultHorizontalUnit(int unit)
- {
- if (unit < UnitValue.PIXEL || unit > UnitValue.LABEL_ALIGN)
- throw new IllegalArgumentException("Illegal Unit: " + unit);
-
- if (DEF_H_UNIT != unit) {
- DEF_H_UNIT = unit;
- MOD_COUNT++;
- }
- }
-
- /** Returns the current default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @return The current default unit.
- * @see UnitValue#PIXEL
- * @see UnitValue#LPY
- */
- public static int getDefaultVerticalUnit()
- {
- return DEF_V_UNIT;
- }
-
- /** Sets the default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @param unit The new default unit.
- * @see UnitValue#PIXEL
- * @see UnitValue#LPY
- */
- public static void setDefaultVerticalUnit(int unit)
- {
- if (unit < UnitValue.PIXEL || unit > UnitValue.LABEL_ALIGN)
- throw new IllegalArgumentException("Illegal Unit: " + unit);
-
- if (DEF_V_UNIT != unit) {
- DEF_V_UNIT = unit;
- MOD_COUNT++;
- }
- }
-
- /** The default alignment for rows. Pre v3.5 this was <code>false</code> but now it is
- * <code>true</code>.
- * @return The current value. Default is <code>true</code>.
- * @since 3.5
- */
- public static boolean getDefaultRowAlignmentBaseline()
- {
- return dra;
- }
-
- /** The default alignment for rows. Pre v3.5 this was <code>false</code> but now it is
- * <code>true</code>.
- * @param b The new value. Default is <code>true</code> from v3.5.
- * @since 3.5
- */
- public static void setDefaultRowAlignmentBaseline(boolean b)
- {
- dra = b;
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ResizeConstraint.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ResizeConstraint.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ResizeConstraint.java
deleted file mode 100644
index c02ad0f..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/ResizeConstraint.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package net.miginfocom.layout;
-
-import java.io.*;
-/*
- * 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
- */
-
-/** A parsed constraint that specifies how an entity (normally column/row or component) can shrink or
- * grow compared to other entities.
- */
-final class ResizeConstraint implements Externalizable
-{
- static final Float WEIGHT_100 = new Float(100);
-
- /** How flexilble the entity should be, relative to other entities, when it comes to growing. <code>null</code> or
- * zero mean it will never grow. An entity that has twise the growWeight compared to another entity will get twice
- * as much of available space.
- * <p>
- * "grow" are only compared within the same "growPrio".
- */
- Float grow = null;
-
- /** The relative priority used for determining which entities gets the extra space first.
- */
- int growPrio = 100;
-
- Float shrink = WEIGHT_100;
-
- int shrinkPrio = 100;
-
- public ResizeConstraint() // For Externalizable
- {
- }
-
- ResizeConstraint(int shrinkPrio, Float shrinkWeight, int growPrio, Float growWeight)
- {
- this.shrinkPrio = shrinkPrio;
- this.shrink = shrinkWeight;
- this.growPrio = growPrio;
- this.grow = growWeight;
- }
-
- // ************************************************
- // 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() == ResizeConstraint.class)
- LayoutUtil.writeAsXML(out, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitConverter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitConverter.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitConverter.java
deleted file mode 100644
index 3a03ea2..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitConverter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package net.miginfocom.layout;
-/*
- * 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
- */
-
-/**
- */
-public abstract class UnitConverter
-{
- /** Value to return if this converter can not handle the <code>unit</code> sent in as an argument
- * to the convert method.
- */
- public static final int UNABLE = -87654312;
-
- /** Converts <code>value</code> to pixels.
- * @param value The value to be converted.
- * @param unit The unit of <code>value</code>. Never <code>null</code> and at least one character.
- * @param refValue Some reference value that may of may not be used. If the unit is percent for instance this value
- * is the value to take the percent from. Usually the size of the parent component in the appropriate dimension.
- * @param isHor If the value is horizontal (<code>true</code>) or vertical (<code>false</code>).
- * @param parent The parent of the target component that <code>value</code> is to be applied to.
- * Might for instance be needed to get the screen that the component is on in a multi screen environment.
- * <p>
- * May be <code>null</code> in which case a "best guess" value should be returned.
- * @param comp The component, if applicable, or <code>null</code> if none.
- * @return The number of pixels if <code>unit</code> is handled by this converter, <code>UnitConverter.UNABLE</code> if not.
- */
- public abstract int convertToPixels(float value, String unit, boolean isHor, float refValue, ContainerWrapper parent, ComponentWrapper comp);
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitValue.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitValue.java b/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitValue.java
deleted file mode 100644
index 738900c..0000000
--- a/launchers/marmotta-splash/src/ext/java/net/miginfocom/layout/UnitValue.java
+++ /dev/null
@@ -1,637 +0,0 @@
-package net.miginfocom.layout;
-/*
- * 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 java.beans.Encoder;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public final class UnitValue implements Serializable
-{
- private static final HashMap<String, Integer> UNIT_MAP = new HashMap<String, Integer>(32);
-
- private static final ArrayList<UnitConverter> CONVERTERS = new ArrayList<UnitConverter>();
-
- /** An operation indicating a static value.
- */
- public static final int STATIC = 100;
-
- /** An operation indicating a addition of two sub units.
- */
- public static final int ADD = 101; // Must have "sub-unit values"
-
- /** An operation indicating a subtraction of two sub units
- */
- public static final int SUB = 102; // Must have "sub-unit values"
-
- /** An operation indicating a multiplication of two sub units.
- */
- public static final int MUL = 103; // Must have "sub-unit values"
-
- /** An operation indicating a division of two sub units.
- */
- public static final int DIV = 104; // Must have "sub-unit values"
-
- /** An operation indicating the minimum of two sub units
- */
- public static final int MIN = 105; // Must have "sub-unit values"
-
- /** An operation indicating the maximum of two sub units
- */
- public static final int MAX = 106; // Must have "sub-unit values"
-
- /** An operation indicating the middle value of two sub units
- */
- public static final int MID = 107; // Must have "sub-unit values"
-
-
-
-
- /** A unit indicating pixels.
- */
- public static final int PIXEL = 0;
-
- /** A unit indicating logical horizontal pixels.
- */
- public static final int LPX = 1;
-
- /** A unit indicating logical vertical pixels.
- */
- public static final int LPY = 2;
-
- /** A unit indicating millimeters.
- */
- public static final int MM = 3;
-
- /** A unit indicating centimeters.
- */
- public static final int CM = 4;
-
- /** A unit indicating inches.
- */
- public static final int INCH = 5;
-
- /** A unit indicating percent.
- */
- public static final int PERCENT = 6;
-
- /** A unit indicating points.
- */
- public static final int PT = 7;
-
- /** A unit indicating screen percentage width.
- */
- public static final int SPX = 8;
-
- /** A unit indicating screen percentage height.
- */
- public static final int SPY = 9;
-
- /** A unit indicating alignment.
- */
- public static final int ALIGN = 12;
-
- /** A unit indicating minimum size.
- */
- public static final int MIN_SIZE = 13;
-
- /** A unit indicating preferred size.
- */
- public static final int PREF_SIZE = 14;
-
- /** A unit indicating maximum size.
- */
- public static final int MAX_SIZE = 15;
-
- /** A unit indicating botton size.
- */
- public static final int BUTTON = 16;
-
- /** A unit indicating linking to x.
- */
- public static final int LINK_X = 18; // First link
-
- /** A unit indicating linking to y.
- */
- public static final int LINK_Y = 19;
-
- /** A unit indicating linking to width.
- */
- public static final int LINK_W = 20;
-
- /** A unit indicating linking to height.
- */
- public static final int LINK_H = 21;
-
- /** A unit indicating linking to x2.
- */
- public static final int LINK_X2 = 22;
-
- /** A unit indicating linking to y2.
- */
- public static final int LINK_Y2 = 23;
-
- /** A unit indicating linking to x position on screen.
- */
- public static final int LINK_XPOS = 24;
-
- /** A unit indicating linking to y position on screen.
- */
- public static final int LINK_YPOS = 25; // Last link
-
- /** A unit indicating a lookup.
- */
- public static final int LOOKUP = 26;
-
- /** A unit indicating label alignment.
- */
- public static final int LABEL_ALIGN = 27;
-
- private static final int IDENTITY = -1;
-
- static {
- UNIT_MAP.put("px", PIXEL);
- UNIT_MAP.put("lpx", LPX);
- UNIT_MAP.put("lpy", LPY);
- UNIT_MAP.put("%", PERCENT);
- UNIT_MAP.put("cm", CM);
- UNIT_MAP.put("in", INCH);
- UNIT_MAP.put("spx", SPX);
- UNIT_MAP.put("spy", SPY);
- UNIT_MAP.put("al", ALIGN);
- UNIT_MAP.put("mm", MM);
- UNIT_MAP.put("pt", PT);
- UNIT_MAP.put("min", MIN_SIZE);
- UNIT_MAP.put("minimum", MIN_SIZE);
- UNIT_MAP.put("p", PREF_SIZE);
- UNIT_MAP.put("pref", PREF_SIZE);
- UNIT_MAP.put("max", MAX_SIZE);
- UNIT_MAP.put("maximum", MAX_SIZE);
- UNIT_MAP.put("button", BUTTON);
- UNIT_MAP.put("label", LABEL_ALIGN);
- }
-
- static final UnitValue ZERO = new UnitValue(0, null, PIXEL, true, STATIC, null, null, "0px");
- static final UnitValue TOP = new UnitValue(0, null, PERCENT, false, STATIC, null, null, "top");
- static final UnitValue LEADING = new UnitValue(0, null, PERCENT, true, STATIC, null, null, "leading");
- static final UnitValue LEFT = new UnitValue(0, null, PERCENT, true, STATIC, null, null, "left");
- static final UnitValue CENTER = new UnitValue(50, null, PERCENT, true, STATIC, null, null, "center");
- static final UnitValue TRAILING = new UnitValue(100, null, PERCENT, true, STATIC, null, null, "trailing");
- static final UnitValue RIGHT = new UnitValue(100, null, PERCENT, true, STATIC, null, null, "right");
- static final UnitValue BOTTOM = new UnitValue(100, null, PERCENT, false, STATIC, null, null, "bottom");
- static final UnitValue LABEL = new UnitValue(0, null, LABEL_ALIGN, false, STATIC, null, null, "label");
-
- static final UnitValue INF = new UnitValue(LayoutUtil.INF, null, PIXEL, true, STATIC, null, null, "inf");
-
- static final UnitValue BASELINE_IDENTITY = new UnitValue(0, null, IDENTITY, false, STATIC, null, null, "baseline");
-
- private final transient float value;
- private final transient int unit;
- private final transient int oper;
- private final transient String unitStr;
- private transient String linkId = null; // Should be final, but initializes in a sub method.
- private final transient boolean isHor;
- private final transient UnitValue[] subUnits;
-
- // Pixel
- public UnitValue(float value) // If hor/ver does not matter.
- {
- this(value, null, PIXEL, true, STATIC, null, null, value + "px");
- }
-
- public UnitValue(float value, int unit, String createString) // If hor/ver does not matter.
- {
- this(value, null, unit, true, STATIC, null, null, createString);
- }
-
- UnitValue(float value, String unitStr, boolean isHor, int oper, String createString)
- {
- this(value, unitStr, -1, isHor, oper, null, null, createString);
- }
-
- UnitValue(boolean isHor, int oper, UnitValue sub1, UnitValue sub2, String createString)
- {
- this(0, "", -1, isHor, oper, sub1, sub2, createString);
- if (sub1 == null || sub2 == null)
- throw new IllegalArgumentException("Sub units is null!");
- }
-
- private UnitValue(float value, String unitStr, int unit, boolean isHor, int oper, UnitValue sub1, UnitValue sub2, String createString)
- {
- if (oper < STATIC || oper > MID)
- throw new IllegalArgumentException("Unknown Operation: " + oper);
-
- if (oper >= ADD && oper <= MID && (sub1 == null || sub2 == null))
- throw new IllegalArgumentException(oper + " Operation may not have null sub-UnitValues.");
-
- this.value = value;
- this.oper = oper;
- this.isHor = isHor;
- this.unitStr = unitStr;
- this.unit = unitStr != null ? parseUnitString() : unit;
- this.subUnits = sub1 != null && sub2 != null ? new UnitValue[] {sub1, sub2} : null;
-
- LayoutUtil.putCCString(this, createString); // "this" escapes!! Safe though.
- }
-
- /** Returns the size in pixels rounded.
- * @param refValue The reference value. Normally the size of the parent. For unit {@link #ALIGN} the current size of the component should be sent in.
- * @param parent The parent. May be <code>null</code> for testing the validity of the value, but should normally not and are not
- * required to return any usable value if <code>null</code>.
- * @param comp The component, if any, that the value is for. Might be <code>null</code> if the value is not
- * connected to any component.
- * @return The size in pixels.
- */
- public final int getPixels(float refValue, ContainerWrapper parent, ComponentWrapper comp)
- {
- return Math.round(getPixelsExact(refValue, parent, comp));
- }
-
- private static final float[] SCALE = new float[] {25.4f, 2.54f, 1f, 0f, 72f};
- /** Returns the size in pixels.
- * @param refValue The reference value. Normally the size of the parent. For unit {@link #ALIGN} the current size of the component should be sent in.
- * @param parent The parent. May be <code>null</code> for testing the validity of the value, but should normally not and are not
- * required to return any usable value if <code>null</code>.
- * @param comp The component, if any, that the value is for. Might be <code>null</code> if the value is not
- * connected to any component.
- * @return The size in pixels.
- */
- public final float getPixelsExact(float refValue, ContainerWrapper parent, ComponentWrapper comp)
- {
- if (parent == null)
- return 1;
-
- if (oper == STATIC) {
- switch (unit) {
- case PIXEL:
- return value;
-
- case LPX:
- case LPY:
- return parent.getPixelUnitFactor(unit == LPX) * value;
-
- case MM:
- case CM:
- case INCH:
- case PT:
- float f = SCALE[unit - MM];
- Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
- if (s != null)
- f *= s;
- return (isHor ? parent.getHorizontalScreenDPI() : parent.getVerticalScreenDPI()) * value / f;
-
- case PERCENT:
- return value * refValue * 0.01f;
-
- case SPX:
- case SPY:
- return (unit == SPX ? parent.getScreenWidth() : parent.getScreenHeight()) * value * 0.01f;
-
- case ALIGN:
- Integer st = LinkHandler.getValue(parent.getLayout(), "visual", isHor ? LinkHandler.X : LinkHandler.Y);
- Integer sz = LinkHandler.getValue(parent.getLayout(), "visual", isHor ? LinkHandler.WIDTH : LinkHandler.HEIGHT);
- if (st == null || sz == null)
- return 0;
- return value * (Math.max(0, sz.intValue()) - refValue) + st;
-
- case MIN_SIZE:
- if (comp == null)
- return 0;
- return isHor ? comp.getMinimumWidth(comp.getHeight()) : comp.getMinimumHeight(comp.getWidth());
-
- case PREF_SIZE:
- if (comp == null)
- return 0;
- return isHor ? comp.getPreferredWidth(comp.getHeight()) : comp.getPreferredHeight(comp.getWidth());
-
- case MAX_SIZE:
- if (comp == null)
- return 0;
- return isHor ? comp.getMaximumWidth(comp.getHeight()) : comp.getMaximumHeight(comp.getWidth());
-
- case BUTTON:
- return PlatformDefaults.getMinimumButtonWidth().getPixels(refValue, parent, comp);
-
- case LINK_X:
- case LINK_Y:
- case LINK_W:
- case LINK_H:
- case LINK_X2:
- case LINK_Y2:
- case LINK_XPOS:
- case LINK_YPOS:
- Integer v = LinkHandler.getValue(parent.getLayout(), getLinkTargetId(), unit - (unit >= LINK_XPOS ? LINK_XPOS : LINK_X));
- if (v == null)
- return 0;
-
- if (unit == LINK_XPOS)
- return parent.getScreenLocationX() + v;
- if (unit == LINK_YPOS)
- return parent.getScreenLocationY() + v;
-
- return v;
-
- case LOOKUP:
- float res = lookup(refValue, parent, comp);
- if (res != UnitConverter.UNABLE)
- return res;
-
- case LABEL_ALIGN:
- return PlatformDefaults.getLabelAlignPercentage() * refValue;
-
- case IDENTITY:
- }
- throw new IllegalArgumentException("Unknown/illegal unit: " + unit + ", unitStr: " + unitStr);
- }
-
- if (subUnits != null && subUnits.length == 2) {
- float r1 = subUnits[0].getPixelsExact(refValue, parent, comp);
- float r2 = subUnits[1].getPixelsExact(refValue, parent, comp);
- switch (oper) {
- case ADD:
- return r1 + r2;
- case SUB:
- return r1 - r2;
- case MUL:
- return r1 * r2;
- case DIV:
- return r1 / r2;
- case MIN:
- return r1 < r2 ? r1 : r2;
- case MAX:
- return r1 > r2 ? r1 : r2;
- case MID:
- return (r1 + r2) * 0.5f;
- }
- }
-
- throw new IllegalArgumentException("Internal: Unknown Oper: " + oper);
- }
-
- private float lookup(float refValue, ContainerWrapper parent, ComponentWrapper comp)
- {
- float res = UnitConverter.UNABLE;
- for (int i = CONVERTERS.size() - 1; i >= 0; i--) {
- res = CONVERTERS.get(i).convertToPixels(value, unitStr, isHor, refValue, parent, comp);
- if (res != UnitConverter.UNABLE)
- return res;
- }
- return PlatformDefaults.convertToPixels(value, unitStr, isHor, refValue, parent, comp);
- }
-
- private int parseUnitString()
- {
- int len = unitStr.length();
- if (len == 0)
- return isHor ? PlatformDefaults.getDefaultHorizontalUnit() : PlatformDefaults.getDefaultVerticalUnit();
-
- Integer u = UNIT_MAP.get(unitStr);
- if (u != null)
- return u;
-
- if (unitStr.equals("lp"))
- return isHor ? LPX : LPY;
-
- if (unitStr.equals("sp"))
- return isHor ? SPX : SPY;
-
- if (lookup(0, null, null) != UnitConverter.UNABLE) // To test so we can fail fast
- return LOOKUP;
-
- // Only link left. E.g. "otherID.width"
-
- int pIx = unitStr.indexOf('.');
- if (pIx != -1) {
- linkId = unitStr.substring(0, pIx);
- String e = unitStr.substring(pIx + 1);
-
- if (e.equals("x"))
- return LINK_X;
- if (e.equals("y"))
- return LINK_Y;
- if (e.equals("w") || e.equals("width"))
- return LINK_W;
- if (e.equals("h") || e.equals("height"))
- return LINK_H;
- if (e.equals("x2"))
- return LINK_X2;
- if (e.equals("y2"))
- return LINK_Y2;
- if (e.equals("xpos"))
- return LINK_XPOS;
- if (e.equals("ypos"))
- return LINK_YPOS;
- }
-
- throw new IllegalArgumentException("Unknown keyword: " + unitStr);
- }
-
- final boolean isLinked()
- {
- return linkId != null;
- }
-
- final boolean isLinkedDeep()
- {
- if (subUnits == null)
- return linkId != null;
-
- for (UnitValue subUnit : subUnits) {
- if (subUnit.isLinkedDeep())
- return true;
- }
-
- return false;
- }
-
- final String getLinkTargetId()
- {
- return linkId;
- }
-
- final UnitValue getSubUnitValue(int i)
- {
- return subUnits[i];
- }
-
- final int getSubUnitCount()
- {
- return subUnits != null ? subUnits.length : 0;
- }
-
- public final UnitValue[] getSubUnits()
- {
- return subUnits != null ? subUnits.clone() : null;
- }
-
- public final int getUnit()
- {
- return unit;
- }
-
- public final String getUnitString()
- {
- return unitStr;
- }
-
- public final int getOperation()
- {
- return oper;
- }
-
- public final float getValue()
- {
- return value;
- }
-
- public final boolean isHorizontal()
- {
- return isHor;
- }
-
- final public String toString()
- {
- return getClass().getName() + ". Value=" + value + ", unit=" + unit + ", unitString: " + unitStr + ", oper=" + oper + ", isHor: " + isHor;
- }
-
- /** Returns the creation string for this object. Note that {@link LayoutUtil#setDesignTime(ContainerWrapper, boolean)} must be
- * set to <code>true</code> for the creation strings to be stored.
- * @return The constraint string or <code>null</code> if none is registered.
- */
- public final String getConstraintString()
- {
- return LayoutUtil.getCCString(this);
- }
-
- public final int hashCode()
- {
- return (int) (value * 12345) + (oper >>> 5) + unit >>> 17;
- }
-
- /** Adds a global unit converter that can convert from some <code>unit</code> to pixels.
- * <p>
- * This converter will be asked before the platform converter so the values for it (e.g. "related" and "unrelated")
- * can be overridden. It is however not possible to override the built in ones (e.g. "mm", "pixel" or "lp").
- * @param conv The converter. Not <code>null</code>.
- */
- public synchronized static void addGlobalUnitConverter(UnitConverter conv)
- {
- if (conv == null)
- throw new NullPointerException();
- CONVERTERS.add(conv);
- }
-
- /** Removed the converter.
- * @param unit The converter.
- * @return If there was a converter found and thus removed.
- */
- public synchronized static boolean removeGlobalUnitConverter(UnitConverter unit)
- {
- return CONVERTERS.remove(unit);
- }
-
- /** Returns the global converters currently registered. The platform converter will not be in this list.
- * @return The converters. Never <code>null</code>.
- */
- public synchronized static UnitConverter[] getGlobalUnitConverters()
- {
- return CONVERTERS.toArray(new UnitConverter[CONVERTERS.size()]);
- }
-
- /** Returns the current default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @return The current default unit.
- * @see #PIXEL
- * @see #LPX
- * @deprecated Use {@link PlatformDefaults#getDefaultHorizontalUnit()} and {@link PlatformDefaults#getDefaultVerticalUnit()} instead.
- */
- public static int getDefaultUnit()
- {
- return PlatformDefaults.getDefaultHorizontalUnit();
- }
-
- /** Sets the default unit. The default unit is the unit used if no unit is set. E.g. "width 10".
- * @param unit The new default unit.
- * @see #PIXEL
- * @see #LPX
- * @deprecated Use {@link PlatformDefaults#setDefaultHorizontalUnit(int)} and {@link PlatformDefaults#setDefaultVerticalUnit(int)} instead.
- */
- public static void setDefaultUnit(int unit)
- {
- PlatformDefaults.setDefaultHorizontalUnit(unit);
- PlatformDefaults.setDefaultVerticalUnit(unit);
- }
-
- static {
- if(LayoutUtil.HAS_BEANS){
- LayoutUtil.setDelegate(UnitValue.class, new PersistenceDelegate() {
- protected Expression instantiate(Object oldInstance, Encoder out)
- {
- UnitValue uv = (UnitValue) oldInstance;
- String cs = uv.getConstraintString();
- if (cs == null)
- throw new IllegalStateException("Design time must be on to use XML persistence. See LayoutUtil.");
-
- return new Expression(oldInstance, ConstraintParser.class, "parseUnitValueOrAlign", new Object[] {
- uv.getConstraintString(), (uv.isHorizontal() ? Boolean.TRUE : Boolean.FALSE), null
- });
- }
- });
- }
- }
-
- // ************************************************
- // Persistence Delegate and Serializable combined.
- // ************************************************
-
- private static final long serialVersionUID = 1L;
-
- private Object readResolve() throws ObjectStreamException
- {
- return LayoutUtil.getSerializedObject(this);
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException
- {
- if (getClass() == UnitValue.class)
- LayoutUtil.writeAsXML(out, this);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
- {
- LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
- }
-}
[13/13] git commit: fixed refpack plugin,
MARMOTTA-397 caused some troubles...
Posted by ja...@apache.org.
fixed refpack plugin, MARMOTTA-397 caused some troubles...
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/75f106dd
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/75f106dd
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/75f106dd
Branch: refs/heads/develop
Commit: 75f106ddebd16c1ddc190f0b3e4013f405962b8b
Parents: 0226c44
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Jan 10 14:26:30 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Jan 10 15:02:53 2014 +0100
----------------------------------------------------------------------
.../marmotta/maven/plugins/refpack/RefPackMojo.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/75f106dd/build/plugins/refpack-maven-plugin/src/main/java/org/apache/marmotta/maven/plugins/refpack/RefPackMojo.java
----------------------------------------------------------------------
diff --git a/build/plugins/refpack-maven-plugin/src/main/java/org/apache/marmotta/maven/plugins/refpack/RefPackMojo.java b/build/plugins/refpack-maven-plugin/src/main/java/org/apache/marmotta/maven/plugins/refpack/RefPackMojo.java
index 4b7d96d..8136480 100644
--- a/build/plugins/refpack-maven-plugin/src/main/java/org/apache/marmotta/maven/plugins/refpack/RefPackMojo.java
+++ b/build/plugins/refpack-maven-plugin/src/main/java/org/apache/marmotta/maven/plugins/refpack/RefPackMojo.java
@@ -175,7 +175,7 @@ public class RefPackMojo extends AbstractMojo {
private void collectLibraryDependencies(DependencyNode node, Artifact currentModule) {
String groupId = node.getDependency().getArtifact().getGroupId();
String artifactId = node.getDependency().getArtifact().getArtifactId();
- if(!groupId.equals(moduleGroupId) || !artifactId.startsWith("marmotta-") || artifactId.equals("marmotta-commons") || artifactId.equals("marmotta-client-js")) {
+ if(!isPackDependency(groupId, artifactId)) {
// first check if the current artifact is already covered by a module the current module depends on
for(Artifact dependentArtifact : moduleDependencies.get(currentModule)) {
if(moduleLibraries.containsKey(dependentArtifact) &&
@@ -193,6 +193,15 @@ public class RefPackMojo extends AbstractMojo {
}
}
+ private boolean isPackDependency(String groupId, String artifactId) {
+ // only marmotta group-id and artifacts starting with marmotta-
+ return groupId.equals(moduleGroupId) && artifactId.startsWith("marmotta-")
+ // but not the commons and the JS-client
+ && !artifactId.equals("marmotta-commons") && !artifactId.equals("marmotta-client-js")
+ // and not the marmotta-sesame-tools
+ && !artifactId.startsWith("marmotta-util-") && !artifactId.startsWith("marmotta-sail-") && !artifactId.startsWith("marmotta-rio-");
+ }
+
/**
* Collect the dependencies to other modules inside the same project
* @param node
@@ -201,7 +210,7 @@ public class RefPackMojo extends AbstractMojo {
private void collectModuleDependencies(DependencyNode node, Artifact currentModule) {
String groupId = node.getDependency().getArtifact().getGroupId();
String artifactId = node.getDependency().getArtifact().getArtifactId();
- if(groupId.equals(moduleGroupId) && artifactId.startsWith("marmotta-") && !artifactId.equals("marmotta-commons") && !artifactId.equals("marmotta-client-js")) {
+ if(isPackDependency(groupId, artifactId)) {
moduleDependencies.get(currentModule).add(node.getDependency().getArtifact());
}
}
[02/13] MARMOTTA-419: removed 3rd-party source-code from the tree
(and from N&L)
Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/JTableFilter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/JTableFilter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/JTableFilter.java
deleted file mode 100644
index 1e6a710..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/JTableFilter.java
+++ /dev/null
@@ -1,116 +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.table.filter;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import javax.swing.DefaultRowSorter;
-import javax.swing.JTable;
-import javax.swing.RowFilter;
-import javax.swing.RowSorter;
-import javax.swing.table.TableModel;
-import javax.swing.table.TableRowSorter;
-
-public class JTableFilter extends AbstractTableFilter<JTable> {
-
- private static final long serialVersionUID = 1L;
-
- private final TableRowFilter filter = new TableRowFilter();
-
- public JTableFilter( JTable table ) {
- super(table);
- }
-
- @Override
- protected boolean execute(int col, Collection<DistinctColumnItem> items) {
-
- RowSorter<?> rs = getTable().getRowSorter();
-
- if (!( rs instanceof DefaultRowSorter )) return false;
-
- DefaultRowSorter<?, ?> drs = (DefaultRowSorter<?, ?>) rs;
-
- @SuppressWarnings("unchecked")
- RowFilter<Object,Object> prevFilter = (RowFilter<Object, Object>) drs.getRowFilter();
- if ( !(prevFilter instanceof TableRowFilter)) {
- filter.setParentFilter(prevFilter);
- }
-
- drs.setRowFilter(filter);
- return true;
-
-
- }
-
- class TableRowFilter extends RowFilter<Object,Object> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private RowFilter<Object, Object> parentFilter;
-
- public RowFilter<Object, Object> getParentFilter() {
- return parentFilter;
- }
-
- public void setParentFilter( RowFilter<Object, Object> parentFilter ) {
- this.parentFilter = (parentFilter == null || parentFilter == this )? null: parentFilter;
- }
-
- @Override
- public boolean include( final RowFilter.Entry<? extends Object, ? extends Object> entry) {
-
- // use parent filter condition
- if ( parentFilter != null && !parentFilter.include(entry)) return false;
-
- return includeRow( new ITableFilter.Row() {
-
- @Override
- public Object getValue(int column) { return entry.getValue(column); }
-
- @Override
- public int getValueCount() { return entry.getValueCount(); }
-
- });
-
- }
-
- }
-
- public void modelChanged( TableModel model ) {
- TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>( model );
- sorter.setSortsOnUpdates(true);
- getTable().setRowSorter( sorter );
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableAwareCheckListRenderer.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableAwareCheckListRenderer.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableAwareCheckListRenderer.java
deleted file mode 100644
index 13800b6..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableAwareCheckListRenderer.java
+++ /dev/null
@@ -1,86 +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.table.filter;
-
-import java.awt.Component;
-import java.lang.reflect.Method;
-
-import javax.swing.JList;
-import javax.swing.JTable;
-import javax.swing.table.TableCellRenderer;
-
-import org.oxbow.swingbits.list.CheckListRenderer;
-
-@SuppressWarnings("serial")
-public class TableAwareCheckListRenderer extends CheckListRenderer {
-
- private final JTable table;
- private final int column;
-
- public TableAwareCheckListRenderer( JTable table, int column ) {
- this.table = table;
- this.column = column;
- }
-
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
- boolean cellHasFocus) {
-
- super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
-
- // try to retrieve the text from table's cell renderer
- if (value instanceof DistinctColumnItem) {
-
- DistinctColumnItem item = (DistinctColumnItem) value;
- TableCellRenderer renderer = table.getCellRenderer( item.getRow(), column);
-
- try {
-
- Component cmpt = renderer.getTableCellRendererComponent(
- table, item.getValue(), isSelected, hasFocus(), item.getRow(), column );
-
- Method method = cmpt.getClass().getMethod("getText");
- Object s = method.invoke(cmpt);
-
- if ( s instanceof String ) {
- setText( (String)s );
- }
-
- } catch (Throwable e) {
-// e.printStackTrace();
- }
-
- }
- return this;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterColumnPopup.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterColumnPopup.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterColumnPopup.java
deleted file mode 100644
index 996fff0..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterColumnPopup.java
+++ /dev/null
@@ -1,317 +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.table.filter;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Rectangle;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JToolBar;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.table.JTableHeader;
-import javax.swing.table.TableColumnModel;
-
-import org.oxbow.swingbits.list.ActionCheckListModel;
-import org.oxbow.swingbits.list.CheckList;
-import org.oxbow.swingbits.list.CheckListFilterType;
-import org.oxbow.swingbits.list.DefaultCheckListModel;
-import org.oxbow.swingbits.list.ICheckListModel;
-import org.oxbow.swingbits.misc.JSearchTextField;
-import org.oxbow.swingbits.popup.PopupWindow;
-import org.oxbow.swingbits.util.CollectionUtils;
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-
-class TableFilterColumnPopup extends PopupWindow implements MouseListener {
-
- static class ColumnAttrs {
- public Dimension preferredSize;
- }
-
- private boolean enabled = false;
-
- private final CheckList<DistinctColumnItem> filterList = new CheckList.Builder().build();
- private final JSearchTextField searchField = new JSearchTextField();
-
- private final Map<Integer, ColumnAttrs> colAttrs = new HashMap<Integer, ColumnAttrs>();
- private int mColumnIndex = -1;
-
- private final ITableFilter<?> filter;
- private boolean searchable;
- private IObjectToStringTranslator translator;
- private boolean actionsVisible = true;
- private boolean useTableRenderers = false;
-
- public TableFilterColumnPopup( ITableFilter<?> filter ) {
-
- super( true );
-
- this.filter = filter;
- filterList.getList().setVisibleRowCount(8);
-
- setupTableHeader();
- filter.getTable().addPropertyChangeListener( "tableHeader", new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- setupTableHeader();
- }}
- );
- filter.getTable().addPropertyChangeListener( "model", new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- colAttrs.clear();
- }}
- );
-
- searchField.getDocument().addDocumentListener( new DocumentListener() {
-
- @Override
- public void removeUpdate(DocumentEvent e) { perform(e); }
-
- @Override
- public void insertUpdate(DocumentEvent e) { perform(e); }
-
- @Override
- public void changedUpdate(DocumentEvent e) { perform(e);}
-
- private void perform(DocumentEvent e) {
- filterList.filter(searchField.getText(), translator, CheckListFilterType.CONTAINS );
- }
-
- });
-
- }
-
- public void setSearchable( boolean searchable ) {
- this.searchable = searchable;
- }
-
- public void setSearchTranslator( IObjectToStringTranslator tranlsator ) {
- this.translator = tranlsator;
- }
-
- public void setActionsVisible(boolean actionsVisible) {
- this.actionsVisible = actionsVisible;
- }
-
- public void setUseTableRenderers(boolean reuseRenderers) {
- this.useTableRenderers = reuseRenderers;
- }
-
- private void setupTableHeader() {
- JTableHeader header = filter.getTable().getTableHeader();
- if ( header != null ) header.addMouseListener( this );
- }
-
-
- @SuppressWarnings("serial")
- @Override
- protected JComponent buildContent() {
-
- JPanel owner = new JPanel( new BorderLayout(3,3) );
- owner.setBorder( BorderFactory.createEmptyBorder(1, 1, 1, 1));
- owner.setPreferredSize(new Dimension(250, 150)); // default popup size
-
- Box commands = new Box(BoxLayout.LINE_AXIS);
-
- JToolBar toolbar = new JToolBar();
- toolbar.setFloatable(false);
- toolbar.setOpaque(false);
- toolbar.add( new PopupWindow.CommandAction(
- "Clear all column filters",
- new ImageIcon(getClass().getResource("funnel_delete.png"))) {
- @Override
- protected boolean perform() {
- return clearAllFilters();
- }
- });
- commands.add( toolbar );
-
- commands.add(Box.createHorizontalGlue());
-
- commands.add( new JButton( new PopupWindow.CommandAction("Apply"){
- @Override
- protected boolean perform() {
- return applyColumnFilter();
- }})
- );
- commands.add( Box.createHorizontalStrut(5) );
- commands.add( new JButton( new PopupWindow.CommandAction("Cancel")));
- commands.setBorder( BorderFactory.createEmptyBorder(3, 0, 3, 0));
- commands.setBackground(UIManager.getColor("Panel.background"));
- commands.setOpaque(true);
-
- if ( searchable) {
- owner.add( searchField, BorderLayout.NORTH );
- }
- owner.add( new JScrollPane( filterList.getList() ), BorderLayout.CENTER );
- owner.add( commands, BorderLayout.SOUTH );
-
- return owner;
-
- }
-
- private boolean applyColumnFilter() {
- Collection<DistinctColumnItem> checked = filterList.getCheckedItems();
- ICheckListModel<DistinctColumnItem> model = filterList.getModel();
- model.filter("", translator, CheckListFilterType.CONTAINS); // clear filter to get true results
- filter.apply(mColumnIndex, checked);
- return true;
- }
-
- private boolean clearAllFilters() {
- filter.clear();
- return true;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- // Popup menus are triggered differently on different platforms
- // Therefore, isPopupTrigger should be checked in both mousePressed and mouseReleased
- // events for for proper cross-platform functionality
-
- @Override
- public void mousePressed(MouseEvent e) {
- if ( enabled && e.isPopupTrigger() ) showFilterPopup(e);
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- if ( enabled && e.isPopupTrigger() ) showFilterPopup(e);
- }
-
- private void showFilterPopup(MouseEvent e) {
- JTableHeader header = (JTableHeader)(e.getSource());
- TableColumnModel colModel = filter.getTable().getColumnModel();
-
- // The index of the column whose header was clicked
- int vColumnIndex = colModel.getColumnIndexAtX(e.getX());
- if ( vColumnIndex < 0 ) return;
-
-
- // Determine if mouse was clicked between column heads
- Rectangle headerRect = filter.getTable().getTableHeader().getHeaderRect(vColumnIndex);
- if (vColumnIndex == 0) {
- headerRect.width -= 2;
- } else {
- headerRect.grow(-2, 0);
- }
-
- // Mouse was clicked between column heads
- if (!headerRect.contains(e.getX(), e.getY())) return;
-
- // restore popup's size for the column
- mColumnIndex = filter.getTable().convertColumnIndexToModel(vColumnIndex);
- setPreferredSize( getColumnAttrs(vColumnIndex).preferredSize );
-
- Collection<DistinctColumnItem> distinctItems = filter.getDistinctColumnItems(mColumnIndex);
-
- DefaultCheckListModel<DistinctColumnItem> model = new DefaultCheckListModel<DistinctColumnItem>(distinctItems);
- filterList.setModel( actionsVisible? new ActionCheckListModel<DistinctColumnItem>( model): model);
- Collection<DistinctColumnItem> checked = filter.getFilterState(mColumnIndex);
-
- // replace empty checked items with full selection
- filterList.setCheckedItems( CollectionUtils.isEmpty(checked)? distinctItems: checked);
-
- if ( useTableRenderers ) {
- filterList.getList().setCellRenderer( new TableAwareCheckListRenderer( filter.getTable(), vColumnIndex) );
- }
-
- // show pop-up
- show( header, headerRect.x, header.getHeight() );
- }
-
- private ColumnAttrs getColumnAttrs( int column ) {
- ColumnAttrs attrs = colAttrs.get(column);
- if ( attrs == null ) {
- attrs = new ColumnAttrs();
- colAttrs.put( column, attrs);
- }
-
- return attrs;
- }
-
-
- @Override
- protected void beforeShow() {
- if ( searchable ) {
- SwingUtilities.invokeLater( new Runnable() {
- @Override
- public void run() {
- searchField.setText("");
- searchField.requestFocusInWindow();
- }
- });
- }
- }
-
- @Override
- public void beforeHide() {
- // save pop-up's dimensions before pop-up becomes hidden
- getColumnAttrs(mColumnIndex).preferredSize = getPreferredSize();
- }
-
-
- @Override
- public void mouseClicked(MouseEvent e) {}
-
- @Override
- public void mouseEntered(MouseEvent e) {}
-
- @Override
- public void mouseExited(MouseEvent e) {}
-
-
- }
-
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterState.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterState.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterState.java
deleted file mode 100644
index aec7065..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableFilterState.java
+++ /dev/null
@@ -1,129 +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.table.filter;
-
-import static org.oxbow.swingbits.util.CollectionUtils.isEmpty;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-class TableFilterState implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- // no set - filter cleared; set - some kind of filtering
- private final Map<Integer,Set<DistinctColumnItem>> data = new HashMap<Integer,Set<DistinctColumnItem>>();
-
- /**
- * Clears filtering for specific column
- */
- public void clear( int column ) {
- data.remove(column);
- }
-
-
- /**
- * Clears all filtering
- */
- public void clear() {
- data.clear();
- }
-
- private Set<DistinctColumnItem> prepareValueSet( int column ) {
- Set<DistinctColumnItem> vals = data.get(column);
- if ( vals == null ) {
- vals = new HashSet<DistinctColumnItem>();
- data.put(column, vals);
- }
- return vals;
- }
-
-
- /**
- * Adds filter value for specified column
- * @param column
- * @param value
- */
- public void addValue( int column, DistinctColumnItem value ) {
- prepareValueSet(column).add(value);
- }
-
-
- /**
- * Adds a collection of filter values for specified column
- * @param column
- * @param values
- */
- public void addValues( int column, Collection<DistinctColumnItem> values ) {
- prepareValueSet(column).addAll(values);
- }
-
- /**
- * Resets a collection of filter values for specified column
- * @param column
- * @param values
- */
- public void setValues( int column, Collection<DistinctColumnItem> values ) {
- data.remove(column);
- if ( !isEmpty(values)) {
- prepareValueSet(column).addAll(values);
- }
- }
-
- public Collection<DistinctColumnItem> getValues( int column ) {
- Set<DistinctColumnItem> vals = data.get(column);
- return vals == null? Collections.<DistinctColumnItem>emptySet(): vals;
- }
-
- /**
- * Standard test for row inclusion using current filter values
- * @param entry
- * @return true if row has to be included
- */
- public boolean include( ITableFilter.Row entry ) {
-
- for( int col=0; col< entry.getValueCount(); col++ ) {
- Collection<DistinctColumnItem> values = getValues(col);
- if ( isEmpty(values) ) continue; // no filtering for this column
- if ( !values.contains( new DistinctColumnItem( entry.getValue(col), 0))) return false;
- }
- return true;
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableRowFilterSupport.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableRowFilterSupport.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableRowFilterSupport.java
deleted file mode 100644
index ad9da21..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/TableRowFilterSupport.java
+++ /dev/null
@@ -1,166 +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.table.filter;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-
-import javax.swing.JTable;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.oxbow.swingbits.util.IObjectToStringTranslator;
-
-public final class TableRowFilterSupport {
-
- private boolean searchable = false;
- private IObjectToStringTranslator translator;
- private final ITableFilter<?> filter;
- private boolean actionsVisible = true;
- private boolean useTableRenderers = false;
-
- private TableRowFilterSupport( ITableFilter<?> filter ) {
- if ( filter == null ) throw new NullPointerException();
- //this.table = table;
- this.filter = filter;
- }
-
- public static TableRowFilterSupport forTable( JTable table ) {
- return new TableRowFilterSupport(new JTableFilter(table));
- }
-
- public static TableRowFilterSupport forFilter( ITableFilter<?> filter ) {
- return new TableRowFilterSupport(filter);
- }
-
- /**
- * Additional actions visible in column filter list
- * @param visible
- * @return
- */
- public TableRowFilterSupport actions( boolean visible ) {
- this.actionsVisible = visible;
- return this;
- }
-
- /**
- * Comlumn filter list is searchable
- * @param serachable
- * @return
- */
- public TableRowFilterSupport searchable( boolean serachable) {
- this.searchable = serachable;
- return this;
- }
-
- public TableRowFilterSupport searchTransalator( IObjectToStringTranslator translator ) {
- this.translator = translator;
- return this;
- }
-
- public TableRowFilterSupport useTableRenderers( boolean value ) {
- this.useTableRenderers = value;
- return this;
- }
-
- public JTable apply() {
-
- final TableFilterColumnPopup filterPopup = new TableFilterColumnPopup(filter);
- filterPopup.setEnabled(true);
- filterPopup.setActionsVisible(actionsVisible);
- filterPopup.setSearchable(searchable);
- filterPopup.setSearchTranslator(translator);
- filterPopup.setUseTableRenderers( useTableRenderers );
-
- setupTableHeader();
-
- return filter.getTable();
- }
-
- private void setupTableHeader() {
-
- final JTable table = filter.getTable();
-
- filter.addChangeListener(new IFilterChangeListener() {
-
- @Override
- public void filterChanged(ITableFilter<?> filter) {
- table.getTableHeader().repaint();
-
- }
- });
-
- // make sure that search component is reset after table model changes
- setupHeaderRenderers(table.getModel(), true );
-// table.addPropertyChangeListener("model", new PropertyChangeListener() {
-//
-// public void propertyChange(PropertyChangeEvent evt) {
-//
-// FilterTableHeaderRenderer headerRenderer = new FilterTableHeaderRenderer(filter);
-// filter.modelChanged((TableModel) evt.getNewValue());
-//
-// for( TableColumn c: Collections.list( filter.getTable().getColumnModel().getColumns()) ) {
-// c.setHeaderRenderer( headerRenderer );
-// }
-// }}
-//
-// );
- }
-
- private void setupHeaderRenderers( TableModel newModel, boolean fullSetup ) {
-
- JTable table = filter.getTable();
-
- FilterTableHeaderRenderer headerRenderer = new FilterTableHeaderRenderer(filter);
- filter.modelChanged( newModel );
-
- for( TableColumn c: Collections.list( table.getColumnModel().getColumns()) ) {
- c.setHeaderRenderer( headerRenderer );
- }
-
- if ( !fullSetup ) return;
-
- table.addPropertyChangeListener("model", new PropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent e) {
- setupHeaderRenderers( (TableModel) e.getNewValue(), false );
- }
-
- });
-
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel.png b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel.png
deleted file mode 100644
index dd8344c..0000000
Binary files a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel_delete.png
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel_delete.png b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel_delete.png
deleted file mode 100644
index f801e4d..0000000
Binary files a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/table/filter/funnel_delete.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/CollectionUtils.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/CollectionUtils.java
deleted file mode 100644
index 6a58d72..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/CollectionUtils.java
+++ /dev/null
@@ -1,64 +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.util;
-
-import java.util.Collection;
-import java.util.TreeSet;
-
-public class CollectionUtils {
-
- /**
- * Checks if collection is empty. Null references are considered to be empty collections.
- * @param c
- * @return true if collection is empty
- */
- public static final boolean isEmpty( Collection<?> c ) {
- return c == null || c.isEmpty();
- }
-
- /**
- * Tries to sort collection. All elements have to implement Comparable interface and
- * be mutually comparable
- * @param <T>
- * @param any collection
- * @return new sorted collection if succeeded otherwise same collection
- */
- public static <T> Collection<T> trySort( Collection<T> c ) {
- try {
- return new TreeSet<T>( c );
- } catch( Throwable ex ) {
- }
- return c;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopy.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopy.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopy.java
deleted file mode 100644
index 62065cf..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopy.java
+++ /dev/null
@@ -1,94 +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.util;
-
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-import org.oxbow.swingbits.util.copy.FastByteArrayInputStream;
-import org.oxbow.swingbits.util.copy.FastByteArrayOutputStream;
-
-/**
- * Utility for object deep copying (vs. clone()'s shallow copying)
- */
-public class DeepCopy {
-
- /**
- * Creates deep copy of the object.
- * @param originalObject object to copy
- * @return copy of originalObject
- * @throws DeepCopyException if operation cannot be performed
- */
- public static final <T extends Serializable> T copy( T originalObject ) {
- return DeepCopy.<T>restore( (FastByteArrayInputStream) store( originalObject ).getInputStream() );
- }
-
- public static final <T extends Serializable> FastByteArrayOutputStream store( T obj ) {
-
- try {
-
- FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(fbos);
- out.writeObject( obj );
- out.flush();
- out.close();
-
- return fbos;
-
- } catch( Throwable ex ) {
-
- throw new DeepCopyException("An " + obj.getClass().getSimpleName() + " cannot be serialized. The reason: " + ex.getLocalizedMessage(), ex);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public static final <T extends Serializable> T restore( FastByteArrayInputStream stream) {
-
- try {
-
- ObjectInputStream in = new ObjectInputStream(stream);
- return (T) in.readObject();
-
- } catch( Throwable ex ) {
-
- throw new DeepCopyException("An object cannot be deserizalized. The reason: " + ex.getLocalizedMessage(), ex);
-
- }
-
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopyException.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopyException.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopyException.java
deleted file mode 100644
index 02501bc..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DeepCopyException.java
+++ /dev/null
@@ -1,57 +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.util;
-
-public class DeepCopyException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public DeepCopyException() {
- super();
- }
-
- public DeepCopyException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public DeepCopyException(String message) {
- super(message);
- }
-
- public DeepCopyException(Throwable cause) {
- super(cause);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DefaultObjectToStringTranslator.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DefaultObjectToStringTranslator.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DefaultObjectToStringTranslator.java
deleted file mode 100644
index e3b0e49..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/DefaultObjectToStringTranslator.java
+++ /dev/null
@@ -1,42 +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.util;
-
-public class DefaultObjectToStringTranslator implements IObjectToStringTranslator {
-
- @Override
- public String translate(Object obj) {
- return obj == null? "": obj.toString().toLowerCase();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IObjectToStringTranslator.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IObjectToStringTranslator.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IObjectToStringTranslator.java
deleted file mode 100644
index 8edbb91..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IObjectToStringTranslator.java
+++ /dev/null
@@ -1,38 +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.util;
-
-public interface IObjectToStringTranslator {
-
- String translate( Object obj );
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IValueWrapper.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IValueWrapper.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IValueWrapper.java
deleted file mode 100644
index 54b43b2..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/IValueWrapper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.oxbow.swingbits.util;
-
-public interface IValueWrapper<T> {
-
- T getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Markup.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Markup.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Markup.java
deleted file mode 100644
index f6fc704..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Markup.java
+++ /dev/null
@@ -1,123 +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.util;
-
-import java.awt.Color;
-import java.awt.Font;
-
-public final class Markup {
-
- private static final String HTML_START = "<html>";
- private static final String HTML_END = "</html>";
- private static final String HTML_BREAK = "<br>";
-
- private Markup() {}
-
- public static final String toHex( Color color ) {
- color = color == null ? Color.BLACK: color;
- String rgb = Integer.toHexString(color.getRGB());
- return rgb.substring(2, rgb.length());
- }
-
- /**
- * Converts string to simple <HTML> presentation.<br>
- * Replaces EOLs with <BR> tags
- * @param s
- * @param finalize if true wraps text with <HTML> tags
- * @return
- */
- public final static String toHTML( String s, boolean finalize ) {
-
- s = s == null? "": s.replaceAll("\n", HTML_BREAK);
- String tmp = s.trim().toLowerCase();
-
- StringBuilder sb = new StringBuilder(s);
-
- if ( finalize ) {
- if ( !tmp.startsWith(HTML_START)) sb.insert(0, HTML_START);
- if ( !tmp.endsWith(HTML_END)) sb.append( HTML_END );
- }
-
- return sb.toString();
- }
-
- /**
- * Converts string to simple <HTML> presentation.<br>
- * Replaces EOLs with <BR> tags, wraps text with <HTML> tags
- * @param s
- * @return
- */
- public final static String toHTML( String s ) {
- return toHTML( s, true );
- }
-
- /**
- * Converts font to CSS style
- * @param font
- * @return CSS style as string
- */
- public final static String toCSS( Font font ) {
-
- return String.format( "font-family: \"%s\"; %s; %s;",
- font.getFamily(),
- toSizeCSS(font),
- toStyleCSS(font) );
-
- }
-
- public final static String toSizeCSS( Font font ) {
- //TODO: use Toolkit.getDefaultToolkit().getScreenResolution() to calculate font size in pixels
-
- return String.format( "font-size: %fpx", font.getSize() * .75); // converts to pixels with standard DPI
- }
-
- public final static String toStyleCSS( Font font ) {
-
- switch ( font.getStyle() ) {
- case Font.ITALIC: return "font-style : italic";
- case Font.BOLD : return "font-weight: bold";
- default : return "font-weight: normal";
-
- }
-
- }
-
- /**
- * Converts color to CSS style
- * @param color
- * @return CSS style as string
- */
- public final static String toCSS( Color color ) {
- return String.format( "color: #%s;", toHex(color));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/OperatingSystem.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/OperatingSystem.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/OperatingSystem.java
deleted file mode 100644
index 2171ade..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/OperatingSystem.java
+++ /dev/null
@@ -1,97 +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.util;
-
-/**
- * Utility class to allow OS determination
- *
- * Created on Mar 11, 2010
- * @author Eugene Ryzhikov
- *
- */
-public enum OperatingSystem {
-
- WINDOWS( "windows" ),
- MACOS( "mac" ),
- LINUX( "linux" ),
- UNIX( "nix" ),
- SOLARIS( "solaris" ),
-
- UNKNOWN( "unknown" ) {
- @Override protected boolean isReal() { return false; }
- };
-
-
- private String tag;
-
- OperatingSystem( String tag ) {
- this.tag = tag;
- }
-
- public boolean isCurrent() {
- return isReal() && getName().toLowerCase().indexOf(tag) >=0;
- }
-
- public static final String getName() {
- return System.getProperty("os.name");
- }
-
- public static final String getVersion() {
- return System.getProperty("os.version");
- }
-
- public static final String getArchitecture() {
- return System.getProperty("os.arch");
- }
-
- @Override
- public final String toString() {
- return String.format("%s v%s (%s)", getName(), getVersion(), getArchitecture() );
- }
-
- protected boolean isReal() {
- return true;
- }
-
- /**
- * Returns current operating system
- * @return current operating system or UNKNOWN if not found
- */
- public static final OperatingSystem getCurrent() {
-
- for( OperatingSystem os: OperatingSystem.values() ) {
- if ( os.isCurrent() ) return os;
- }
- return UNKNOWN;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Preconditions.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Preconditions.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Preconditions.java
deleted file mode 100644
index 8697467..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Preconditions.java
+++ /dev/null
@@ -1,58 +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.util;
-
-public class Preconditions {
-
- private Preconditions(){}
-
- public static void checkArgument(boolean expression) {
- if (!expression) throw new IllegalArgumentException();
- }
-
- public static void checkArgument(boolean expression, String message ) {
- if (!expression) throw new IllegalArgumentException( String.valueOf(message));
- }
-
- public static <T> T checkNotNull(T ref) {
- if (ref == null) throw new NullPointerException();
- return ref;
- }
-
- public static <T> T checkNotNull(T ref, String message ) {
- if (ref == null) throw new NullPointerException(String.valueOf(message));
- return ref;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Screenshot.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Screenshot.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Screenshot.java
deleted file mode 100644
index 698686e..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Screenshot.java
+++ /dev/null
@@ -1,143 +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.util;
-
-import java.awt.AWTException;
-import java.awt.AWTPermission;
-import java.awt.DisplayMode;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Image;
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.imageio.ImageIO;
-
-public class Screenshot {
-
- private final BufferedImage image;
-
-
- /**
- * Creates an image containing pixels read from the screen. This image does
- * not include the mouse cursor.
- * @param screenRect Rect to capture in screen coordinates
- * @return captured screenshot
- * @throws IllegalArgumentException if <code>screenRect</code> width and height are not greater than zero
- * @throws SecurityException if <code>readDisplayPixels</code> permission is not granted
- * @throws AWTException
- * @see SecurityManager#checkPermission
- * @see AWTPermission
- */
- public static final Screenshot capture( Rectangle screenRect ) throws AWTException {
- return new Screenshot( getRobot().createScreenCapture( screenRect ));
- }
-
- public static final Screenshot capture( int width, int height ) throws AWTException {
- return capture( new Rectangle( width, height ));
- }
-
-
- private static Robot robot;
-
- private synchronized static Robot getRobot() throws AWTException {
-
- if ( robot == null ) robot = new Robot();
- return robot;
-
- }
-
- private Screenshot( BufferedImage image ) {
- this.image = image;
- }
-
- /**
- * Returns the image screenshot is based on
- */
- public Image getImage() {
- return image;
- }
-
-
- /**
- * Writes an image using an arbitrary <code>ImageWriter</code>
- * that supports the given format to a <code>File</code>. If
- * there is already a <code>File</code> present, its contents are
- * discarded.
- * @param formatName a <code>String</code> containg the informal name of the format.
- * @param output a <code>File</code> to be written to
- *
- * if an error occurs during writing.
- *
- * @exception IllegalArgumentException if any parameter is <code>null</code>.
- * @throws IOException if an error occurs during writing.
- */
- public boolean store( String formatName, File output ) throws IOException {
- return ImageIO.write( image, formatName, output );
- }
-
- /**
- * Retrieves screen information as a list of display modes,
- * which includes screen dimensions, bit depth and refresh rate
- * @return
- */
- public static final List<DisplayMode> getDisplayInfo() {
-
- List<DisplayMode> result = new ArrayList<DisplayMode>();
- for (GraphicsDevice gs: GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
- result.add( gs.getDisplayMode());
- }
- return result;
-
- }
-
-
-// public static void main(String[] args) {
-//
-// try {
-// System.out.println("taking screenshot...");
-//
-// DisplayMode dm = getDisplayInfo().get(0);
-// Screenshot.capture( dm.getWidth(), dm.getHeight()).store( "jpg", new File("C:/home/imageTest.jpg") );
-// } catch (Throwable e) {
-// e.printStackTrace();
-// }
-//
-// }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Strings.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Strings.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Strings.java
deleted file mode 100644
index af784b4..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/Strings.java
+++ /dev/null
@@ -1,102 +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.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-public class Strings {
-
- private Strings(){};
-
- /**
- * Check if string is empty
- * @param s
- * @return true if string is null or empty (white spaces are not counted)
- */
- public final static boolean isEmpty( String s ) {
- return s == null || s.trim().length() == 0;
- }
-
-
- /**
- * Returns safe string - never null
- * @param s
- * @return
- */
- public final static String safe( String s ) {
- return isEmpty(s)? "": s;
- }
-
- /**
- * Capitalize every word in the string
- * @param s
- * @return
- */
- public final static String capitalize( String s ) {
-
- if ( isEmpty(s) ) return s;
-
- StringBuilder sb = new StringBuilder();
- for( String w: s.split(" ") ) {
- sb.append( capitalizeWord(w) );
- sb.append(' ');
- }
- return sb.toString().trim();
- }
-
- /**
- * Capitalizes given word
- * @param word
- * @return
- */
- private final static String capitalizeWord( String word ) {
-
- if ( isEmpty(word) ) return word;
- String capital = word.substring(0, 1).toUpperCase();
- return ( word.length() == 1 )? capital: capital + word.substring(1).toLowerCase();
-
- }
-
-
- /**
- * Converts exception stack trace as string
- * @param ex
- * @return
- */
- public static final String stackStraceAsString( Throwable ex ) {
- StringWriter sw = new StringWriter();
- ex.printStackTrace(new PrintWriter(sw));
- return sw.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayInputStream.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayInputStream.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayInputStream.java
deleted file mode 100644
index d1e66a0..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayInputStream.java
+++ /dev/null
@@ -1,92 +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.util.copy;
-
-
-import java.io.InputStream;
-
-/**
- * ByteArrayInputStream implementation that does not synchronize methods.
- */
-public class FastByteArrayInputStream extends InputStream {
-
- /**
- * Our byte buffer
- */
- protected byte[] buf = null;
-
- /**
- * Number of bytes that we can read from the buffer
- */
- protected int count = 0;
-
- /**
- * Number of bytes that have been read from the buffer
- */
- protected int pos = 0;
-
- public FastByteArrayInputStream(byte[] buf, int count) {
- this.buf = buf;
- this.count = count;
- }
-
- public final int available() {
- return count - pos;
- }
-
- public final int read() {
- return (pos < count) ? (buf[pos++] & 0xff) : -1;
- }
-
- public final int read(byte[] b, int off, int len) {
- if (pos >= count)
- return -1;
-
- if ((pos + len) > count)
- len = (count - pos);
-
- System.arraycopy(buf, pos, b, off, len);
- pos += len;
- return len;
- }
-
- public final long skip(long n) {
- if ((pos + n) > count)
- n = count - pos;
- if (n < 0)
- return 0;
- pos += n;
- return n;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayOutputStream.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayOutputStream.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayOutputStream.java
deleted file mode 100644
index 559ca81..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/copy/FastByteArrayOutputStream.java
+++ /dev/null
@@ -1,117 +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.util.copy;
-
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * ByteArrayOutputStream implementation that doesn't synchronize methods
- * and doesn't copy the data on toByteArray().
- */
-public class FastByteArrayOutputStream extends OutputStream {
- /**
- * Buffer and size
- */
- protected byte[] buf = null;
- protected int size = 0;
-
- /**
- * Constructs a stream with buffer capacity size 5K
- */
- public FastByteArrayOutputStream() {
- this(5 * 1024);
- }
-
- /**
- * Constructs a stream with the given initial size
- */
- public FastByteArrayOutputStream(int initSize) {
- this.size = 0;
- this.buf = new byte[initSize];
- }
-
- /**
- * Ensures that we have a large enough buffer for the given size.
- */
- private void verifyBufferSize(int sz) {
- if (sz > buf.length) {
- byte[] old = buf;
- buf = new byte[Math.max(sz, 2 * buf.length )];
- System.arraycopy(old, 0, buf, 0, old.length);
-// old = null;
- }
- }
-
- public int getSize() {
- return size;
- }
-
- /**
- * Returns the byte array containing the written data. Note that this
- * array will almost always be larger than the amount of data actually
- * written.
- */
- public byte[] getByteArray() {
- return buf;
- }
-
- public final void write(byte b[]) {
- verifyBufferSize(size + b.length);
- System.arraycopy(b, 0, buf, size, b.length);
- size += b.length;
- }
-
- public final void write(byte b[], int off, int len) {
- verifyBufferSize(size + len);
- System.arraycopy(b, off, buf, size, len);
- size += len;
- }
-
- public final void write(int b) {
- verifyBufferSize(size + 1);
- buf[size++] = (byte) b;
- }
-
- public void reset() {
- size = 0;
- }
-
- /**
- * Returns a ByteArrayInputStream for reading back the written data
- */
- public InputStream getInputStream() {
- return new FastByteArrayInputStream(buf, size);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/AncestorAdapter.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/AncestorAdapter.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/AncestorAdapter.java
deleted file mode 100644
index 252e986..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/AncestorAdapter.java
+++ /dev/null
@@ -1,51 +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.util.swing;
-
-import javax.swing.event.AncestorEvent;
-import javax.swing.event.AncestorListener;
-
-public class AncestorAdapter implements AncestorListener {
-
- @Override
- public void ancestorAdded(AncestorEvent event) {
- }
-
- @Override
- public void ancestorRemoved(AncestorEvent event) {
- }
-
- @Override
- public void ancestorMoved(AncestorEvent event) {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/BeanProperty.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/BeanProperty.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/BeanProperty.java
deleted file mode 100644
index ff59fca..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/BeanProperty.java
+++ /dev/null
@@ -1,93 +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.util.swing;
-
-import java.beans.PropertyChangeSupport;
-
-/**
- * Incupsulates Bean Property concept.
- * Includes automated property change notifications
- * @author Eugene Ryzhikov
- *
- * @param <T>
- */
-public abstract class BeanProperty<T> {
-
- private PropertyChangeSupport notificator;
- private String propertyName;
- private boolean forceChange;
-
- public BeanProperty( PropertyChangeSupport notificator, String propertyName, boolean forceSet ) {
- this.notificator = notificator;
- this.propertyName = propertyName;
- this.forceChange = forceSet;
- }
-
- public BeanProperty( PropertyChangeSupport notificator, String propertyName) {
- this( notificator, propertyName, false );
- }
-
- /**
- * Returns property value
- * @return
- */
- public abstract T get();
-
- /**
- * Sets property value
- * @param value
- */
- protected abstract void setValue( T value );
-
- /**
- * Sets property value. Sends property change notification if value is actually changed
- * @param newValue
- * @return true if value was changed
- */
- public final boolean set( T newValue ) {
-
- boolean result;
- T oldValue = get();
- if ( result = forceChange || !sameValues( oldValue, newValue )) {
- setValue(newValue);
- notificator.firePropertyChange( propertyName, oldValue, newValue );
- }
- return result;
-
- }
-
- private boolean sameValues( T a, T b ) {
- return a == b || ( a != null && b != null && a.equals( b ));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/60ae655a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/CompoundIcon.java
----------------------------------------------------------------------
diff --git a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/CompoundIcon.java b/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/CompoundIcon.java
deleted file mode 100644
index e355236..0000000
--- a/launchers/marmotta-splash/src/ext/java/org/oxbow/swingbits/util/swing/CompoundIcon.java
+++ /dev/null
@@ -1,302 +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.util.swing;
-
-import java.awt.*;
-import javax.swing.*;
-
-/**
- * The CompoundIcon will paint two, or more, Icons as a single Icon. The Icons
- * are painted in the order in which they are added.
- *
- * The Icons can be laid out
- * <ul>
- * <li>Horizontally
- * <li>Vertically
- * <li>Stacked
- * </ul>
- *
- */
-public class CompoundIcon implements Icon {
- public enum Layout {
- HORIZONTAL, VERTICAL, STACKED;
- }
-
- public final static float TOP = 0.0f;
- public final static float LEFT = 0.0f;
- public final static float CENTER = 0.5f;
- public final static float BOTTOM = 1.0f;
- public final static float RIGHT = 1.0f;
-
- private Icon[] icons;
-
- private Layout layout;
-
- private int gap;
-
- private float alignmentX = CENTER;
- private float alignmentY = CENTER;
-
- /**
- * Convenience constructor for creating a CompoundIcon where the icons are
- * laid out horizontally, the gap is 0 and the X/Y alignments will default
- * to CENTER.
- *
- * @param icons
- * the Icons to be painted as part of the CompoundIcon
- */
- public CompoundIcon(Icon... icons) {
- this(Layout.HORIZONTAL, icons);
- }
-
- /**
- * Convenience constructor for creating a CompoundIcon where the gap is 0
- * and the X/Y alignments will default to CENTER.
- *
- * @param layout
- * the layout used to lay out the icons for painting.
- * @param icons
- * the Icons to be painted as part of the CompoundIcon
- */
- public CompoundIcon(Layout layout, Icon... icons) {
- this(layout, 0, icons);
- }
-
- /**
- * Convenience constructor for creating a CompoundIcon where the X/Y
- * alignments will default to CENTER.
- *
- * @param layout
- * the layout used to lay out the icons for painting
- * @param gap
- * the gap between the icons
- * @param icons
- * the Icons to be painted as part of the CompoundIcon
- */
- public CompoundIcon(Layout layout, int gap, Icon... icons) {
- this(layout, gap, CENTER, CENTER, icons);
- }
-
- /**
- * Create a CompoundIcon specifying all the properties.
- *
- * @param layout
- * the layout used to lay out the icons for painting
- * @param gap
- * the gap between the icons
- * @param alignmentX
- * the X alignment of the icons. Common values are LEFT, CENTER,
- * RIGHT. Can be any value between 0.0 and 1.0
- * @param alignmentY
- * the Y alignment of the icons. Common values are TOP, CENTER,
- * BOTTOM. Can be any value between 0.0 and 1.0
- * @param icons
- * the Icons to be painted as part of the CompoundIcon
- */
- public CompoundIcon(Layout layout, int gap, float alignmentX,
- float alignmentY, Icon... icons) {
- this.layout = layout;
- this.gap = gap;
- this.alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f
- : alignmentX;
- this.alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f
- : alignmentY;
-
- for (int i = 0; i < icons.length; i++) {
- if (icons[i] == null) {
- throw new IllegalArgumentException("Icon (" + i
- + ") cannot be null");
- }
- }
-
- this.icons = icons;
- }
-
- /**
- * Get the layout along which each icon is painted.
- *
- * @return the layout
- */
- public Layout getLayout() {
- return layout;
- }
-
- /**
- * Get the gap between each icon
- *
- * @return the gap in pixels
- */
- public int getGap() {
- return gap;
- }
-
- /**
- * Get the alignment of the icon on the x-layout
- *
- * @return the alignment
- */
- public float getAlignmentX() {
- return alignmentX;
- }
-
- /**
- * Get the alignment of the icon on the y-layout
- *
- * @return the alignment
- */
- public float getAlignmentY() {
- return alignmentY;
- }
-
- /**
- * Get the number of Icons contained in this CompoundIcon.
- *
- * @return the total number of Icons
- */
- public int getIconCount() {
- return icons.length;
- }
-
- /**
- * Get the Icon at the specified index.
- *
- * @param index
- * the index of the Icon to be returned
- * @return the Icon at the specified index
- * @exception IndexOutOfBoundsException
- * if the index is out of range
- */
- public Icon getIcon(int index) {
- return icons[index];
- }
-
- // ///// Icon Interface /////////////////////////////
-
- /**
- * Gets the width of this icon.
- *
- * @return the width of the icon in pixels.
- */
- @Override
- public int getIconWidth() {
- int width = 0;
-
- // Add the width of all Icons while also including the gap
- if (layout == Layout.HORIZONTAL) {
- width += (icons.length - 1) * gap;
- for (Icon icon : icons)
- width += icon.getIconWidth();
- } else { // Just find the maximum width
- for (Icon icon : icons)
- width = Math.max(width, icon.getIconWidth());
- }
-
- return width;
- }
-
- /**
- * Gets the height of this icon.
- *
- * @return the height of the icon in pixels.
- */
- @Override
- public int getIconHeight() {
- int height = 0;
-
- // Add the height of all Icons while also including the gap
- if (layout == Layout.VERTICAL) {
- height += (icons.length - 1) * gap;
-
- for (Icon icon : icons)
- height += icon.getIconHeight();
- } else // Just find the maximum height
- {
- for (Icon icon : icons)
- height = Math.max(height, icon.getIconHeight());
- }
-
- return height;
- }
-
- /**
- * Paint the icons of this compound icon at the specified location
- *
- * @param c The component on which the icon is painted
- *
- * @param g the graphics context
- *
- * @param x the X coordinate of the icon's top-left corner
- *
- * @param y the Y coordinate of the icon's top-left corner
- *
- */
- @Override
- public void paintIcon(Component c, Graphics g, int x, int y) {
- if (layout == Layout.HORIZONTAL) {
- int height = getIconHeight();
-
- for (Icon icon : icons) {
- int iconY = getOffset(height, icon.getIconHeight(), alignmentY);
- icon.paintIcon(c, g, x, y + iconY);
- x += icon.getIconWidth() + gap;
- }
- } else if (layout == Layout.VERTICAL) {
- int width = getIconWidth();
-
- for (Icon icon : icons) {
- int iconX = getOffset(width, icon.getIconWidth(), alignmentX);
- icon.paintIcon(c, g, x + iconX, y);
- y += icon.getIconHeight() + gap;
- }
- } else {// must be Z_layout
-
- int width = getIconWidth();
- int height = getIconHeight();
-
- for (Icon icon : icons) {
- int iconX = getOffset(width, icon.getIconWidth(), alignmentX);
- int iconY = getOffset(height, icon.getIconHeight(), alignmentY);
- icon.paintIcon(c, g, x + iconX, y + iconY);
- }
- }
- }
-
- /*
- * When the icon value is smaller than the maximum value of all icons the
- * icon needs to be aligned appropriately. Calculate the offset to be used
- * when painting the icon to achieve the proper alignment.
- */
- private int getOffset(int maxValue, int iconValue, float alignment) {
- float offset = (maxValue - iconValue) * alignment;
- return Math.round(offset);
- }
-}