svn commit: r1913476 - in /pivot/trunk: core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/util/ core/src/org/apache/pivot/util/concurrent/ core/test/org/apache/pivot/util/test/ tests/sr
Author: rwhitcomb Date: Wed Nov 1 02:16:53 2023 New Revision: 1913476 URL: http://svn.apache.org/viewvc?rev=1913476=rev Log: PIVOT-1032: Last set of changes to reduce "checkstyle" violations, plus some code enhancements. Modified: pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java pivot/trunk/core/src/org/apache/pivot/util/Utils.java pivot/trunk/core/src/org/apache/pivot/util/concurrent/Task.java pivot/trunk/core/src/org/apache/pivot/util/concurrent/TimeoutException.java pivot/trunk/core/test/org/apache/pivot/util/test/StringUtilsTest.java pivot/trunk/tests/src/org/apache/pivot/tests/console_test.bxml pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java pivot/trunk/wtk/src/org/apache/pivot/wtk/Keyboard.java pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInputListener.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java Modified: pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java?rev=1913476=1913475=1913476=diff == --- pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java (original) +++ pivot/trunk/core/src/org/apache/pivot/collections/HashSet.java Wed Nov 1 02:16:53 2023 @@ -35,7 +35,7 @@ public class HashSet implements Set iterator) { +public ElementIterator(final Iterator iterator) { Utils.checkNull(iterator, "iterator"); this.iterator = iterator; @@ -79,25 +79,25 @@ public class HashSet implements Set set) { +public HashSet(final Set set) { for (E element : set) { add(element); } } @SafeVarargs -public HashSet(E... elements) { +public HashSet(final E... elements) { for (E element : elements) { add(element); } } -public HashSet(Comparator comparator) { +public HashSet(final Comparator comparator) { setComparator(comparator); } @Override -public boolean add(E element) { +public boolean add(final E element) { boolean added = false; if (!hashMap.containsKey(element)) { @@ -113,7 +113,7 @@ public class HashSet implements Set implements Set implements Set comparator) { +public void setComparator(final Comparator comparator) { Comparator previousComparator = getComparator(); hashMap.setComparator(comparator); @@ -186,7 +186,7 @@ public class HashSet implements Set implements Sethttp://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java?rev=1913476=1913475=1913476=diff == --- pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/StringUtils.java Wed Nov 1 02:16:53 2023 @@ -18,6 +18,7 @@ package org.apache.pivot.util; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Arrays; /** @@ -50,16 +51,10 @@ public final class StringUtils { throw new IllegalArgumentException("Requested string size " + n + " is out of range."); } -// Nothing fancy here, but allocate the space and set length upfront -// because we know how big the result should be. -StringBuilder builder = new StringBuilder(n); -builder.setLength(n); -if (ch != '\0') { -for (int i = 0; i < n; i++) { -builder.setCharAt(i, ch); -} -} -return builder.toString(); +char[] chars = new char[n]; +Arrays.fill(chars, ch); + +return new String(chars); } /** Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1913476=1913475=1913476=diff == --- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Wed Nov 1 02:16:53 2023 @@ -450,5 +450,19 @@ public final class Utils { } } +/** + * Check and throw an exception if the given object is not of the given class. + * + * @param nm A suitable object name for the object. + * @param obj The object whose
svn commit: r1913470 [15/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/CSSColor.java Tue Oct 31 19:15:47 2023 @@ -1,376 +1,376 @@ -/* - * 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.pivot.wtk; - -import java.awt.Color; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import org.apache.pivot.wtk.util.ColorUtilities; - -/** - * The complete enumeration of the CSS3/X11 color names and values, - * taken from here: - * http://www.w3.org/TR/css3-color/;>http://www.w3.org/TR/css3-color/, - * and including the Java {@link Color} names (with all British/American - * spelling variants). - * Ugly note: Several of these colors including (but not limited to), "pink", - * "green", the "grays", etc. are different between the Java colors and these CSS - * definitions. So, to support everything, the following conventions have been - * established: - * The color names are (more-or-less) case-sensitive. - * Where there are CSS colors and Java colors with similar names (except for - * case differences), the Java colors are found using all lower case (e.g., "green") - * or all UPPER case (e.g., "GREEN") and the CSS value with a mixed-case name - * (e.g., "Green"). - * If there is no duplicate (e.g., "AliceBlue") then the value can be found - * using any of these variants. - * NOTE: this means that other combinations (e.g., "gReEn") which might have - * worked in the past will now fail and throw an exception. - * - * This list also contains the Java versions of the names (complete with spelling - * variations) for complete compatibility, and we put the Java variants in first - * for the sake of the lookup maps. - * Note: these are available through the - * {@link GraphicsUtilities#decodeColor GraphicsUtilities.decodeColor()} - * and {@link org.apache.pivot.wtk.content.ColorItem#allCSSColors} methods. - */ -public enum CSSColor { - AliceBlue(240, 248, 255), -AntiqueWhite(250, 235, 215), -Aqua( 0, 255, 255), - Aquamarine(127, 255, 212), - Azure(240, 255, 255), - Beige(245, 245, 220), - Bisque(255, 228, 196), - black(Color.black), - BLACK(Color.BLACK), - Black( 0, 0, 0), - BlanchedAlmond(255, 235, 205), -blue(Color.blue), -BLUE(Color.BLUE), -Blue( 0, 0, 255), - BlueViolet(138, 43, 226), - Brown(165, 42, 42), - Burlywood(222, 184, 135), - CadetBlue( 95, 158, 160), - Chartreuse(127, 255, 0), - Chocolate(210, 105, 30), - Coral(255, 127, 80), - CornflowerBlue(100, 149, 237), -Cornsilk(255, 248, 220), - Crimson(220, 20, 60), -cyan(Color.cyan), -CYAN(Color.CYAN), -Cyan( 0, 255, 255), -DarkBlue( 0, 0, 139), -DarkCyan( 0, 139, 139), - DarkGoldenrod(184, 134, 11), -darkGray(Color.darkGray), - DARK_GRAY(Color.DARK_GRAY), -DarkGray(169, 169, 169), - DarkGreen( 0, 100, 0), -DarkGrey(169, 169, 169), - DarkKhaki(189, 183, 107), - DarkMagenta(139, 0, 139), - DarkOliveGreen( 85, 107, 47), - DarkOrange(255, 140, 0), - DarkOrchid(153, 50, 204), - DarkRed(139, 0, 0), - DarkSalmon(233, 150, 122), -DarkSeaGreen(143, 188, 143), - DarkSlateBlue( 72, 61, 139), - DarkSlateGray( 47, 79, 79), - DarkSlateGrey( 47, 79, 79), - DarkTurquoise( 0, 206, 209), -
svn commit: r1913470 [8/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json Tue Oct 31 19:15:47 2023 @@ -1,53 +1,53 @@ -/* - * 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. - */ -{ font: "Dialog 12", - -colorMultiplier: 0.1, - -themeIsDark: true, - -themeIsFlat: true, - -transitionEnabled: false, - -thickFocusRectangle: false, - -colors: [ -"#f5f5f5", -"#141414", -"#66", -"#232323", -"#ff7f00", -"#ff8914", -"#b8b000", -"#eb" -], - -messageIcons: { -error: "message_type-error-32x32.png", -warning: "message_type-warning-32x32.png", -question: "message_type-question-32x32.png", -info: "message_type-info-32x32.png" -}, - -smallMessageIcons: { -error: "message_type-error-16x16.png", -warning: "message_type-warning-16x16.png", -question: "message_type-question-16x16.png", -info: "message_type-info-16x16.png" -} -} +/* + * 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. + */ +{ font: "Dialog 12", + +colorMultiplier: 0.1, + +themeIsDark: true, + +themeIsFlat: true, + +transitionEnabled: false, + +thickFocusRectangle: false, + +colors: [ +"#f5f5f5", +"#141414", +"#66", +"#232323", +"#ff7f00", +"#ff8914", +"#b8b000", +"#eb" +], + +messageIcons: { +error: "message_type-error-32x32.png", +warning: "message_type-warning-32x32.png", +question: "message_type-question-32x32.png", +info: "message_type-info-32x32.png" +}, + +smallMessageIcons: { +error: "message_type-error-16x16.png", +warning: "message_type-warning-16x16.png", +question: "message_type-question-16x16.png", +info: "message_type-info-16x16.png" +} +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json -- svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TextAreaConsoleTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TextAreaConsoleTest.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/TextAreaConsoleTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/TextAreaConsoleTest.java Tue Oct 31 19:15:47 2023 @@ -1,178 +1,178 @@ -/* - * 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
svn commit: r1913470 [3/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java (original) +++ pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java Tue Oct 31 19:15:47 2023 @@ -1,249 +1,249 @@ -/* - * 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.pivot.serialization; - -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayDeque; -import java.util.HashMap; -import java.util.Map; -import java.util.Queue; - - -/** - * This is a {@link Reader} that can be instantiated inline with any other - * {@code Reader} to provide macro capabilities. - * We recognize #define NAME value as definitions - * as well as #undef NAME to remove a previous definition. - * The macro name must correspond to the Unicode naming conventions (see - * {@link Character#isUnicodeIdentifierStart} and {@link Character#isUnicodeIdentifierPart}). - * Macro substitutions are recognized as ${NAME} anywhere - * in the underlying stream. Nested macros are supported, and are expanded at the - * point of definition, if defined, or at the point of expansion if defined later. - */ -public final class MacroReader extends Reader { -/** The input reader we are mapping. */ -private Reader in; - -/** The map of our defined variables and their values. */ -private Map variableMap = new HashMap<>(); - -/** The lookahead queue, set either by one-character lookahead (such as - * while recognizing "$NAME") or from macro expansion. - */ -private Queue lookaheadQueue = new ArrayDeque<>(); - -/** The previous character read. */ -private int lastCh = -1; - -/** - * Construct a new macro reader on top of the given reader. - * @param reader The input reader we are going to wrap. - */ -public MacroReader(final Reader reader) { -this.in = reader; -} - -@Override -public void close() throws IOException { -in.close(); -} - -/** - * Add the given character to the lookahead queue for reprocessing. - * @param ch The character to queue. - */ -private void queue(final int ch) { -if (ch != -1) { -lookaheadQueue.add(ch); -} -} - -/** - * Add all the characters of the given character sequence to the - * lookahead queue for reprocessing. - * @param seq The character sequence to be queued up again. - */ -private void queue(final CharSequence seq) { -for (int i = 0; i < seq.length(); i++) { -lookaheadQueue.add((int) seq.charAt(i)); -} -} - -/** - * Parse out the next word in the stream (according to Unicode - * Identifier semantics) as the macro name, skipping leading whitespace. - * @return The next parsed "word" string. - * @throws IOException for errors reading the stream. - */ -private String getNextWord() throws IOException { -StringBuilder buf = new StringBuilder(); -int ch; -do { -ch = getNextChar(true); -} while (ch != -1 && Character.isWhitespace(ch)); - -if (ch != -1) { -buf.append((char) ch); -while ((ch = getNextChar(true)) != -1 - && ((buf.length() == 0 && Character.isUnicodeIdentifierStart(ch)) -|| (buf.length() > 0 && Character.isUnicodeIdentifierPart(ch { -buf.append((char) ch); -} - -// Re-queue the character that terminated the word -queue(ch); -} -return buf.toString(); -} - -/** - * Get the next character in the input stream, either from the - * {@link #lookaheadQueue} if anything is queued, or by reading - * from the underlying {@link Reader}. - * This is the heart of the processing that handles both - * macro definition and expansion. - * @param handleMacros set to {@code false} only when - *
svn commit: r1913470 [7/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java (original) +++ pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java Tue Oct 31 19:15:47 2023 @@ -1,136 +1,136 @@ -/* - * 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.pivot.demos.colors; - -import java.awt.Color; -import java.awt.Font; -import java.util.Set; -import org.apache.pivot.collections.Map; -import org.apache.pivot.util.StringUtils; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.Border; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.CSSColor; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.FontUtilities; -import org.apache.pivot.wtk.GridPane; -import org.apache.pivot.wtk.HorizontalAlignment; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.Orientation; -import org.apache.pivot.wtk.ScrollPane; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.Window; - -public final class Colors implements Application { -private static final int CELLS_PER_ROW = 5; - -private Window mainWindow; - -private Label makeLabel(final String text) { -Label label = new Label(text); -label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER); -return label; -} - -@Override -public void startup(final Display display, final Map properties) { -GridPane gridPane = new GridPane(CELLS_PER_ROW); -gridPane.putStyle(Style.padding, 6); - -Font fontBold= FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD, 13); -Font fontRegular = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.PLAIN, 12); -Font fontItalic = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.ITALIC, 11); - -int cell = 0; -GridPane.Row row = null; - -int numColors = CSSColor.numberOfColors(); - -for (CSSColor color : CSSColor.values()) { -if (cell % CELLS_PER_ROW == 0) { -row = new GridPane.Row(gridPane); -} - -BoxPane container = new BoxPane(Orientation.VERTICAL); -container.putStyle(Style.padding, 4); -container.putStyle(Style.fill, true); - -BoxPane colorFill = new BoxPane(Orientation.VERTICAL); - -Color fillColor = color.getColor(); -String colorName = color.toString(); -int r = fillColor.getRed(); -int g = fillColor.getGreen(); -int b = fillColor.getBlue(); - -colorFill.putStyle(Style.backgroundColor, fillColor); -colorFill.setPreferredWidth(372); -colorFill.setPreferredHeight(100); -Set matchingColors = CSSColor.getMatchingColors(color); -String matches = matchingColors.size() == 0 -? "No matches." -: "Matches: " + StringUtils.toString(matchingColors); -colorFill.setTooltipText(matches); - -Label nameLabel = makeLabel(color.toString()); -nameLabel.putStyle(Style.font, fontBold); - -String rgbText = String.format("R=%1$3d, G=%2$3d, B=%3$3d", r, g, b); -Label rgbLabel = makeLabel(rgbText); -rgbLabel.putStyle(Style.font, fontRegular); - -float[] hsbValues = Color.RGBtoHSB(r, g, b, null); -String hsbText = String.format("H=%1$5.3f, S=%2$5.3f, V=%3$5.3f", -hsbValues[0], hsbValues[1], hsbValues[2]); -Label hsbLabel = makeLabel(hsbText); -hsbLabel.putStyle(Style.font, fontRegular); - -String seqText = String.format("%1$d / %2$d", cell + 1, numColors); -Label seqLabel = makeLabel(seqText); -seqLabel.putStyle(Style.font, fontItalic); - -container.add(colorFill); -container.add(nameLabel); -
svn commit: r1913470 [12/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java Tue Oct 31 19:15:47 2023 @@ -1,598 +1,598 @@ -/* - * 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.pivot.wtk.skin.terra; - -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.vfs2.FileName; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystem; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileSystemManager; -import org.apache.commons.vfs2.FileType; -import org.apache.pivot.beans.BXML; -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.ArrayList; -import org.apache.pivot.collections.Sequence; -import org.apache.pivot.serialization.SerializationException; -import org.apache.pivot.util.Filter; -import org.apache.pivot.util.Vote; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.Button; -import org.apache.pivot.wtk.ButtonPressListener; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.ComponentMouseButtonListener; -import org.apache.pivot.wtk.Container; -import org.apache.pivot.wtk.Form; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.Mouse; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.Sheet; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.TablePane; -import org.apache.pivot.wtk.TextInput; -import org.apache.pivot.wtk.TextInputContentListener; -import org.apache.pivot.wtk.VFSBrowser; -import org.apache.pivot.wtk.VFSBrowserListener; -import org.apache.pivot.wtk.VFSBrowserSheet; -import org.apache.pivot.wtk.VFSBrowserSheetListener; -import org.apache.pivot.wtk.Window; - -/** - * Terra Commons VFS browser sheet skin. - */ -public class TerraVFSBrowserSheetSkin extends TerraSheetSkin implements VFSBrowserSheetListener { - -private static class SaveToFileFilter implements Filter { -public final Filter sourceFilter; - -public SaveToFileFilter(Filter sourceFilter) { -this.sourceFilter = sourceFilter; -} - -@Override -public boolean include(FileObject file) { -return (file.getName().getType() != FileType.FOLDER -|| (sourceFilter != null && sourceFilter.include(file))); -} -} - -@BXML private TablePane tablePane = null; -@BXML private BoxPane hostNameBoxPane = null; -@BXML private Label hostNameLabel = null; -@BXML private BoxPane saveAsBoxPane = null; -@BXML private TextInput saveAsTextInput = null; -@BXML private VFSBrowser fileBrowser = null; -@BXML private PushButton okButton = null; -@BXML private PushButton cancelButton = null; - -private FileSystem fileSystem = null; -private boolean updatingSelection = false; -private int selectedDirectoryCount = 0; -private static final Pattern HOST_PATTERN = - Pattern.compile("[a-zA-Z]+://([a-zA-Z0-9\\-_\\.]+)([a-zA-Z0-9\\-\\.]+)?:\\d+/.*"); - - -private void setHostLabel(FileObject rootDir) { -try { -if (rootDir != null) { -hostNameBoxPane.setVisible(true); -FileSystem localFileSystem = rootDir.getFileSystem(); -if (!localFileSystem.equals(fileSystem)) { -fileSystem = localFileSystem; -FileObject root = fileSystem.getRoot(); -String rootURL = root.getURL().toString(); -// Parse out the host name with some special considerations -Matcher m = HOST_PATTERN.matcher(rootURL); -if (m.matches()) { -hostNameLabel.setText(m.group(1)); -}
svn commit: r1913470 [19/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/RulerSkin.java Tue Oct 31 19:15:47 2023 @@ -1,557 +1,557 @@ -/* - * 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.pivot.wtk.skin; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.font.FontRenderContext; -import java.awt.font.GlyphVector; -import java.awt.font.LineMetrics; -import java.awt.geom.Rectangle2D; -import java.text.StringCharacterIterator; - -import org.apache.pivot.collections.Dictionary; -import org.apache.pivot.collections.Sequence; -import org.apache.pivot.util.Utils; -import org.apache.pivot.wtk.Borders; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.CSSColor; -import org.apache.pivot.wtk.GraphicsUtilities; -import org.apache.pivot.wtk.Insets; -import org.apache.pivot.wtk.Orientation; -import org.apache.pivot.wtk.Platform; -import org.apache.pivot.wtk.Ruler; -import org.apache.pivot.wtk.RulerListener; -import org.apache.pivot.wtk.Theme; - -public class RulerSkin extends ComponentSkin implements RulerListener { -private static final int MAJOR_SIZE = 10; -private static final int MINOR_SIZE = 8; -private static final int REGULAR_SIZE = 5; - -private Color color; -private Color backgroundColor; -private int markerSpacing; -private Insets markerInsets; -private boolean flip; -private Borders borders; -private int majorDivision; -private int minorDivision; -private boolean showMajorNumbers; -private boolean showMinorNumbers; -private Font font; -private float charWidth, charHeight, descent; - -public RulerSkin() { -// For now the default colors are not from the Theme. -setColor(Color.BLACK); -setBackgroundColor(CSSColor.LightYellow.getColor()); - -markerSpacing = 5; -markerInsets = new Insets(0); -flip = false; -borders = Borders.ALL; -majorDivision = 4; -minorDivision = 2; -showMajorNumbers = false; -showMinorNumbers = false; - -Theme theme = currentTheme(); -setFont(theme.getFont()); -} - -@Override -public void install(Component component) { -super.install(component); - -Ruler ruler = (Ruler) component; -ruler.getRulerListeners().add(this); -} - -@Override -public void layout() { -// No-op -} - -@Override -public int getPreferredHeight(int width) { -Ruler ruler = (Ruler) getComponent(); -Orientation orientation = ruler.getOrientation(); - -// Give a little extra height if showing numbers -return (orientation == Orientation.HORIZONTAL) - ? ((showMajorNumbers || showMinorNumbers) - ? ((int) Math.ceil(charHeight) + MAJOR_SIZE + 5) : MAJOR_SIZE * 2) : 0; -} - -@Override -public int getPreferredWidth(int height) { -Ruler ruler = (Ruler) getComponent(); -Orientation orientation = ruler.getOrientation(); - -// Give a little extra width if showing numbers -return (orientation == Orientation.VERTICAL) - ? ((showMajorNumbers || showMinorNumbers) - ? ((int) Math.ceil(charWidth) + MAJOR_SIZE + 5) : MAJOR_SIZE * 2) : 0; -} - -private void showNumber(Graphics2D graphics, FontRenderContext fontRenderContext, int number, -int x, int y) { -String num = Integer.toString(number); - -StringCharacterIterator line; -GlyphVector glyphVector; -Rectangle2D textBounds; -float width, height; -float fx, fy; - -Ruler ruler = (Ruler) getComponent(); -Orientation orientation = ruler.getOrientation(); - -switch (orientation) { -case HORIZONTAL: -// Draw the whole number just off the tip of the line given by
svn commit: r1913470 [16/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Gauge.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Gauge.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Gauge.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Gauge.java Tue Oct 31 19:15:47 2023 @@ -1,338 +1,338 @@ -/* - * 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.pivot.wtk; - -import org.apache.pivot.util.ListenerList; -import org.apache.pivot.util.StringUtils; -import org.apache.pivot.util.Utils; - -/** - * A circular gauge component that can display a single value of an arbitrary - * numeric type. - */ -public class Gauge extends Component { -private Origin origin; -private String text; -private T value; -private T minValue; -private T maxValue; -private T warningLevel; -private T criticalLevel; -private GaugeListener.Listeners gaugeListeners = new GaugeListener.Listeners(); -/** Runtime class (used to check values at runtime). */ -private Class clazz; - -/** - * Default constructor for this component, with the default {@link Origin} - * value (which is NORTH). - */ -public Gauge() { - this(Origin.NORTH); -} - -/** - * Constructor for a new gauge object, using the given {@link Origin} value. - * @param origin The "origin" or zero point of the gauge (a compass direction). - */ -public Gauge(Origin origin) { -setOrigin(origin); -installSkin(Gauge.class); -} - -public Origin getOrigin() { -return this.origin; -} - -/** - * Set the "origin" value for this gauge, that is, the point in the circle where - * drawing of the value starts (one of the main compass directions). The gauge - * value will always be drawn clockwise starting from the origin location. - * @param origin The new origin value. - * @throws IllegalArgumentException if the origin value is {@code null}. - */ -public void setOrigin(Origin origin) { -Utils.checkNull(origin, "origin"); - -Origin previousOrigin = this.origin; - -if (previousOrigin != origin) { -this.origin = origin; -gaugeListeners.originChanged(this, previousOrigin); -} -} - -public Class getType() { -return this.clazz; -} - -/** - * Since this is a generic component that can take any numeric type, for BXML we need - * to specify the specific type of the value (which is also needed for the min/max and - * warning/critical values). - * @param typeName The type name for the value of this component. For convenience you can - * specify just "Integer", "Short", "BigDecimal", or any other subclass of {@link Number} - * here, or you can give the fully-qualified name. - */ -@SuppressWarnings("unchecked") -public void setType(String typeName) { -try { -this.clazz = (Class) ((typeName.indexOf('.') < 0) -? Class.forName("java.lang." + typeName) -: Class.forName(typeName)); -} catch (ClassNotFoundException cnfe) { -if (typeName.indexOf('.') < 0) { -// Try "java.math" (for BigDecimal, etc.) types -try { -this.clazz = (Class) Class.forName("java.math." + typeName); -} catch (ClassNotFoundException cnfe2) { -throw new RuntimeException(cnfe); -} -} -} -} - -/** - * If the {@link #clazz} was set by a prior call to {@link #setType setType()} then - * check the runtime class of the value against it, otherwise call {@link #setType setType()} - * to establish it for the future. - * - * @param value A value presumably compatible with the declared type of this gauge. - * @throws ClassCastException if the value is not compatible with the previously - * established type. - */ -private void setOrCheckClass(T value) { -if (this.clazz != null) { -if (!clazz.isInstance(value)) { -
svn commit: r1913470 [10/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Pivot965Main.java -- svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Window965.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Window965.bxml?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Window965.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Window965.bxml Tue Oct 31 19:15:47 2023 @@ -1,49 +1,49 @@ - - - -http://pivot.apache.org/bxml; -xmlns="org.apache.pivot.wtk"> - - -function isNull(value) { -return value == null; -} - -function isNotNull(value) { -return value != null; -} - -function toUpperCase(value) { -return value.toUpperCase(); -} - - - - - - - - - - - - - - - + + + +http://pivot.apache.org/bxml; +xmlns="org.apache.pivot.wtk"> + + +function isNull(value) { +return value == null; +} + +function isNotNull(value) { +return value != null; +} + +function toUpperCase(value) { +return value.toUpperCase(); +} + + + + + + + + + + + + + + + Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Window965.bxml -- svn:eol-style = native Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_843_test.dib -- --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -image/x-ms-bmp +image/bmp Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_880.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_880.bxml?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_880.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_880.bxml Tue Oct 31 19:15:47 2023 @@ -1,91 +1,91 @@ - - - -http://pivot.apache.org/bxml; -xmlns="org.apache.pivot.wtk" -> - - - - - - - - - - - - - - - -function buttonPressed(button) { -if (textInput.text.length() > 0) -openFileBrowser(textInput.text); -} - - - - - - - - - - - - - - - + + + +http://pivot.apache.org/bxml; +xmlns="org.apache.pivot.wtk" +> + + + + + + + + + + + + + + + +function buttonPressed(button) { +if (textInput.text.length() > 0) +openFileBrowser(textInput.text); +} + + + + + + + + + + + + + + + Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_880.bxml -- svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_888.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_888.bxml?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_888.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_888.bxml Tue Oct 31 19:15:47 2023 @@ -1,36 +1,36 @@ - - - -http://pivot.apache.org/bxml; -xmlns="org.apache.pivot.wtk" -> - - - - - - - - - - - - - + + +
svn commit: r1913470 [11/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin_ja.json URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin_ja.json?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin_ja.json (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin_ja.json Tue Oct 31 19:15:47 2023 @@ -1,21 +1,21 @@ -/* - * 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. - */ -{ saveAs: "ååãä»ãã¦ä¿å:", -ok: "OK", -cancel: "ãã£ã³ã»ã«" -} - +/* + * 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. + */ +{ saveAs: "ååãä»ãã¦ä¿å:", +ok: "OK", +cancel: "ãã£ã³ã»ã«" +} + Propchange: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin_ja.json -- svn:eol-style = native Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin_ja.json URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin_ja.json?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin_ja.json (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin_ja.json Tue Oct 31 19:15:47 2023 @@ -1,27 +1,27 @@ -/* - * 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. - */ -{ selectDrive: "ãã©ã¤ãã®é¸æ", -goTo: "ä¸ã®ãã©ã«ãã¼ã«ç§»å", -goUp: "ä¸ã®ãã©ã«ãã¼ã«ç§»å", -newFolder: "æ°ãããã©ã«ãã¼ã®ä½æ", -goHome: "ãã¼ã ãã©ã«ãã¼ã«ç§»å", -search: "æ¤ç´¢", -searchFor: "ãã¡ã¤ã«ãæ¤ç´¢", -fileName: "ãã¡ã¤ã«", -size: "ãµã¤ãº", -lastModified: "æ´æ°æ¥æ" -} +/* + * 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
svn commit: r1913470 [21/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SpanTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SpanTest.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SpanTest.java (original) +++ pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SpanTest.java Tue Oct 31 19:15:47 2023 @@ -1,99 +1,99 @@ -/* - * 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.pivot.wtk.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import org.apache.pivot.wtk.Span; - - -/** - * Tests the {@link Span} class which is used extensively - * in the "wtk" source, and deserves good tests. - */ -public class SpanTest { - -@Test -public void test() { -Span spMinus1 = new Span(-1, 0); -Span sp0 = new Span(0); -Span sp1 = new Span(0, 1); -Span sp2 = Span.decode("[1, 0]"); -Span sp3 = Span.decode("{start:2, end:3}"); -Span sp3a = new Span(2, 3); -Span sp4 = new Span(4); -Span sp5 = sp3a.offset(1); -Span sp5a = new Span(3, 4); -Span sp5b = new Span(4, 3); -Span spN = new Span(0, 4); -Span spAll = sp1.union(sp0).union(sp2).union(sp3).union(sp4); -Span sp6 = Span.decode("4, 6"); -Span sp6a = new Span(4, 6); -Span sp6b = sp6.lengthen(-3); -Span sp6d = sp6b.move(-2); - -assertEquals(spMinus1.getLength(), 2); -assertEquals(sp0.getLength(), 1); - -assertTrue(sp1.contains(sp0)); - -assertTrue(spMinus1.intersects(sp0)); -assertTrue(sp0.intersects(sp1)); -assertEquals(sp0.intersect(sp1), sp0); -assertTrue(sp5b.intersects(sp3a)); -assertTrue(sp0.union(sp1).equals(sp1)); - -assertFalse(sp0.equals(sp1)); -assertTrue(sp1.equals(sp2.normalize())); -assertEquals(sp3, sp3a); - -assertFalse(sp0.adjacentTo(sp2)); -assertTrue(sp1.adjacentTo(sp3)); -assertTrue(sp3.adjacentTo(sp1)); -assertTrue(sp4.adjacentTo(sp3a)); -assertTrue(sp3.adjacentTo(sp4)); - -assertTrue(sp5.equals(sp5a)); -assertEquals(spN, spAll); - -assertEquals(sp2.normalStart(), 0); -assertEquals(sp2.normalEnd(), 1); -assertTrue(sp5a.normalEquals(sp5b)); - -assertTrue(sp4.after(sp1)); -assertTrue(sp3a.before(sp4)); - -assertEquals(sp6, sp6a); -assertEquals(sp6.getLength(), 3); -assertEquals(sp6.toString(), "Span {start:4, end:6}"); -assertEquals(sp6b, sp5b); -assertEquals(sp6d, sp3a); - -Span s9 = new Span(5, 6); -Span s9a = new Span(6, 5); -assertTrue(s9.isNormal()); -assertFalse(s9a.isNormal()); -assertEquals(s9, s9a.normalize()); -assertEquals(s9, Span.normalize(6, 5)); -} - -} - +/* + * 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.pivot.wtk.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import org.apache.pivot.wtk.Span; + + +/** + * Tests the {@link Span} class which is used extensively + * in the "wtk" source, and deserves good tests. + */
svn commit: r1913470 [17/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowser.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowser.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowser.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowser.java Tue Oct 31 19:15:47 2023 @@ -1,443 +1,443 @@ -/* - * 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.pivot.wtk; - -import java.io.File; -import java.net.URI; - -import org.apache.commons.vfs2.FileName; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileSystemManager; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.VFS; -import org.apache.pivot.collections.ArrayList; -import org.apache.pivot.collections.Sequence; -import org.apache.pivot.collections.immutable.ImmutableList; -import org.apache.pivot.io.FileObjectList; -import org.apache.pivot.util.Filter; -import org.apache.pivot.util.ListenerList; -import org.apache.pivot.util.Utils; - -/** - * A file browser that uses the Apache Commons VFS (Virtual File System) to be - * able to browse local and remote file systems, and browse inside of .zip, - * .tar, etc. archives as well. - */ -public class VFSBrowser extends Container { -/** - * Commons VFS browser skin interface. - */ -public interface Skin extends org.apache.pivot.wtk.Skin { -public FileObject getFileAt(int x, int y); -public void addActionComponent(Component component); -} - -private static final URI USER_HOME = new File(System.getProperty("user.home")).toURI(); - -private FileSystemManager manager; -private FileName baseFileName; -private FileObject rootDirectory; -private FileObject homeDirectory; -private FileObjectList selectedFiles = new FileObjectList(); -private boolean multiSelect = false; -private Filter disabledFileFilter = null; - -private VFSBrowserListener.Listeners fileBrowserListeners = new VFSBrowserListener.Listeners(); - -/** - * Creates a new VFSBrowser Note that this version sets, by default, - * the mode to open. - * - * @throws FileSystemException if there are problems. - */ -public VFSBrowser() throws FileSystemException { -this(null, USER_HOME, null); -} - -/** - * Creates a new VFSBrowser Note that this version of the constructor - * must be used when a custom root folder (that may include a completely - * different URI scheme) has to be set. - * - * @param manager The virtual file system we're going to manage. - * @param rootFolder The root folder full name. - * @param homeFolder The default home folder full name. - * @throws FileSystemException if there are problems. - */ -public VFSBrowser(FileSystemManager manager, URI rootFolder, URI homeFolder) throws FileSystemException { -this(manager, -rootFolder == null ? null : rootFolder.toString(), -homeFolder == null ? null : homeFolder.toString()); -} - -/** - * Creates a new VFSBrowser Note that this version of the constructor - * must be used when a custom root folder has to be set. - * - * @param manager The virtual file system we're going to manage. - * @param rootFolder The root folder full name. - * @param homeFolder The home folder full name. - * @throws FileSystemException if there are problems. - */ -public VFSBrowser(FileSystemManager manager, String rootFolder, String homeFolder) throws FileSystemException { -Utils.checkNull(rootFolder, "Root folder"); - -// Note: these methods all could trigger events, but since we're -// in the constructor and the skin isn't set yet, there will not -// be any listeners registered yet -setManager(manager); -setRootDirectory(rootFolder); -setHomeDirectory(homeFolder == null ? USER_HOME.toString() : homeFolder); - -installSkin(VFSBrowser.class); -} - -/** - * @return The current file system manager. -
svn commit: r1913470 [1/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Author: smartini Date: Tue Oct 31 19:15:47 2023 New Revision: 1913470 URL: http://svn.apache.org/viewvc?rev=1913470=rev Log: update properties of files, as required by checks for release Modified: pivot/trunk/StyleChecks.java (props changed) pivot/trunk/charts/src/org/apache/pivot/charts/DialView.java (props changed) pivot/trunk/charts/src/org/apache/pivot/charts/HistogramView.java (contents, props changed) pivot/trunk/charts/src/org/apache/pivot/charts/MeterView.java (props changed) pivot/trunk/charts/src/org/apache/pivot/charts/PolarChartView.java (contents, props changed) pivot/trunk/charts/src/org/apache/pivot/charts/SingleValueChartView.java (props changed) pivot/trunk/charts/src/org/apache/pivot/charts/SpiderWebView.java (contents, props changed) pivot/trunk/charts/src/org/apache/pivot/charts/ThermometerView.java (props changed) pivot/trunk/charts/src/org/apache/pivot/charts/content/HistogramSeries.java (contents, props changed) pivot/trunk/charts/src/org/apache/pivot/charts/content/ValueMarker.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/annotations/UnsupportedOperation.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/annotations/package.html (props changed) pivot/trunk/core/src/org/apache/pivot/collections/ReadOnlySequence.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Function0.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Function1.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Function2.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Function3.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/FunctionN.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Predicate.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Procedure0.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Procedure1.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Procedure2.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/Procedure3.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/ProcedureN.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/functions/package.html (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html (contents, props changed) pivot/trunk/core/src/org/apache/pivot/functional/package.html (contents, props changed) pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/text/AttributedStringCharacterIterator.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/text/CompositeIterator.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/util/BooleanResult.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/util/ClassUtils.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/util/Constants.java (contents, props changed) pivot/trunk/core/src/org/apache/pivot/util/ExceptionUtils.java (props changed) pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java (contents, props changed)
svn commit: r1913470 [18/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowserSheetListener.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowserSheetListener.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowserSheetListener.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/VFSBrowserSheetListener.java Tue Oct 31 19:15:47 2023 @@ -1,171 +1,171 @@ -/* - * 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.pivot.wtk; - -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemManager; -import org.apache.pivot.collections.Sequence; -import org.apache.pivot.util.Filter; -import org.apache.pivot.util.ListenerList; - -/** - * Commons VFS browser sheet listener interface. - */ -public interface VFSBrowserSheetListener { -/** - * VFS Browser sheet listeners. - */ -public static class Listeners extends ListenerList -implements VFSBrowserSheetListener { -@Override -public void managerChanged(VFSBrowserSheet fileBrowserSheet, -FileSystemManager previousManager) { -forEach(listener -> listener.managerChanged(fileBrowserSheet, previousManager)); -} - -@Override -public void modeChanged(VFSBrowserSheet fileBrowserSheet, VFSBrowserSheet.Mode previousMode) { -forEach(listener -> listener.modeChanged(fileBrowserSheet, previousMode)); -} - -@Override -public void rootDirectoryChanged(VFSBrowserSheet fileBrowserSheet, -FileObject previousRootDirectory) { -forEach(listener -> listener.rootDirectoryChanged(fileBrowserSheet, previousRootDirectory)); -} - -@Override -public void homeDirectoryChanged(VFSBrowserSheet fileBrowserSheet, -FileObject previousHomeDirectory) { -forEach(listener -> listener.homeDirectoryChanged(fileBrowserSheet, previousHomeDirectory)); -} - -@Override -public void selectedFilesChanged(VFSBrowserSheet fileBrowserSheet, -Sequence previousSelectedFiles) { -forEach(listener -> listener.selectedFilesChanged(fileBrowserSheet, previousSelectedFiles)); -} - -@Override -public void disabledFileFilterChanged(VFSBrowserSheet fileBrowserSheet, -Filter previousDisabledFileFilter) { -forEach(listener -> listener.disabledFileFilterChanged(fileBrowserSheet, previousDisabledFileFilter)); -} -} - -/** - * Commons VFS browser sheet listener adapter. - * @deprecated Since 2.1 and Java 8 the interface itself has default implementations. - */ -@Deprecated -public static class Adapter implements VFSBrowserSheetListener { -@Override -public void managerChanged(VFSBrowserSheet fileBrowserSheet, -FileSystemManager previousManager) { -// empty block -} - -@Override -public void modeChanged(VFSBrowserSheet fileBrowserSheet, VFSBrowserSheet.Mode previousMode) { -// empty block -} - -@Override -public void rootDirectoryChanged(VFSBrowserSheet fileBrowserSheet, -FileObject previousRootDirectory) { -// empty block -} - -@Override -public void homeDirectoryChanged(VFSBrowserSheet fileBrowserSheet, -FileObject previousHomeDirectory) { -// empty block -} - -@Override -public void selectedFilesChanged(VFSBrowserSheet fileBrowserSheet, -Sequence previousSelectedFiles) { -// empty block -} - -@Override -public void disabledFileFilterChanged(VFSBrowserSheet fileBrowserSheet, -Filter previousDisabledFileFilter) { -// empty block -} -} - -/** - * Called when a file browser's file system manager has changed (as when - * browsing into a new virtual file system). - * - * @param fileBrowserSheet The source of this event. - * @param previousManager The previous file manager
svn commit: r1913470 [4/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java Tue Oct 31 19:15:47 2023 @@ -1,179 +1,179 @@ -/* - * 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.pivot.util; - -import org.apache.pivot.text.CharSpan; - -/** - * A set of static methods that perform various character-based operations. - */ -public final class CharUtils { -/** - * Private constructor for a utility class. - */ -private CharUtils() { -} - -/** - * @return Whether the given character is one of the line-ending chars. - * @param ch The character to check. - */ -private static boolean isLineEnding(final char ch) { -return (ch == '\r' || ch == '\n'); -} - -/** - * Return a {@link CharSpan} describing a "word" which contains the given - * starting location in the character sequence. - * "Words" are defined as sequences of "Unicode Identifier Part" characters - * or single characters that are not part of this class (and are not whitespace). - * - * @param sequence The sequence of characters to examine. - * @param start The starting location from which to get a "word" selection. - * @return The {@link CharSpan} (start and length) that describes the selected - * word around the given starting point, or {@code null} if a word selection - * cannot be made (which could be because the input sequence is {@code null}). - */ -public static CharSpan selectWord(final CharSequence sequence, final int start) { -int length = sequence.length(); - -if (sequence == null || length == 0) { -return null; -} - -int adjustedStart = start; - -// Adjust the start position to put it within the sequence length -// and skip any trailing line endings at that point -if (adjustedStart >= length) { -adjustedStart = length - 1; -if (adjustedStart < 0) { -return null; -} -while (isLineEnding(sequence.charAt(adjustedStart))) { -adjustedStart--; -} -} -if (adjustedStart < 0) { -return null; -} - -int selectionStart = adjustedStart; -int selectionLength = 1; -char ch = sequence.charAt(selectionStart); -if (Character.isWhitespace(ch)) { -// Move backward to beginning of whitespace block -// but not before the beginning of the text. -do { -selectionStart--; -} while (selectionStart >= 0 -&& Character.isWhitespace(sequence.charAt(selectionStart))); -selectionStart++; -selectionLength = start - selectionStart; - -// Move forward to end of whitespace block -// but not past the end of the text. -do { -selectionLength++; -} while (selectionStart + selectionLength < length -&& Character.isWhitespace(sequence.charAt(selectionStart + selectionLength))); -} else if (Character.isUnicodeIdentifierPart(ch)) { -// Move backward to beginning of identifier block -do { -selectionStart--; -} while (selectionStart >= 0 -&& Character.isUnicodeIdentifierPart(sequence.charAt(selectionStart))); -selectionStart++; -selectionLength = adjustedStart - selectionStart; - -// Move forward to end of identifier block -// but not past end of text. -do { -selectionLength++; -} while (selectionStart + selectionLength < length -&& Character.isUnicodeIdentifierPart(sequence.charAt(selectionStart -+ selectionLength))); -} else { -return null; -} - -
svn commit: r1913470 [13/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java Tue Oct 31 19:15:47 2023 @@ -1,1530 +1,1530 @@ -/* - * 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.pivot.wtk.skin.terra; - -import java.io.IOException; -import java.io.Serializable; -import java.text.DateFormat; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; - -import org.apache.commons.vfs2.FileFilter; -import org.apache.commons.vfs2.FileName; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSelectInfo; -import org.apache.commons.vfs2.FileSelector; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileSystemManager; -import org.apache.commons.vfs2.FileType; -import org.apache.pivot.beans.BXML; -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.ArrayList; -import org.apache.pivot.collections.Dictionary; -import org.apache.pivot.collections.List; -import org.apache.pivot.collections.Sequence; -import org.apache.pivot.serialization.SerializationException; -import org.apache.pivot.text.FileSizeFormat; -import org.apache.pivot.util.Filter; -import org.apache.pivot.util.concurrent.AbortException; -import org.apache.pivot.util.concurrent.Task; -import org.apache.pivot.util.concurrent.TaskExecutionException; -import org.apache.pivot.util.concurrent.TaskListener; -import org.apache.pivot.wtk.ActivityIndicator; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.Button; -import org.apache.pivot.wtk.ButtonPressListener; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.ComponentKeyListener; -import org.apache.pivot.wtk.ComponentMouseButtonListener; -import org.apache.pivot.wtk.ComponentTooltipListener; -import org.apache.pivot.wtk.Container; -import org.apache.pivot.wtk.Dimensions; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.FocusTraversalDirection; -import org.apache.pivot.wtk.GridPane; -import org.apache.pivot.wtk.HorizontalAlignment; -import org.apache.pivot.wtk.ImageView; -import org.apache.pivot.wtk.Insets; -import org.apache.pivot.wtk.Keyboard; -import org.apache.pivot.wtk.Keyboard.KeyCode; -import org.apache.pivot.wtk.Keyboard.KeyLocation; -import org.apache.pivot.wtk.Keyboard.Modifier; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.ListButton; -import org.apache.pivot.wtk.ListButtonSelectionListener; -import org.apache.pivot.wtk.ListView; -import org.apache.pivot.wtk.Mouse; -import org.apache.pivot.wtk.Platform; -import org.apache.pivot.wtk.Point; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.ScrollPane; -import org.apache.pivot.wtk.SortDirection; -import org.apache.pivot.wtk.Span; -import org.apache.pivot.wtk.StackPane; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.TableView; -import org.apache.pivot.wtk.TableViewSelectionListener; -import org.apache.pivot.wtk.TableViewSortListener; -import org.apache.pivot.wtk.TaskAdapter; -import org.apache.pivot.wtk.TextArea; -import org.apache.pivot.wtk.TextInput; -import org.apache.pivot.wtk.TextInputContentListener; -import org.apache.pivot.wtk.Tooltip; -import org.apache.pivot.wtk.VFSBrowser; -import org.apache.pivot.wtk.VerticalAlignment; -import org.apache.pivot.wtk.media.Image; -import org.apache.pivot.wtk.skin.VFSBrowserSkin; - -/** - * Terra Commons VFS browser skin. - */ -public class TerraVFSBrowserSkin extends VFSBrowserSkin { - -/** - * Abstract renderer for displaying file system contents. - */ -public abstract static class FileRenderer extends BoxPane { -protected ImageView imageView = new ImageView(); -protected Label label = new Label(); -protected VFSBrowser fileBrowser = null; - -
svn commit: r1913470 [9/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java Tue Oct 31 19:15:47 2023 @@ -1,155 +1,155 @@ -/* - * 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.pivot.tests.issues.pivot894; - -import java.awt.EventQueue; -import java.io.File; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.Map; -import org.apache.pivot.util.concurrent.TaskExecutionException; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.ApplicationContext; -import org.apache.pivot.wtk.CardPane; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.GridPane; -import org.apache.pivot.wtk.GridPane.Row; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.Window; -import org.apache.pivot.wtk.content.ButtonData; -import org.apache.pivot.wtk.media.Image; -import org.apache.pivot.wtk.skin.CardPaneSkin; - -public class Pivot894 implements Application { -// global counter, just to know how many iterations the application is doing -static int num = 0; - -@Override -public void startup(Display display, Map properties) throws Exception { -System.out.println("public startup(...)"); -System.out.println("\n" -+ "Attention: now the application will go in an infinite loop, to be able to see the memory leak.\n" -+ "Note that probably you'll have to kill the application from outside (kill the Java process).\n" -+ "\n"); - -// add some sleep to let users see the warning messages in console ... -Thread.sleep(2000); - -final CardPane cardPane = new CardPane(); -cardPane.putStyle(Style.selectionChangeEffect, -CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE); - -final Window window = new Window(cardPane); -window.open(display); - -ApplicationContext.scheduleRecurringCallback(new Runnable() { -@Override -public void run() { -Thread.currentThread().setName("switcher-thread"); - -System.out.println("Run num " + num++); // temp - -/* - * // // method 1: // // Seems to be working just fine final - * GridPane grid = new GridPane(3); - * grid.getRows().add(createGridRow()); - * grid.getRows().add(createGridRow()); - * grid.getRows().add(createGridRow()); - */ - -// -// method 2: -// -try { -// Before the fixes for PIVOT-861 (part two) it was causing -// out of memory ... -// -// Note that this has been moved to another issue, but the -// problem is due to the usage -// of dataRenderer tags (and then instancing -// ButtonDataRenderer) in the loaded bxml, -// so probably even this test will be updated ... -// -final GridPane grid = (GridPane) new BXMLSerializer().readObject( -Pivot894.class, "btn_grid.bxml"); - -EventQueue.invokeLater(new Runnable() { -@Override -public void run() { -Iterator iterator = cardPane.iterator(); -List componentList = new ArrayList<>(); -while (iterator.hasNext()) { -
svn commit: r1913470 [14/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Propchange: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.java -- svn:eol-style = native Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.json URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.json?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.json (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.json Tue Oct 31 19:15:47 2023 @@ -1,27 +1,27 @@ -/* - * 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. - */ -{ selectDrive: "Select drive", -goTo: "Go to a folder", -goUp: "Go up a folder", -newFolder: "Create new folder", -goHome: "Go to home folder", -search: "search", -searchFor: "Search for files", -fileName: "File", -size: "Size", -lastModified: "Modified" -} +/* + * 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. + */ +{ selectDrive: "Select drive", +goTo: "Go to a folder", +goUp: "Go up a folder", +newFolder: "Create new folder", +goHome: "Go to home folder", +search: "search", +searchFor: "Search for files", +fileName: "File", +size: "Size", +lastModified: "Modified" +} Propchange: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin.json -- svn:eol-style = native Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin_cs.json URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin_cs.json?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin_cs.json (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSkin_cs.json Tue Oct 31 19:15:47 2023 @@ -1,27 +1,27 @@ -/* - * 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. - */ -{ selectDrive: "Vybrat jednotku", -goTo: "PÅejÃt do složky", -goUp: "O úroveÅ výš", -newFolder: "VytvoÅit novou složku", -goHome: "Domovská složka", -search: "hledat", -searchFor: "Hledat soubor", -fileName: "Soubor", -size: "Velikost", -lastModified: "ZmÄnÄno" -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license
svn commit: r1913470 [20/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/coll
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigDecimalValidator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigDecimalValidator.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigDecimalValidator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigDecimalValidator.java Tue Oct 31 19:15:47 2023 @@ -1,32 +1,32 @@ -/* - * 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. - */ -package org.apache.pivot.wtk.validation; - -import java.math.BigDecimal; -import java.util.Locale; - -/** - * A validator for a BigDecimal value. - */ -public class BigDecimalValidator extends ComparableValidator { - -public BigDecimalValidator() { -super(); -} - -public BigDecimalValidator(Locale locale) { -super(locale); -} - -} +/* + * 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. + */ +package org.apache.pivot.wtk.validation; + +import java.math.BigDecimal; +import java.util.Locale; + +/** + * A validator for a BigDecimal value. + */ +public class BigDecimalValidator extends ComparableValidator { + +public BigDecimalValidator() { +super(); +} + +public BigDecimalValidator(Locale locale) { +super(locale); +} + +} Propchange: pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigDecimalValidator.java -- svn:eol-style = native Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigIntegerValidator.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigIntegerValidator.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigIntegerValidator.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/BigIntegerValidator.java Tue Oct 31 19:15:47 2023 @@ -1,32 +1,32 @@ -/* - * 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. - */ -package org.apache.pivot.wtk.validation; - -import java.math.BigInteger; -import java.util.Locale; - -/** - * A validator for a BigInteger value. - */ -public class BigIntegerValidator extends ComparableValidator { - -public BigIntegerValidator() { -super(); -} - -public BigIntegerValidator(Locale locale) { -super(locale); -} - -} +/* + * 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. + */ +package org.apache.pivot.wtk.validation; + +import java.math.BigInteger; +import java.util.Locale; + +/** + * A validator for a BigInteger value. + */ +public class BigIntegerValidator extends ComparableValidator { + +public BigIntegerValidator() { +super(); +} + +public BigIntegerValidator(Locale locale) { +
svn commit: r1913470 [2/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java (original) +++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java Tue Oct 31 19:15:47 2023 @@ -1,86 +1,86 @@ -/* - * 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.pivot.functional.monad; - -/** - * Generic container, to hold the unsuccessful result of a computation (a RuntimeException). - */ -public class Failure extends Try { -protected final RuntimeException value; - -/** - * Default constructor, do not use because it set null as invariant value to hold. - */ -public Failure() { -value = new IllegalArgumentException("failure exception set to null."); -} - -/** - * Constructor with a value to set. - * @param val the RuntimeException to set - */ -public Failure(final RuntimeException val) { -this.value = val; -} - -@Override -public final boolean isSuccess() { -return false; -} - -@Override -public final T getValue() { -throw value; -} - -@Override -public String toString() { -return "Failure(" + ((value != null) ? value.toString() : "null") + ")"; -} - -@Override -public int hashCode() { -final int prime = 31; -int result = 1; -result = prime * result + ((value == null) ? 0 : value.hashCode()); -return result; -} - -@SuppressWarnings("rawtypes") -@Override -public boolean equals(Object obj) { -if (this == obj) { -return true; -} -if (obj == null) { -return false; -} -if (!(obj instanceof Failure)) { -return false; -} -Failure other = (Failure) obj; -if (value == null) { -if (other.value != null) { -return false; -} -} else if (!value.equals(other.value)) { -return false; -} -return true; -} - -} +/* + * 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.pivot.functional.monad; + +/** + * Generic container, to hold the unsuccessful result of a computation (a RuntimeException). + */ +public class Failure extends Try { +protected final RuntimeException value; + +/** + * Default constructor, do not use because it set null as invariant value to hold. + */ +public Failure() { +value = new IllegalArgumentException("failure exception set to null."); +} + +/** + * Constructor with a value to set. + * @param val the RuntimeException to set + */ +public Failure(final RuntimeException val) { +this.value = val; +} + +@Override +public final boolean isSuccess() { +return false; +} + +@Override +public final T getValue() { +throw value; +} + +@Override +public String toString() { +return "Failure(" + ((value != null) ? value.toString() : "null") + ")"; +} + +@Override +public int hashCode() { +final int prime = 31; +int result = 1; +result = prime * result + ((value == null) ? 0 :
svn commit: r1913470 [6/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/core/test/org/apache/pivot/functional/monad/test/TryTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/functional/monad/test/TryTest.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/core/test/org/apache/pivot/functional/monad/test/TryTest.java (original) +++ pivot/trunk/core/test/org/apache/pivot/functional/monad/test/TryTest.java Tue Oct 31 19:15:47 2023 @@ -1,343 +1,343 @@ -/* - * 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.pivot.functional.monad.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.Iterator; -import java.util.Random; - -import org.apache.pivot.functional.monad.Failure; -import org.apache.pivot.functional.monad.None; -import org.apache.pivot.functional.monad.Option; -import org.apache.pivot.functional.monad.Some; -import org.apache.pivot.functional.monad.Success; -import org.apache.pivot.functional.monad.Try; -import org.apache.pivot.functional.monad.TryCompanion; -import org.junit.Test; - -public class TryTest { -@Test -public void companionTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); -} - -@Test -public void companionNullTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); - -Try tn = t.fromValue(null); -assertNotNull(tn); -assertTrue(tn instanceof Success); -assertTrue(tn.isSuccess()); -Object tnValue = tn.getValue(); -assertNull(tnValue); -System.out.println("companionNullTest(), value stored is " + tnValue); -} - -@Test -public void companionObjectTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); - -Try to = t.fromValue(new String("Hello")); -assertNotNull(to); -assertTrue(to instanceof Success); -assertTrue(to.isSuccess()); -Object toValue = to.getValue(); -assertNotNull(toValue); -assertTrue(toValue instanceof String); -assertEquals(toValue, "Hello"); -System.out.println("companionObjectTest(), value stored is " + toValue); -} - -@Test -public void companionStringTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); - -Try ts = t.fromValue("Hello"); -assertNotNull(ts); -assertTrue(ts instanceof Success); -assertTrue(ts.isSuccess()); -String tsValue = ts.getValue(); -assertNotNull(tsValue); -// assertTrue(tsValue instanceof String); // unnecessary -assertEquals(tsValue, "Hello"); -System.out.println("companionStringTest(), value stored is " + tsValue); -} - -@Test -public void companionFailureTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); - -RuntimeException re = new IllegalArgumentException("Sample RuntimeException"); -Try tf = t.fromValue(re); -assertNotNull(tf); -assertTrue(tf instanceof Failure); -assertFalse(tf.isSuccess()); -try { -String tfValue = tf.getValue(); // this will throw the RuntimeException stored inside the Failure -assertNotNull(tfValue); // never called -} catch (RuntimeException e) { -System.err.println("companionFailureTest(), value stored is " + e); -assertNotNull(e); // unnecessary - -} -} - -@Test -public void companionRealUsageRandomTest() { -TryCompanion t = TryCompanion.getInstance(); -assertNotNull(t); - -Try ts = null; -String value; - -// randomizing this test -Random randomGenerator = new Random(); -int randomInt = randomGenerator.nextInt(100); - -// store the value (or the RuntimeException) in the Try instance -try { -// randomizing this test: -// for even
svn commit: r1913470 [5/21] - in /pivot/trunk: ./ charts/src/org/apache/pivot/charts/ charts/src/org/apache/pivot/charts/content/ core/src/org/apache/pivot/annotations/ core/src/org/apache/pivot/colle
Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1913470=1913469=1913470=diff == --- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original) +++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Tue Oct 31 19:15:47 2023 @@ -1,454 +1,454 @@ -/* - * 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.pivot.util; - -/** - * Utility methods for other parts of the code. - */ -public final class Utils { -/** - * Non-public constructor for a utility class. - */ -private Utils() { -} - -/** - * Decide if two strings are the same content (not just the same reference). - * Works properly for either string being {@code null}. - * @param s1 First string to compare (can be {@code null}). - * @param s2 Second string to compare (can also be {@code null}). - * @return {@code true} if both strings are {@code null} or if - * s1.equals(s2). - */ -public static boolean stringsAreEqual(final String s1, final String s2) { -if (s1 == null && s2 == null) { -return true; -} -if ((s1 != null && s2 == null) || (s1 == null && s2 != null)) { -return false; -} -return s1.equals(s2); -} - -/** - * Does an "equals" check, taking care that null object references are handled - * appropriately. - * - * @param obj1 The first object to compare (could be {@code null}). - * @param obj2 The second object to compare (could be {@code null}). - * @return {@code true} if the two objects are non-null and equal (according - * to their {@code Object#equals} method), or are both {@code null}. - */ -public static boolean equals(final Object obj1, final Object obj2) { -if (obj1 != null && obj2 != null) { -return obj1.equals(obj2); -} else if (obj1 == null && obj2 == null) { -return true; -} -return false; -} - -/** - * Check if the input argument is {@code null} and throw an - * {@link IllegalArgumentException} if so, with an optional - * message derived from the given string. - * - * @param value The argument value to check for {@code null}. - * @param description A description for the value used to - * construct a message like {@code "xxx must not be null."}. Can be - * {@code null} or an empty string, in which case a plain - * {@link IllegalArgumentException} is thrown without any detail message. - * @throws IllegalArgumentException if the value is {@code null}. - */ -public static void checkNull(final Object value, final String description) { -if (value == null) { -if (isNullOrEmpty(description)) { -throw new IllegalArgumentException(); -} else { -throw new IllegalArgumentException(description + " must not be null."); -} -} -} - -/** - * Check if the input argument is {@code null} and throw an - * {@link IllegalArgumentException} with an empty message if so. - * - * @param value The argument value to check for {@code null}. - * @throws IllegalArgumentException if the value is {@code null}. - */ -public static void checkNull(final Object value) { -checkNull(value, null); -} - -/** - * Check if the input string is {@code null} or empty (or all whitespace). - * - * @param value The string to check. - * @return {@code true} if the input is {@code null} or empty, {@code false} - * otherwise. - */ -public static boolean isNullOrEmpty(final String value) { -if (value == null) { -return true; -} -return value.trim().isEmpty(); -} - -/** - * Check if the input value is {@code null} or if it is a string and is empty - * (or all whitespace). - * - * @param value The object to check. - * @return {@code true} if the input is {@code null} or an empty string, - * {@code false}