1 23 24 package com.sun.enterprise.admin.common; 25 26 import java.io.Serializable ; 28 29 32 33 public class OperationProgress implements Serializable 34 { 35 36 public static final long serialVersionUID = -5562129808433683519L; 37 38 private boolean mIsFinished = false; 39 private String mMessage = null; 40 private int mPercentage = 0; 41 42 public OperationProgress() 43 { 44 mIsFinished = false; 45 mPercentage = 0; 46 mMessage = "STARTED"; } 48 51 public OperationProgress (int percentage, String message) 52 { 53 if (percentage < 0 || percentage > 100) 54 { 55 throw new IllegalArgumentException (); 56 } 57 if (percentage == 100) 58 { 59 mIsFinished = true; 60 } 61 mPercentage = percentage; 62 mMessage = message; 63 } 64 65 70 71 public int getPercentage() 72 { 73 return ( mPercentage ); 74 } 75 76 79 80 public boolean isFinished() 81 { 82 return ( mIsFinished ); 83 } 84 85 91 public String getMessage() 92 { 93 return ( mMessage ); 94 } 95 96 103 104 public void setPercentage(int percentage) 105 { 106 if (percentage < 0 || percentage > 100) 107 { 108 throw new IllegalArgumentException (); 109 } 110 mPercentage = percentage; 111 if (percentage == 100) 112 { 113 mIsFinished = true; 114 } 115 } 116 117 123 public void setIsFinished(boolean finished) 124 { 125 mIsFinished = finished; 126 if (finished) 127 { 128 setPercentage(100); 129 } 130 } 131 } | Popular Tags |