package yukihane.inqubus.model;
-import java.util.ArrayList;
-import java.util.List;
-import yukihane.inqubus.manager.Request;
import yukihane.inqubus.manager.RequestProcess;
import yukihane.inqubus.manager.TaskKind;
import yukihane.inqubus.manager.TaskStatus;
public class Target {
private final RequestProcess requestProcess;
- private final List<Request> requests = new ArrayList<>(1);
private Progress progress;
public Target(RequestProcess rp) {
this.requestProcess = rp;
- this.requests.add(rp);
}
- public void add(Request request) {
- requests.add(request);
- }
-
- public RequestProcess getRequestProcess() {
- return requestProcess;
+ public int getRowId() {
+ return requestProcess.getRowId();
}
String getVideoId() {
text = message;
}
progress = new Progress(p, text);
+ }
+ private RequestProcess getRequestProcess() {
+ return requestProcess;
}
}
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(TargetsTableModel.class.getName());
private final List<Target> targets = new ArrayList<Target>();
+ private static final int STATUS_CLOMN = 4;
private final String[] columnNames = new String[]{"ID", "動画", "コメ", "変換", "状態"};
private final Class<?>[] columnClasses = new Class<?>[]{String.class, Boolean.class, Boolean.class, Boolean.class,
Progress.class};
break;
case 4:
res = t.getProgress();
+ break;
default:
throw new IllegalArgumentException();
}
return res;
}
- @Override
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
public void addTarget(Collection<Target> t) {
int before = targets.size();
targets.addAll(t);
int pos = -1;
for (int i = 0; i < targets.size(); i++) {
final Target t = targets.get(i);
- final int ri = t.getRequestProcess().getRowId();
+ final int ri = t.getRowId();
if (id == ri) {
pos = i;
break;
final Target t = targets.get(pos);
t.setProgress(taskKind, taskStatus, percent, status);
-
+ fireTableCellUpdated(pos, STATUS_CLOMN);
}
}