Issue #2220 Implement Archive GUI's recompute sizes.
Change-Id: Ib80dadc33762a155d5b48bd9ae2e7cf5273f01ea Former-commit-id: 276d4fae3a5fb0fe152a62fdbb30d030096db4ca
This commit is contained in:
parent
f2b63d24b1
commit
7c8893cb7c
11 changed files with 417 additions and 280 deletions
|
@ -19,9 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.archive.data;
|
package com.raytheon.uf.viz.archive.data;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class maintains the state of the archive selection so it can be restored
|
* This class maintains the state of the archive selection so it can be restored
|
||||||
|
@ -42,7 +42,7 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ArchiveInfo {
|
public class ArchiveInfo {
|
||||||
private final Map<String, CategoryInfo> categoryInfoMap = new HashMap<String, CategoryInfo>();
|
private final Map<String, CategoryInfo> categoryInfoMap = new ConcurrentHashMap<String, CategoryInfo>();
|
||||||
|
|
||||||
public void add(CategoryInfo categoryInfo) {
|
public void add(CategoryInfo categoryInfo) {
|
||||||
categoryInfoMap.put(categoryInfo.getCategoryName(), categoryInfo);
|
categoryInfoMap.put(categoryInfo.getCategoryName(), categoryInfo);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.archive.data;
|
package com.raytheon.uf.viz.archive.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||||
|
@ -49,10 +50,10 @@ public class CategoryInfo {
|
||||||
private final String categoryName;
|
private final String categoryName;
|
||||||
|
|
||||||
/** List of display items for the category. */
|
/** List of display items for the category. */
|
||||||
private final List<DisplayData> displayDataList;
|
private final List<DisplayData> displayDataList = new ArrayList<DisplayData>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param archiveName
|
* @param archiveName
|
||||||
* @param categoryName
|
* @param categoryName
|
||||||
|
@ -62,7 +63,7 @@ public class CategoryInfo {
|
||||||
List<DisplayData> displayInfoList) {
|
List<DisplayData> displayInfoList) {
|
||||||
this.archiveName = archiveName;
|
this.archiveName = archiveName;
|
||||||
this.categoryName = categoryName;
|
this.categoryName = categoryName;
|
||||||
this.displayDataList = displayInfoList;
|
this.displayDataList.addAll(displayInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArchiveName() {
|
public String getArchiveName() {
|
||||||
|
@ -74,6 +75,6 @@ public class CategoryInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DisplayData> getDisplayDataList() {
|
public List<DisplayData> getDisplayDataList() {
|
||||||
return displayDataList;
|
return new ArrayList<DisplayData>(displayDataList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ package com.raytheon.uf.viz.archive.data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener to update file/directory information.
|
* A listener to update file/directory information.
|
||||||
*
|
*
|
||||||
|
@ -31,6 +33,7 @@ import java.util.List;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 16, 2013 1966 rferrel Initial creation
|
* May 16, 2013 1966 rferrel Initial creation
|
||||||
|
* Jul 29, 2012 #2220 rferrel Change to get all data sizes only one time.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -43,5 +46,5 @@ public interface IUpdateListener {
|
||||||
*
|
*
|
||||||
* @param dirInfos
|
* @param dirInfos
|
||||||
*/
|
*/
|
||||||
public void update(List<SizeJobRequest> request);
|
public void update(List<DisplayData> request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
@ -14,7 +17,6 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
|
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
|
||||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||||
import com.raytheon.uf.common.util.FileUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job to determine the size for a directory and its contents on a non-UI
|
* Job to determine the size for a directory and its contents on a non-UI
|
||||||
|
@ -27,6 +29,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 13, 2013 rferrel Initial creation
|
* Jun 13, 2013 rferrel Initial creation
|
||||||
|
* Jul 24, 2012 #2220 rferrel Change to get all data sizes only one time.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -35,14 +38,37 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
*/
|
*/
|
||||||
public class SizeJob extends Job {
|
public class SizeJob extends Job {
|
||||||
|
|
||||||
/** The queue for requested sizes. */
|
/**
|
||||||
private final ConcurrentLinkedQueue<SizeJobRequest> queue = new ConcurrentLinkedQueue<SizeJobRequest>();
|
* Mapping of display data by archive and category names.
|
||||||
|
*/
|
||||||
|
private final Map<String, ArchiveInfo> archiveInfoMap = new ConcurrentHashMap<String, ArchiveInfo>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pending selected entries that still need to have the sizes determined.
|
* Current archive name needing sizes.
|
||||||
|
*/
|
||||||
|
private String displayArchive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current category name needing sizes.
|
||||||
|
*/
|
||||||
|
private String displayCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true when all sizes are computed for the current display
|
||||||
|
* archive/category list.
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean displaySizesComputed = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request queue for selected data not in current display
|
||||||
*/
|
*/
|
||||||
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<DisplayData>();
|
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<DisplayData>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request queue for data not in current displayed or selected.
|
||||||
|
*/
|
||||||
|
private final ConcurrentLinkedQueue<DisplayData> backgroundQueue = new ConcurrentLinkedQueue<DisplayData>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates the job should stop computing the size of the current
|
* Indicates the job should stop computing the size of the current
|
||||||
* non-selected entry.
|
* non-selected entry.
|
||||||
|
@ -50,10 +76,30 @@ public class SizeJob extends Job {
|
||||||
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
|
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The listeners to inform when job is done with an entry.
|
* What should happen to the processing request that is being stopped.
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean requeueRequest = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true when running job should stop and never rescheduled.
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean shutdown = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The listeners to inform when job is done with a request.
|
||||||
*/
|
*/
|
||||||
private final List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
|
private final List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current start time.
|
||||||
|
*/
|
||||||
|
Calendar startCal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current end time.
|
||||||
|
*/
|
||||||
|
Calendar endCal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -81,13 +127,41 @@ public class SizeJob extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entry to queue and if pending selected entries add them to the queue
|
* Start and/or end time has changed so all sizes need to be recomputed.
|
||||||
* with same start/end times.
|
|
||||||
*
|
*
|
||||||
* @param fileInfo
|
* @param startCal
|
||||||
|
* @param endCal
|
||||||
*/
|
*/
|
||||||
public void queue(SizeJobRequest fileInfo) {
|
public void resetTime(Calendar startCal, Calendar endCal) {
|
||||||
queue.add(fileInfo);
|
this.startCal = startCal;
|
||||||
|
this.endCal = endCal;
|
||||||
|
recomputeSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force getting the sizes for all data in the archive Information map.
|
||||||
|
*/
|
||||||
|
public synchronized void recomputeSize() {
|
||||||
|
clearQueue();
|
||||||
|
for (String archiveName : archiveInfoMap.keySet()) {
|
||||||
|
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
||||||
|
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||||
|
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||||
|
for (DisplayData displayData : categoryInfo
|
||||||
|
.getDisplayDataList()) {
|
||||||
|
displayData.setSize(DisplayData.UNKNOWN_SIZE);
|
||||||
|
if (displayData.isSelected()) {
|
||||||
|
selectedQueue.add(displayData);
|
||||||
|
} else {
|
||||||
|
backgroundQueue.add(displayData);
|
||||||
|
}
|
||||||
|
if (shutdown.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
displaySizesComputed.set(false);
|
||||||
|
|
||||||
if (getState() == Job.NONE) {
|
if (getState() == Job.NONE) {
|
||||||
schedule();
|
schedule();
|
||||||
|
@ -95,42 +169,112 @@ public class SizeJob extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear queue but save selected entries still needing sizes.
|
* If request is for unknown size then add request to the appropriate queue.
|
||||||
|
*
|
||||||
|
* @param fileInfo
|
||||||
*/
|
*/
|
||||||
public void clearQueue() {
|
private synchronized void requeue(DisplayData displayData) {
|
||||||
List<SizeJobRequest> pending = new ArrayList<SizeJobRequest>();
|
if (!shutdown.get()) {
|
||||||
|
requeueRequest.set(false);
|
||||||
|
if (displayData.isSelected()) {
|
||||||
|
selectedQueue.add(displayData);
|
||||||
|
backgroundQueue.remove(displayData);
|
||||||
|
} else {
|
||||||
|
selectedQueue.remove(backgroundQueue);
|
||||||
|
backgroundQueue.add(displayData);
|
||||||
|
}
|
||||||
|
|
||||||
// Drain queue queue.removeAll() doesn't work.
|
if (getState() == Job.NONE) {
|
||||||
while (!queue.isEmpty()) {
|
schedule();
|
||||||
pending.add(queue.remove());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getState() != NONE) {
|
|
||||||
cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save selected items that do not have sizes.
|
|
||||||
for (SizeJobRequest dirInfo : pending) {
|
|
||||||
DisplayData displayData = dirInfo.getDisplayData();
|
|
||||||
|
|
||||||
if (displayData.isSelected() && displayData.getSize() < 0L) {
|
|
||||||
if (!selectedQueue.contains(displayData)) {
|
|
||||||
selectedQueue.add(displayData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requeue pending entries.
|
* Add entry to the archive information map.
|
||||||
*
|
*
|
||||||
* @param startCal
|
* @param archiveName
|
||||||
* @param endCal
|
* @param archiveInfo
|
||||||
*/
|
*/
|
||||||
public void requeueSelected(Calendar startCal, Calendar endCal) {
|
public void put(String archiveName, ArchiveInfo archiveInfo) {
|
||||||
if (!selectedQueue.isEmpty()) {
|
if (archiveInfoMap.isEmpty()) {
|
||||||
DisplayData displayData = selectedQueue.remove();
|
displayArchive = archiveName;
|
||||||
queue(new SizeJobRequest(displayData, startCal, endCal));
|
displayCategory = archiveInfo.getCategoryNames().iterator().next();
|
||||||
|
}
|
||||||
|
archiveInfoMap.put(archiveName, archiveInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an entry from the archive information map.
|
||||||
|
*
|
||||||
|
* @param archiveName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ArchiveInfo get(String archiveName) {
|
||||||
|
return archiveInfoMap.get(archiveName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return archiveNames
|
||||||
|
*/
|
||||||
|
public synchronized Set<String> getArchiveNames() {
|
||||||
|
return archiveInfoMap.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the selection state and if requeue size request.
|
||||||
|
*
|
||||||
|
* @param archiveName
|
||||||
|
* @param categoryName
|
||||||
|
* @param displayName
|
||||||
|
* @param selected
|
||||||
|
*/
|
||||||
|
public void setSelect(String archiveName, String categoryName,
|
||||||
|
String displayName, boolean selected) {
|
||||||
|
for (DisplayData displayData : archiveInfoMap.get(archiveName)
|
||||||
|
.get(categoryName).getDisplayDataList()) {
|
||||||
|
if (displayName.equals(displayData.getDisplayLabel())) {
|
||||||
|
if (displayData.isSelected() != selected) {
|
||||||
|
displayData.setSelected(selected);
|
||||||
|
if (displayData.getSize() == DisplayData.UNKNOWN_SIZE) {
|
||||||
|
requeue(displayData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the archive/category display.
|
||||||
|
*
|
||||||
|
* @param archiveName
|
||||||
|
* @param categoryName
|
||||||
|
*/
|
||||||
|
public synchronized void changeDisplayQueue(String archiveName,
|
||||||
|
String categoryName) {
|
||||||
|
if (!archiveName.equals(displayArchive)
|
||||||
|
|| !categoryName.equals(displayCategory)) {
|
||||||
|
if (getState() != Job.NONE) {
|
||||||
|
requeueRequest.set(true);
|
||||||
|
stopComputeSize.set(true);
|
||||||
|
}
|
||||||
|
displaySizesComputed.set(false);
|
||||||
|
displayArchive = archiveName;
|
||||||
|
displayCategory = categoryName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear request queues and stop current request.
|
||||||
|
*/
|
||||||
|
public void clearQueue() {
|
||||||
|
if (getState() != Job.NONE) {
|
||||||
|
displaySizesComputed.set(false);
|
||||||
|
selectedQueue.clear();
|
||||||
|
backgroundQueue.clear();
|
||||||
|
requeueRequest.set(false);
|
||||||
|
stopComputeSize.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,43 +292,72 @@ public class SizeJob extends Job {
|
||||||
|
|
||||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||||
|
|
||||||
mainLoop: while (!queue.isEmpty()) {
|
mainLoop: while (!shutdown.get()) {
|
||||||
SizeJobRequest dirInfo = queue.remove();
|
DisplayData displayData = null;
|
||||||
|
if (!displaySizesComputed.get()) {
|
||||||
|
synchronized (this) {
|
||||||
|
// Get sizes for the current display.
|
||||||
|
List<DisplayData> displayDatas = archiveInfoMap
|
||||||
|
.get(displayArchive).get(displayCategory)
|
||||||
|
.getDisplayDataList();
|
||||||
|
for (DisplayData dd : displayDatas) {
|
||||||
|
if (dd.getSize() == DisplayData.UNKNOWN_SIZE) {
|
||||||
|
displayData = dd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
displaySizesComputed.set(displayData == null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayData == null) {
|
||||||
|
if (!selectedQueue.isEmpty()) {
|
||||||
|
displayData = selectedQueue.remove();
|
||||||
|
} else if (!backgroundQueue.isEmpty()) {
|
||||||
|
displayData = backgroundQueue.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayData == null) {
|
||||||
|
break mainLoop;
|
||||||
|
} else if (displayData.getSize() >= 0) {
|
||||||
|
continue mainLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stopComputeSize.set(false);
|
stopComputeSize.set(false);
|
||||||
DisplayData displayData = dirInfo.displayData;
|
|
||||||
Calendar startCal = dirInfo.startCal;
|
|
||||||
Calendar endCal = dirInfo.endCal;
|
|
||||||
|
|
||||||
List<File> files = manager.getDisplayFiles(displayData, startCal,
|
List<File> files = manager.getDisplayFiles(displayData, startCal,
|
||||||
endCal);
|
endCal);
|
||||||
|
|
||||||
// Size no longer needed.
|
// Size no longer needed.
|
||||||
if (!displayData.isSelected() && stopComputeSize.get()) {
|
if (stopComputeSize.get()) {
|
||||||
continue;
|
if (requeueRequest.get()) {
|
||||||
|
requeue(displayData);
|
||||||
|
}
|
||||||
|
continue mainLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
dirInfo.files.clear();
|
|
||||||
dirInfo.files.addAll(files);
|
|
||||||
long size = 0L;
|
long size = 0L;
|
||||||
for (File file : dirInfo.files) {
|
for (File file : files) {
|
||||||
|
|
||||||
// Skip when size no longer needed.
|
|
||||||
if (!displayData.isSelected() && stopComputeSize.get()) {
|
|
||||||
continue mainLoop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
size += FileUtil.sizeOfDirectory(file);
|
size += sizeOfDirectory(file);
|
||||||
} else {
|
} else {
|
||||||
size += file.length();
|
size += file.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip when size no longer needed.
|
||||||
|
if (stopComputeSize.get()) {
|
||||||
|
if (requeueRequest.get()) {
|
||||||
|
requeue(displayData);
|
||||||
|
}
|
||||||
|
continue mainLoop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayData.setSize(size);
|
displayData.setSize(size);
|
||||||
|
|
||||||
List<SizeJobRequest> list = new ArrayList<SizeJobRequest>(1);
|
List<DisplayData> list = new ArrayList<DisplayData>(1);
|
||||||
list.add(dirInfo);
|
list.add(displayData);
|
||||||
for (IUpdateListener listener : listeners) {
|
for (IUpdateListener listener : listeners) {
|
||||||
listener.update(list);
|
listener.update(list);
|
||||||
}
|
}
|
||||||
|
@ -193,6 +366,28 @@ public class SizeJob extends Job {
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the total size of a directory; unless stop flag is set then
|
||||||
|
* result is unknown.
|
||||||
|
*
|
||||||
|
* @param directory
|
||||||
|
* @return size
|
||||||
|
*/
|
||||||
|
private long sizeOfDirectory(File directory) {
|
||||||
|
long size = 0;
|
||||||
|
for (File file : directory.listFiles()) {
|
||||||
|
if (stopComputeSize.get()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
size += sizeOfDirectory(file);
|
||||||
|
} else {
|
||||||
|
size += file.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -200,7 +395,9 @@ public class SizeJob extends Job {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void canceling() {
|
protected void canceling() {
|
||||||
queue.clear();
|
selectedQueue.clear();
|
||||||
|
backgroundQueue.clear();
|
||||||
|
shutdown.set(true);
|
||||||
stopComputeSize.set(true);
|
stopComputeSize.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
package com.raytheon.uf.viz.archive.data;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class obtains information on a File in a Job in order to remove it from
|
|
||||||
* the UI thread.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* May 15, 2013 1966 rferrel Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author rferrel
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SizeJobRequest {
|
|
||||||
|
|
||||||
/** Information from archive configuration manager. */
|
|
||||||
final DisplayData displayData;
|
|
||||||
|
|
||||||
/** Files or directories to obtain information on. */
|
|
||||||
final List<File> files = new ArrayList<File>();
|
|
||||||
|
|
||||||
/** Start time inclusive. */
|
|
||||||
final Calendar startCal;
|
|
||||||
|
|
||||||
/** End time exclusive. */
|
|
||||||
final Calendar endCal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create and entry and place it on the queue.
|
|
||||||
*
|
|
||||||
* @param displayData
|
|
||||||
* @param startCal
|
|
||||||
* @param endCal
|
|
||||||
*/
|
|
||||||
public SizeJobRequest(DisplayData displayData, Calendar startCal,
|
|
||||||
Calendar endCal) {
|
|
||||||
this.displayData = displayData;
|
|
||||||
this.startCal = startCal;
|
|
||||||
this.endCal = endCal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return displayData
|
|
||||||
*/
|
|
||||||
public DisplayData getDisplayData() {
|
|
||||||
return displayData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,9 +21,7 @@ package com.raytheon.uf.viz.archive.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -50,7 +48,6 @@ import com.raytheon.uf.viz.archive.data.CategoryInfo;
|
||||||
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
||||||
import com.raytheon.uf.viz.archive.data.IUpdateListener;
|
import com.raytheon.uf.viz.archive.data.IUpdateListener;
|
||||||
import com.raytheon.uf.viz.archive.data.SizeJob;
|
import com.raytheon.uf.viz.archive.data.SizeJob;
|
||||||
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
|
|
||||||
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
|
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
@ -68,7 +65,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 30, 2013 1965 bgonzale Initial creation
|
* May 30, 2013 1965 bgonzale Initial creation
|
||||||
* Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
|
* Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
|
||||||
*
|
* Jul 24, 2013 2220 rferrel Changes to queue size request for all data.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bgonzale
|
* @author bgonzale
|
||||||
|
@ -87,9 +84,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
/** Category combo box. */
|
/** Category combo box. */
|
||||||
private Combo categoryCbo;
|
private Combo categoryCbo;
|
||||||
|
|
||||||
/** Information for populating the various table displays. */
|
|
||||||
protected final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean to indicate when DisplayData is created should its selection be
|
* Boolean to indicate when DisplayData is created should its selection be
|
||||||
* set based on the information in the configuration files.
|
* set based on the information in the configuration files.
|
||||||
|
@ -135,8 +129,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
public List<DisplayData> getAllSelected() {
|
public List<DisplayData> getAllSelected() {
|
||||||
List<DisplayData> allSelected = new ArrayList<DisplayData>();
|
List<DisplayData> allSelected = new ArrayList<DisplayData>();
|
||||||
for (String archiveName : archiveInfoMap.keySet()) {
|
for (String archiveName : sizeJob.getArchiveNames()) {
|
||||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
ArchiveInfo archiveInfo = sizeJob.get(archiveName);
|
||||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||||
for (DisplayData displayData : categoryInfo
|
for (DisplayData displayData : categoryInfo
|
||||||
|
@ -265,6 +259,18 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
return comboComp;
|
return comboComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||||
|
* .eclipse.swt.widgets.Shell)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initializeComponents(Shell shell) {
|
||||||
|
ArchiveConfigManager.getInstance().reset();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -285,7 +291,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
populateComboBoxes();
|
populateComboBoxes();
|
||||||
setCursorBusy(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -296,6 +301,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateTableComp();
|
updateTableComp();
|
||||||
|
setCursorBusy(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -309,7 +315,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
* Create the table control.
|
* Create the table control.
|
||||||
*/
|
*/
|
||||||
protected void createTable() {
|
protected void createTable() {
|
||||||
tableComp = new ArchiveTableComp(shell, tableType, this);
|
tableComp = new ArchiveTableComp(shell, tableType, this, sizeJob);
|
||||||
sizeJob.addUpdateListener(this);
|
sizeJob.addUpdateListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +350,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
if (doSelect) {
|
if (doSelect) {
|
||||||
archCfgCbo.select(0);
|
archCfgCbo.select(0);
|
||||||
archiveComboSelection();
|
initCategoryCbo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +368,11 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
* @param archiveName
|
* @param archiveName
|
||||||
*/
|
*/
|
||||||
private void populateCategoryCbo() {
|
private void populateCategoryCbo() {
|
||||||
|
initCategoryCbo();
|
||||||
|
categoryComboSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCategoryCbo() {
|
||||||
String archiveName = getSelectedArchiveName();
|
String archiveName = getSelectedArchiveName();
|
||||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||||
categoryCbo.removeAll();
|
categoryCbo.removeAll();
|
||||||
|
@ -369,7 +380,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
categoryCbo.add(categoryName);
|
categoryCbo.add(categoryName);
|
||||||
}
|
}
|
||||||
categoryCbo.select(0);
|
categoryCbo.select(0);
|
||||||
categoryComboSelection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -385,28 +395,25 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
*/
|
*/
|
||||||
private void initDisplayData() {
|
private void initDisplayData() {
|
||||||
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
|
||||||
Calendar startCal = getStart();
|
|
||||||
Calendar endCal = getEnd();
|
|
||||||
String[] archiveNames = manager.getArchiveDataNamesList();
|
String[] archiveNames = manager.getArchiveDataNamesList();
|
||||||
for (String archiveName : archiveNames) {
|
for (String archiveName : archiveNames) {
|
||||||
ArchiveInfo archiveInfo = new ArchiveInfo();
|
ArchiveInfo archiveInfo = new ArchiveInfo();
|
||||||
archiveInfoMap.put(archiveName, archiveInfo);
|
|
||||||
String[] categoryNames = manager.getCategoryNames(manager
|
String[] categoryNames = manager.getCategoryNames(manager
|
||||||
.getArchive(archiveName));
|
.getArchive(archiveName));
|
||||||
for (String categoryName : categoryNames) {
|
for (String categoryName : categoryNames) {
|
||||||
|
// TODO future enhancement to make GUI display faster need to
|
||||||
|
// move getting displayDatas into SizeJob then get current
|
||||||
|
// display, displays with selections then other displays in the
|
||||||
|
// background.
|
||||||
List<DisplayData> displayDatas = manager.getDisplayData(
|
List<DisplayData> displayDatas = manager.getDisplayData(
|
||||||
archiveName, categoryName, setSelect);
|
archiveName, categoryName, setSelect);
|
||||||
CategoryInfo categoryInfo = new CategoryInfo(archiveName,
|
CategoryInfo categoryInfo = new CategoryInfo(archiveName,
|
||||||
categoryName, displayDatas);
|
categoryName, displayDatas);
|
||||||
archiveInfo.add(categoryInfo);
|
archiveInfo.add(categoryInfo);
|
||||||
for (DisplayData displayData : displayDatas) {
|
|
||||||
if (displayData.isSelected()) {
|
|
||||||
sizeJob.queue(new SizeJobRequest(displayData, startCal,
|
|
||||||
endCal));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
sizeJob.put(archiveName, archiveInfo);
|
||||||
}
|
}
|
||||||
|
sizeJob.resetTime(getStart(), getEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -416,15 +423,12 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
protected void populateTableComp() {
|
protected void populateTableComp() {
|
||||||
String archiveName = getSelectedArchiveName();
|
String archiveName = getSelectedArchiveName();
|
||||||
String categoryName = getSelectedCategoryName();
|
String categoryName = getSelectedCategoryName();
|
||||||
Calendar startCal = getStart();
|
|
||||||
Calendar endCal = getEnd();
|
|
||||||
|
|
||||||
setCursorBusy(true);
|
setCursorBusy(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sizeJob.clearQueue();
|
|
||||||
|
|
||||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
ArchiveInfo archiveInfo = sizeJob.get(archiveName);
|
||||||
|
|
||||||
// Not yet populated by background job.
|
// Not yet populated by background job.
|
||||||
if (archiveInfo == null) {
|
if (archiveInfo == null) {
|
||||||
|
@ -437,12 +441,10 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DisplayData displayData : categoryInfo.getDisplayDataList()) {
|
sizeJob.changeDisplayQueue(archiveName, categoryName);
|
||||||
sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal));
|
|
||||||
}
|
|
||||||
sizeJob.requeueSelected(startCal, endCal);
|
|
||||||
|
|
||||||
tableComp.populateTable(categoryInfo.getDisplayDataList());
|
tableComp.populateTable(archiveName, categoryName,
|
||||||
|
categoryInfo.getDisplayDataList());
|
||||||
} finally {
|
} finally {
|
||||||
setCursorBusy(false);
|
setCursorBusy(false);
|
||||||
}
|
}
|
||||||
|
@ -474,8 +476,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
int totalSelected = 0;
|
int totalSelected = 0;
|
||||||
|
|
||||||
for (String archiveName : archiveInfoMap.keySet()) {
|
for (String archiveName : sizeJob.getArchiveNames()) {
|
||||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
ArchiveInfo archiveInfo = sizeJob.get(archiveName);
|
||||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||||
for (DisplayData displayData : categoryInfo
|
for (DisplayData displayData : categoryInfo
|
||||||
|
@ -513,18 +515,25 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
* com.raytheon.uf.viz.archive.data.IUpdateListener#update(java.util.List)
|
* com.raytheon.uf.viz.archive.data.IUpdateListener#update(java.util.List)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(List<SizeJobRequest> dirInfos) {
|
public void update(final List<DisplayData> displayDatas) {
|
||||||
final List<DisplayData> displayDatas = new ArrayList<DisplayData>(
|
final List<DisplayData> myDisplayDatas = new ArrayList<DisplayData>(
|
||||||
dirInfos.size());
|
displayDatas.size());
|
||||||
for (SizeJobRequest request : dirInfos) {
|
for (DisplayData data : displayDatas) {
|
||||||
displayDatas.add(request.getDisplayData());
|
String label = data.getDisplayLabel();
|
||||||
|
for (DisplayData displayData : sizeJob.get(data.getArchiveName())
|
||||||
|
.get(data.getCategoryName()).getDisplayDataList()) {
|
||||||
|
if (label.equals(displayData.getDisplayLabel())) {
|
||||||
|
displayData.setSize(data.getSize());
|
||||||
|
myDisplayDatas.add(displayData);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
tableComp.updateSize(displayDatas);
|
tableComp.updateSize(myDisplayDatas);
|
||||||
updateTotals(null);
|
updateTotals(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -546,6 +555,29 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
tableComp.addModifiedListener(iModifyListener);
|
tableComp.addModifiedListener(iModifyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data information on all selected items; not just the currently
|
||||||
|
* displayed table.
|
||||||
|
*
|
||||||
|
* @return selectedDatas
|
||||||
|
*/
|
||||||
|
protected List<DisplayData> getSelectedData() {
|
||||||
|
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
|
||||||
|
for (String archiveName : sizeJob.getArchiveNames()) {
|
||||||
|
ArchiveInfo archiveInfo = sizeJob.get(archiveName);
|
||||||
|
for (String categoryName : archiveInfo.getCategoryNames()) {
|
||||||
|
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
||||||
|
for (DisplayData displayData : categoryInfo
|
||||||
|
.getDisplayDataList()) {
|
||||||
|
if (displayData.isSelected()) {
|
||||||
|
selectedDatas.add(displayData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return selectedDatas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove modification listener.
|
* Remove modification listener.
|
||||||
*
|
*
|
||||||
|
@ -555,15 +587,11 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
|
||||||
tableComp.removeModifiedListener(iModifyListener);
|
tableComp.removeModifiedListener(iModifyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* (non-Javadoc)
|
* Reset all data to unknown size, and queue request for sizes.
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
|
||||||
* .eclipse.swt.widgets.Shell)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
protected void resetSizes() {
|
||||||
protected void initializeComponents(Shell shell) {
|
sizeJob.recomputeSize();
|
||||||
ArchiveConfigManager.getInstance().reset();
|
populateTableComp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.uf.viz.core.VizApp;
|
||||||
* May 23, 2013 #1964 lvenable Initial creation
|
* May 23, 2013 #1964 lvenable Initial creation
|
||||||
* May 31, 2013 #1965 bgonzale Initial work for updating retention configurations.
|
* May 31, 2013 #1965 bgonzale Initial work for updating retention configurations.
|
||||||
* Jun 10, 2013 #1966 rferrel Implemented hooks to get display and save to work.
|
* Jun 10, 2013 #1966 rferrel Implemented hooks to get display and save to work.
|
||||||
|
* Jul 24, 2013 #2220 rferrel Add recompute size button.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -225,23 +226,11 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
||||||
private void createBottomActionButtons() {
|
private void createBottomActionButtons() {
|
||||||
|
|
||||||
Composite actionControlComp = new Composite(shell, SWT.NONE);
|
Composite actionControlComp = new Composite(shell, SWT.NONE);
|
||||||
GridLayout gl = new GridLayout(2, false);
|
GridLayout gl = new GridLayout(3, false);
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
actionControlComp.setLayout(gl);
|
actionControlComp.setLayout(gl);
|
||||||
actionControlComp.setLayoutData(gd);
|
actionControlComp.setLayoutData(gd);
|
||||||
|
|
||||||
// TODO - For the future ?
|
|
||||||
// Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
|
|
||||||
// calcSizeBtn.setText(" Calculate Sizes ");
|
|
||||||
// calcSizeBtn.addSelectionListener(new SelectionAdapter() {
|
|
||||||
// @Override
|
|
||||||
// public void widgetSelected(SelectionEvent e) {
|
|
||||||
// // TODO : add calculate size functionality
|
|
||||||
// // With Roger's automated size calculation code, this doesn't
|
|
||||||
// // seem relevant unless it is for calculating compressed size
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
saveBtn = new Button(actionControlComp, SWT.PUSH);
|
saveBtn = new Button(actionControlComp, SWT.PUSH);
|
||||||
saveBtn.setText(" Save ");
|
saveBtn.setText(" Save ");
|
||||||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -256,6 +245,16 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
|
||||||
});
|
});
|
||||||
saveBtn.setEnabled(false);
|
saveBtn.setEnabled(false);
|
||||||
|
|
||||||
|
Button sizeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||||
|
sizeBtn.setText(" Recompute Sizes ");
|
||||||
|
sizeBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
resetSizes();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
||||||
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||||
closeBtn.setText(" Close ");
|
closeBtn.setText(" Close ");
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.TableItem;
|
||||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||||
import com.raytheon.uf.common.util.SizeUtil;
|
import com.raytheon.uf.common.util.SizeUtil;
|
||||||
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
||||||
|
import com.raytheon.uf.viz.archive.data.SizeJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Archive table composite that contains the SWT table.
|
* Archive table composite that contains the SWT table.
|
||||||
|
@ -70,6 +71,12 @@ public class ArchiveTableComp extends Composite {
|
||||||
/** Column to display size information,. */
|
/** Column to display size information,. */
|
||||||
private final int SIZE_COL_INDEX = 1;
|
private final int SIZE_COL_INDEX = 1;
|
||||||
|
|
||||||
|
/** Name of table's archive. */
|
||||||
|
String archiveName;
|
||||||
|
|
||||||
|
/** Name of table's category. */
|
||||||
|
String categoryName;
|
||||||
|
|
||||||
/** Table control. */
|
/** Table control. */
|
||||||
private Table table;
|
private Table table;
|
||||||
|
|
||||||
|
@ -106,6 +113,11 @@ public class ArchiveTableComp extends Composite {
|
||||||
*/
|
*/
|
||||||
private final List<IModifyListener> modifiedListeners = new CopyOnWriteArrayList<IModifyListener>();
|
private final List<IModifyListener> modifiedListeners = new CopyOnWriteArrayList<IModifyListener>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to update the selections for size job queues.
|
||||||
|
*/
|
||||||
|
private final SizeJob sizeJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -115,11 +127,12 @@ public class ArchiveTableComp extends Composite {
|
||||||
* Table type.
|
* Table type.
|
||||||
*/
|
*/
|
||||||
public ArchiveTableComp(Composite parent, TableType type,
|
public ArchiveTableComp(Composite parent, TableType type,
|
||||||
IArchiveTotals iTotalSelectedSize) {
|
IArchiveTotals iTotalSelectedSize, SizeJob sizeJob) {
|
||||||
super(parent, 0);
|
super(parent, 0);
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.iArchiveTotals = iTotalSelectedSize;
|
this.iArchiveTotals = iTotalSelectedSize;
|
||||||
|
this.sizeJob = sizeJob;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +299,8 @@ public class ArchiveTableComp extends Composite {
|
||||||
if (item.getChecked()) {
|
if (item.getChecked()) {
|
||||||
++count;
|
++count;
|
||||||
displayData.setSelected(true);
|
displayData.setSelected(true);
|
||||||
|
sizeJob.setSelect(archiveName, categoryName,
|
||||||
|
displayData.getDisplayLabel(), true);
|
||||||
if (tableTotalSize >= 0) {
|
if (tableTotalSize >= 0) {
|
||||||
long diSize = displayData.getSize();
|
long diSize = displayData.getSize();
|
||||||
if (diSize < 0) {
|
if (diSize < 0) {
|
||||||
|
@ -296,6 +311,8 @@ public class ArchiveTableComp extends Composite {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayData.setSelected(false);
|
displayData.setSelected(false);
|
||||||
|
sizeJob.setSelect(archiveName, categoryName,
|
||||||
|
displayData.getDisplayLabel(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<DisplayData> displayDatas = Arrays.asList(tableData);
|
List<DisplayData> displayDatas = Arrays.asList(tableData);
|
||||||
|
@ -426,7 +443,10 @@ public class ArchiveTableComp extends Composite {
|
||||||
*
|
*
|
||||||
* @param displayDatas
|
* @param displayDatas
|
||||||
*/
|
*/
|
||||||
protected void populateTable(List<DisplayData> displayDatas) {
|
protected void populateTable(String archiveName, String categoryName,
|
||||||
|
List<DisplayData> displayDatas) {
|
||||||
|
this.archiveName = archiveName;
|
||||||
|
this.categoryName = categoryName;
|
||||||
tableData = displayDatas.toArray(new DisplayData[0]);
|
tableData = displayDatas.toArray(new DisplayData[0]);
|
||||||
table.removeAll();
|
table.removeAll();
|
||||||
table.setItemCount(tableData.length);
|
table.setItemCount(tableData.length);
|
||||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.viz.archive.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -51,11 +50,8 @@ import org.eclipse.swt.widgets.Spinner;
|
||||||
import com.raytheon.uf.common.archive.config.DisplayData;
|
import com.raytheon.uf.common.archive.config.DisplayData;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.common.util.SizeUtil;
|
import com.raytheon.uf.common.util.SizeUtil;
|
||||||
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
|
|
||||||
import com.raytheon.uf.viz.archive.data.CategoryInfo;
|
|
||||||
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
|
||||||
import com.raytheon.uf.viz.archive.data.IUpdateListener;
|
import com.raytheon.uf.viz.archive.data.IUpdateListener;
|
||||||
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
|
|
||||||
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
|
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
import com.raytheon.viz.ui.dialogs.AwipsCalendar;
|
import com.raytheon.viz.ui.dialogs.AwipsCalendar;
|
||||||
|
@ -74,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* May 23, 2013 #1964 lvenable Initial creation
|
* May 23, 2013 #1964 lvenable Initial creation
|
||||||
* Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
|
* Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
|
||||||
* and generation of cases.
|
* and generation of cases.
|
||||||
|
* Jul 24, 2013 #2220 rferrel Add recompute size button.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -451,6 +448,16 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button sizeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||||
|
sizeBtn.setText(" Recompute Sizes ");
|
||||||
|
sizeBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
resetSizes();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
|
||||||
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
|
||||||
closeBtn.setText(" Close ");
|
closeBtn.setText(" Close ");
|
||||||
|
@ -687,7 +694,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||||
|
|
||||||
if (!startDate.equals(date)) {
|
if (!startDate.equals(date)) {
|
||||||
startDate = date;
|
startDate = date;
|
||||||
resetSizes();
|
sizeJob.resetTime(getStart(), getEnd());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (date.before(startDate)) {
|
if (date.before(startDate)) {
|
||||||
|
@ -700,7 +707,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||||
}
|
}
|
||||||
if (!endDate.equals(date)) {
|
if (!endDate.equals(date)) {
|
||||||
endDate = date;
|
endDate = date;
|
||||||
resetSizes();
|
sizeJob.resetTime(getStart(), getEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,73 +759,12 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||||
checkGenerateButton();
|
checkGenerateButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset all entries to unknown size, recompute the sizes for the current
|
|
||||||
* display table and and other selected entries.
|
|
||||||
*/
|
|
||||||
private void resetSizes() {
|
|
||||||
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
|
|
||||||
for (String archiveName : archiveInfoMap.keySet()) {
|
|
||||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
|
||||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
|
||||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
|
||||||
for (DisplayData displayData : categoryInfo
|
|
||||||
.getDisplayDataList()) {
|
|
||||||
displayData.setSize(DisplayData.UNKNOWN_SIZE);
|
|
||||||
if (displayData.isSelected()) {
|
|
||||||
selectedDatas.add(displayData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
populateTableComp();
|
|
||||||
|
|
||||||
if (selectedDatas.size() > 0) {
|
|
||||||
String archiveName = getSelectedArchiveName();
|
|
||||||
String categoryName = getSelectedCategoryName();
|
|
||||||
Calendar startCal = getStart();
|
|
||||||
Calendar endCal = getEnd();
|
|
||||||
|
|
||||||
for (DisplayData displayData : selectedDatas) {
|
|
||||||
if (!displayData.isArchive(archiveName)
|
|
||||||
|| !displayData.isCategory(categoryName)) {
|
|
||||||
sizeJob.queue(new SizeJobRequest(displayData, startCal,
|
|
||||||
endCal));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data information on all selected items; not just the currently
|
|
||||||
* displayed table.
|
|
||||||
*
|
|
||||||
* @return selectedDatas
|
|
||||||
*/
|
|
||||||
private List<DisplayData> getSelectedData() {
|
|
||||||
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
|
|
||||||
for (String archiveName : archiveInfoMap.keySet()) {
|
|
||||||
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
|
|
||||||
for (String categoryName : archiveInfo.getCategoryNames()) {
|
|
||||||
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
|
|
||||||
for (DisplayData displayData : categoryInfo
|
|
||||||
.getDisplayDataList()) {
|
|
||||||
if (displayData.isSelected()) {
|
|
||||||
selectedDatas.add(displayData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectedDatas;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
|
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
|
||||||
*/
|
*/
|
||||||
// @Override
|
@Override
|
||||||
protected Calendar getStart() {
|
protected Calendar getStart() {
|
||||||
Calendar startCal = TimeUtil.newCalendar();
|
Calendar startCal = TimeUtil.newCalendar();
|
||||||
startCal.setTimeInMillis(startDate.getTime());
|
startCal.setTimeInMillis(startDate.getTime());
|
||||||
|
@ -830,7 +776,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
|
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
|
||||||
*/
|
*/
|
||||||
// @Override
|
@Override
|
||||||
protected Calendar getEnd() {
|
protected Calendar getEnd() {
|
||||||
Calendar endCal = TimeUtil.newCalendar();
|
Calendar endCal = TimeUtil.newCalendar();
|
||||||
endCal.setTimeInMillis(endDate.getTime());
|
endCal.setTimeInMillis(endDate.getTime());
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
|
||||||
/** When true compress the case directory. */
|
/** When true compress the case directory. */
|
||||||
private final boolean doCompress;
|
private final boolean doCompress;
|
||||||
|
|
||||||
/** When true break the compress file into multliple files. */
|
/** When true break the compress file into multiple files. */
|
||||||
private final boolean doMultiFiles;
|
private final boolean doMultiFiles;
|
||||||
|
|
||||||
/** The compress size for muliple files. */
|
/** The compress size for muliple files. */
|
||||||
|
|
|
@ -225,4 +225,29 @@ public class DisplayData implements Comparable<DisplayData> {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getArchiveName() {
|
||||||
|
return archiveConfig.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoryName() {
|
||||||
|
return categoryConfig.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder("DisplayData[");
|
||||||
|
sb.append("displayLabel: ").append(displayLabel);
|
||||||
|
sb.append(", isSlected: ").append(selected);
|
||||||
|
sb.append(", size: ").append(size);
|
||||||
|
sb.append(", category.name: ").append(categoryConfig.getName());
|
||||||
|
sb.append(", archive.name: ").append(archiveConfig.getName())
|
||||||
|
.append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue