1 19 20 package org.netbeans.api.progress; 21 22 import javax.swing.Action ; 23 import javax.swing.JComponent ; 24 import javax.swing.JLabel ; 25 import org.netbeans.progress.spi.InternalHandle; 26 import org.openide.util.Cancellable; 27 28 34 public final class ProgressHandleFactory { 35 36 37 private ProgressHandleFactory() { 38 } 39 40 45 public static ProgressHandle createHandle(String displayName) { 46 return createHandle(displayName, null, null); 47 } 48 49 57 public static ProgressHandle createHandle(String displayName, Cancellable allowToCancel) { 58 return createHandle(displayName, allowToCancel, null); 59 } 60 61 69 public static ProgressHandle createHandle(String displayName, Action linkOutput) { 70 return createHandle(displayName, null, linkOutput); 71 } 72 73 84 public static ProgressHandle createHandle(String displayName, Cancellable allowToCancel, Action linkOutput) { 85 return new ProgressHandle(new InternalHandle(displayName, allowToCancel, true, linkOutput)); 86 } 87 88 93 public static JComponent createProgressComponent(ProgressHandle handle) { 94 return handle.extractComponent(); 95 } 96 97 103 public static JLabel createMainLabelComponent(ProgressHandle handle) { 104 return handle.extractMainLabel(); 105 } 106 107 113 public static JLabel createDetailLabelComponent(ProgressHandle handle) { 114 return handle.extractDetailLabel(); 115 } 116 117 123 public static ProgressHandle createSystemHandle(String displayName) { 124 return createSystemHandle(displayName, null); 125 } 126 127 136 public static ProgressHandle createSystemHandle(String displayName, Cancellable allowToCancel) { 137 return new ProgressHandle(new InternalHandle(displayName, allowToCancel, false, null)); 138 } 139 140 151 public static ProgressHandle createSystemHandle(String displayName, Cancellable allowToCancel, Action linkOutput) { 152 return new ProgressHandle(new InternalHandle(displayName, allowToCancel, false, linkOutput)); 153 } 154 155 } 156 | Popular Tags |