Skip to content

Commit

Permalink
'#1864 improves progress information.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdalla committed Feb 22, 2024
1 parent 4dcadac commit 3c822e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
29 changes: 22 additions & 7 deletions iped-app/src/main/java/iped/app/timelinegraph/IpedChartsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;

import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
Expand Down Expand Up @@ -164,7 +165,9 @@ public class IpedChartsPanel extends JPanel implements ResultSetViewer, TableMod

String metadataToBreakChart = null;
ImageIcon loading = null;
JLabel loadingLabel;
JPanel loadingPanel = new JPanel();
JLabel loadingLabelImage;
JLabel loadingLabelText;

IpedSplitPane splitPane;

Expand Down Expand Up @@ -377,8 +380,15 @@ public void check(MouseEvent e) {
this.addComponentListener(this);

loading = (ImageIcon) new ImageIcon(IconUtil.class.getResource(resPath + "loading.gif"));
loadingLabel = new JLabel("", loading, JLabel.CENTER);
this.add(loadingLabel);
loadingLabelImage = new JLabel("", loading, JLabel.CENTER);
loadingLabelText = new JLabel("", JLabel.CENTER);
loadingPanel.setAlignmentY(Component.CENTER_ALIGNMENT);
loadingPanel.setLayout(new BoxLayout(loadingPanel, BoxLayout.Y_AXIS));
loadingLabelImage.setAlignmentX(Component.CENTER_ALIGNMENT);
loadingLabelText.setAlignmentX(Component.CENTER_ALIGNMENT);
loadingPanel.add(loadingLabelImage, BorderLayout.CENTER);
loadingPanel.add(loadingLabelText, BorderLayout.CENTER);
this.add(loadingPanel);

domainAxis.setTickMarkPosition(DateTickMarkPosition.START);
domainAxis.setLowerMargin(0.01);
Expand Down Expand Up @@ -420,6 +430,7 @@ public HashMap<String, XYDataset> createAlertDataSets() {
}

public HashMap<String, AbstractIntervalXYDataset> createDataSets() {

HashMap<String, AbstractIntervalXYDataset> result = new HashMap<String, AbstractIntervalXYDataset>();
try {
Set<String> selectedBookmarks = guiProvider.getSelectedBookmarks();
Expand Down Expand Up @@ -482,8 +493,8 @@ public Future<?> refreshChart(boolean resetDomainRange) {
IpedChartsPanel self = this;

self.remove(splitPane);
self.remove(loadingLabel);
self.add(loadingLabel);
self.remove(loadingPanel);
self.add(loadingPanel);
self.repaint();

if (swRefresh != null) {
Expand Down Expand Up @@ -548,7 +559,7 @@ public void run() {
}

if (chart != null && !isCancelled()) {
self.remove(loadingLabel);
self.remove(loadingPanel);
self.remove(splitPane);
self.add(splitPane);
splitPane.setTopComponent(chartPanel);
Expand Down Expand Up @@ -1060,7 +1071,7 @@ public void setLegendList(JList legendList) {

@Override
public void componentResized(ComponentEvent e) {
this.remove(loadingLabel);
this.remove(loadingPanel);
this.remove(splitPane);
this.add(splitPane);
}
Expand Down Expand Up @@ -1126,4 +1137,8 @@ public void actionPerformed(ActionEvent e) {
}
refreshChart(false);
}

public void info(String info) {
loadingLabelText.setText(info);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public void run() {
if (!cacheExists) {
Date d1 = new Date();
logger.info("Starting to build time cache of [{}]...", periodClassesToCache.toString());
ipedChartsPanel.info("Starting to build time cache of [" + periodClassesToCache.toString() + "] to "
+ teGroup.getName() + " event type group");

ArrayList<EventTimestampCache> cacheLoaders = new ArrayList<EventTimestampCache>();

Expand Down Expand Up @@ -139,6 +141,9 @@ public void run() {
}

} else {
ipedChartsPanel.info("Starting to load time cache of [" + periodClassesToCache.toString() + "] to "
+ teGroup.getName() + " event type group");

CachePersistence cp = CachePersistence.getInstance();
for (Class periodClasses : periodClassesToCache) {
newCache.setIndexFile(teGroup, periodClasses.getSimpleName(), cp.getBaseDir());
Expand Down

0 comments on commit 3c822e9

Please sign in to comment.