Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jul 12, 2006
1 parent d8080b5 commit 3c1f871
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
35 changes: 14 additions & 21 deletions source/ch/cyberduck/ui/cocoa/CDProgressController.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
public class CDProgressController extends CDController {
private static Logger log = Logger.getLogger(CDProgressController.class);

private String statusText;

private NSTimer progressTimer;

private static NSMutableParagraphStyle lineBreakByTruncatingMiddleParagraph = new NSMutableParagraphStyle();
Expand Down Expand Up @@ -69,7 +67,7 @@ public CDProgressController(final Queue queue) {
/**
* Remove any error messages
*/
public void clear() {
public void closeErrorMessages() {
for(Iterator i = errors.iterator(); i.hasNext(); ) {
((CDErrorController)i.next()).close(null);
}
Expand All @@ -85,7 +83,7 @@ private void init() {
public void queueStarted() {
invoke(new Runnable() {
public void run() {
clear();
closeErrorMessages();
progressBar.setHidden(false);
progressBar.setIndeterminate(true);
progressBar.startAnimation(null);
Expand All @@ -96,8 +94,7 @@ public void run() {
public void message(final String message) {
invoke(new Runnable() {
public void run() {
statusText = message;
progressField.setAttributedStringValue(new NSAttributedString(getProgressText(),
progressField.setAttributedStringValue(new NSAttributedString(getProgressText(message),
TRUNCATE_MIDDLE_PARAGRAPH_DICTIONARY));
progressField.display();
}
Expand Down Expand Up @@ -150,12 +147,18 @@ public void transferStopped(final Path path) {
public void awakeFromNib() {
this.filenameField.setAttributedStringValue(new NSAttributedString(this.queue.getName(),
TRUNCATE_TAIL_PARAGRAPH_DICTIONARY));
this.progressField.setAttributedStringValue(new NSAttributedString(this.getProgressText(),
this.progressField.setAttributedStringValue(new NSAttributedString(
this.getProgressText(this.progressField.stringValue()),
TRUNCATE_MIDDLE_PARAGRAPH_DICTIONARY));
}

/**
* Called from the main run loop using a NSTimer #progressTimer
* @param t
*/
public void update(final NSTimer t) {
this.progressField.setAttributedStringValue(new NSAttributedString(this.getProgressText(),
this.progressField.setAttributedStringValue(new NSAttributedString(
this.getProgressText(this.progressField.stringValue()),
TRUNCATE_MIDDLE_PARAGRAPH_DICTIONARY));
if(queue.isInitialized()) {
if(queue.getSize() != -1) {
Expand Down Expand Up @@ -206,7 +209,7 @@ public double getBytesTransfered() {
private static final String SEC_REMAINING = NSBundle.localizedString("seconds remaining", "Status", "");
private static final String MIN_REMAINING = NSBundle.localizedString("minutes remaining", "Status", "");

private String getProgressText() {
private String getProgressText(String message) {
StringBuffer b = new StringBuffer();
b.append(Status.getSizeAsString(this.queue.getCurrent()));
b.append(" ");
Expand All @@ -228,9 +231,9 @@ private String getProgressText() {
b.append(")");
}
}
if(statusText != null) {
if(message != null) {
b.append(" - ");
b.append(this.statusText);
b.append(message);
}
return b.toString();
}
Expand Down Expand Up @@ -331,14 +334,4 @@ public void setProgressView(final NSView v) {
public NSView view() {
return this.progressView;
}

protected void invalidate() {
this.progressView = null;
this.progressField = null;
this.progressBar = null;
this.progressTimer = null;
this.filenameField = null;
this.queue = null;
super.invalidate();
}
}
20 changes: 16 additions & 4 deletions source/ch/cyberduck/ui/cocoa/CDQueueController.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,15 @@ public String tableViewToolTipForCell(NSTableView view, NSCell cell, NSMutableRe
}

/**
*
* You should implement this method if your table supports varying row heights.
* The height returned should not include intercell spacing and must be greater
* than zero.
* Although NSTableViews may cache the returned values, you should ensure
* that this method is efficient. When you change a row's height you must
* invalidate the existing row height by calling noteHeightOfRowsWithIndexesChanged.
* NSTableView automatically invalidates its entire row height cache when
* reloadData and noteNumberOfRowsChanged are called.
* TODO: ONLY CALLED FOR 10.4 OR LATER
* @param view
* @param i
* @return The height of the particular view in this row
Expand All @@ -240,7 +248,7 @@ public float tableViewHeightOfRow(NSTableView view, int i) {
final CDProgressController c = queueModel.getController(i);
if(null == c) {
log.warn("No progress controller at index "+i);
return 0;
return 1;
}
return c.view().frame().size().height();
}
Expand Down Expand Up @@ -445,7 +453,11 @@ public void run() {
}
}
if(Preferences.instance().getBoolean("queue.removeItemWhenComplete")) {
removeItem(queue);
invoke(new Runnable() {
public void run() {
removeItem(queue);
}
});
}
}
if(queue.getSession() instanceof ch.cyberduck.core.sftp.SFTPSession) {
Expand Down Expand Up @@ -689,7 +701,7 @@ public void deleteButtonClicked(final Object sender) {
public void clearButtonClicked(final Object sender) {
for(int i = 0; i < this.queueModel.size(); i++) {
CDProgressController c = this.queueModel.getController(i);
c.clear();
c.closeErrorMessages();
if(!c.getQueue().isRunning() && c.getQueue().isComplete()) {
this.queueModel.remove(i);
i--;
Expand Down
4 changes: 2 additions & 2 deletions source/ch/cyberduck/ui/cocoa/CDValidatorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public List validate(final boolean resumeRequested) {
}
if (this.hasPrompt()) {
this.statusIndicator.stopAnimation(null);
this.fileTableView.reloadData();
this.setEnabled(true);
this.fireDataChanged();
this.waitForSheetEnd();
}
return this.validatedList;
Expand Down Expand Up @@ -498,7 +498,7 @@ protected void setEnabled(boolean enabled) {

protected void fireDataChanged() {
if (this.hasPrompt()) {
this.fileTableView.reloadData();
this.fileTableView.noteNumberOfRowsChanged();
}
}

Expand Down

0 comments on commit 3c1f871

Please sign in to comment.