diff --git a/mctcore/src/main/java/gov/nasa/arc/mct/gui/FeedView.java b/mctcore/src/main/java/gov/nasa/arc/mct/gui/FeedView.java index 6b03bb4f..36ef9455 100644 --- a/mctcore/src/main/java/gov/nasa/arc/mct/gui/FeedView.java +++ b/mctcore/src/main/java/gov/nasa/arc/mct/gui/FeedView.java @@ -24,7 +24,8 @@ import gov.nasa.arc.mct.components.AbstractComponent; import gov.nasa.arc.mct.components.FeedProvider; import gov.nasa.arc.mct.services.component.ViewInfo; - +import gov.nasa.arc.mct.util.property.MCTProperties; + import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -36,10 +37,13 @@ import java.util.Set; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; - + import javax.swing.SwingWorker; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is the super class for feed displays. All feed views are painted by periodic feed data @@ -49,10 +53,12 @@ *
  • Override {@link #updateFromFeed(Map)} to refresh the view with the incoming data set.
  • * */ -public abstract class FeedView extends View { +public abstract class FeedView extends View { + private static final Logger logger = LoggerFactory.getLogger(FeedView.class); private static final long serialVersionUID = 1L; - private static final int PAINT_RATE = 250; // paint rate in milliseconds - private static final FeedRenderingPool feedPool = new FeedRenderingPool(PAINT_RATE); + private static final int PAINT_RATE = getPaintRate(); + private static final FeedRenderingPool feedPool = new FeedRenderingPool(PAINT_RATE); + /** * The maximum number of data points that are returned from a data request. This will cause the * requests to be split into a number of requests that the client will need to merge as they are completed. @@ -420,5 +426,20 @@ public static Set getAllActiveFeedManifestations() { static void resetLastDataRequestTimeToCurrentTime() { feedPool.resetLastDataRequestTimeToCurrentTime(); + } + + /** + * get Paint Rate from property file, or use the default value 250 milliseconds + * If the user input is in wrong format, log the error and use the default value + * @return paint rate + */ + private static int getPaintRate() { + int paint_rate = 250; + try { + paint_rate = Integer.parseInt(MCTProperties.DEFAULT_MCT_PROPERTIES.getProperty("mct.feed.paint.rate", "250")); + } catch (NumberFormatException ex) { + logger.warn("Wrong input format for mct.feed.paint.rate. Need to input an integer. Defaulting to 250 ms."); + } + return paint_rate; } } diff --git a/platform-assembly/src/main/resources/properties/mct.properties b/platform-assembly/src/main/resources/properties/mct.properties index bd29ff64..3e30c17c 100644 --- a/platform-assembly/src/main/resources/properties/mct.properties +++ b/platform-assembly/src/main/resources/properties/mct.properties @@ -59,6 +59,9 @@ default.user.group=Users # Menu names can be overridden here mct.menu.this=File +# Paint rate at which views of data feeds are refreshed, in milliseconds +mct.feed.paint.rate=250 + # change the set of packages made available on the OSGI bootclass loader org.osgi.framework.bootdelegation=javax.xml.bind, \ javax.accessibility,\