1 /* 2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.awt.shell; 27 28 import javax.swing.*; 29 import java.util.Comparator; 30 31 public class ShellFolderColumnInfo { 32 private String title; 33 private Integer width; 34 private boolean visible; 35 /** 36 * Allowed values are {@link SwingConstants#LEFT}, {@link SwingConstants#RIGHT}, {@link SwingConstants#LEADING}, 37 * {@link SwingConstants#TRAILING}, {@link SwingConstants#CENTER} 38 */ 39 private Integer alignment; 40 private SortOrder sortOrder; 41 private Comparator<?> comparator; 42 /** 43 * <code>false</code> (default) if the {@link comparator} expects folders as arguments, 44 * and <code>true</code> if folder's column values. The first option is used default for comparison 45 * on Windows and also for separating files from directories when sorting using 46 * ShellFolderManager's inner comparator. 47 */ 48 private boolean compareByColumn; 49 50 public ShellFolderColumnInfo(String title, Integer width, 51 Integer alignment, boolean visible, 52 SortOrder sortOrder, Comparator<?> comparator, 53 boolean compareByColumn) { 54 this.title = title; 55 this.width = width; 56 this.alignment = alignment; 57 this.visible = visible; 58 this.sortOrder = sortOrder; 59 this.comparator = comparator; 60 this.compareByColumn = compareByColumn; 61 } 62 63 public ShellFolderColumnInfo(String title, Integer width, 64 Integer alignment, boolean visible, 65 SortOrder sortOrder, Comparator<?> comparator) { 66 this(title, width, alignment, visible, sortOrder, comparator, false); 67 } 68 69 /** 70 * This constructor is used by native code when getting column set for 71 * a folder under Windows 72 */ 73 public ShellFolderColumnInfo(String title, int width, int alignment, 74 boolean visible) { 75 this(title, width, alignment, visible, null, null); 76 } 77 78 public String getTitle() { 79 return title; 80 } 81 82 public void setTitle(String title) { 83 this.title = title; 84 } 85 86 public Integer getWidth() { 87 return width; 88 } 89 90 public void setWidth(Integer width) { 91 this.width = width; 92 } 93 94 public Integer getAlignment() { 95 return alignment; 96 } 97 98 public void setAlignment(Integer alignment) { 99 this.alignment = alignment; 100 } 101 102 public boolean isVisible() { 103 return visible; 104 } 105 106 public void setVisible(boolean visible) { 107 this.visible = visible; 108 } 109 110 public SortOrder getSortOrder() { 111 return sortOrder; 112 } 113 114 public void setSortOrder(SortOrder sortOrder) { 115 this.sortOrder = sortOrder; 116 } 117 118 public Comparator<?> getComparator() { 119 return comparator; 120 } 121 122 public void setComparator(Comparator<?> comparator) { 123 this.comparator = comparator; 124 } 125 126 public boolean isCompareByColumn() { 127 return compareByColumn; 128 } 129 130 public void setCompareByColumn(boolean compareByColumn) { 131 this.compareByColumn = compareByColumn; 132 } 133 }