use of com.att.aro.core.configuration.pojo.ProfileType in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method getCalculateStatisticsButton.
/**
* Initializes and returns the Calculate Statistics button
*/
private JButton getCalculateStatisticsButton() {
if (calculateStatisticsButton == null) {
calculateStatisticsButton = new JButton();
calculateStatisticsButton.setText(resourceBundle.getString("menu.tools.timeRangeAnalysis.calculateStatistics.button"));
calculateStatisticsButton.setToolTipText(resourceBundle.getString("menu.tools.timeRangeAnalysis.calculateStatistics.button.tooltip"));
calculateStatisticsButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (currentTraceResult == null) {
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("menu.error.noTraceLoadedMessage"), resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
} else {
if (!updateCurrentfilter()) {
return;
}
if (!hasDataAfterFiltering(currentTraceResult.getFilter())) {
MessageDialogFactory.getInstance().showErrorDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.noResultDataError"));
return;
}
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.numberError"));
return;
}
// Rounding traceEndTime as getEndTimeTextField() to
// handle time comparison
Double traceEndTimeRounded = Double.valueOf(DECIMAL_FORMAT.format(traceEndTime + ROUNDING_VALUE));
if (startTime < endTime) {
if (startTime >= 0.0 && startTime <= traceEndTimeRounded && endTime >= 0.0 && endTime <= traceEndTimeRounded) {
TimeRangeAnalysis timeRangeAnalysis = new TimeRangeAnalysis(startTime, endTime, currentTraceResult, ((MainFrame) parent).getController());
String msg = null;
ProfileType profileType = currentTraceResult.getProfile().getProfileType();
if (profileType == ProfileType.T3G) {
msg = resourceBundle.getString("timerangeanalysis.3g");
} else if (profileType == ProfileType.LTE) {
msg = resourceBundle.getString("timerangeanalysis.lte");
} else if (profileType == ProfileType.WIFI) {
msg = resourceBundle.getString("timerangeanalysis.wifi");
}
timeRangeAnalysisResultsTextArea.setText(MessageFormat.format((msg == null ? "" : msg), doubleToFixedDecimal(startTime, 3), doubleToFixedDecimal(endTime, 3), timeRangeAnalysis.getPayloadLen(), timeRangeAnalysis.getTotalBytes(), timeRangeAnalysis.getUplinkBytes(), timeRangeAnalysis.getDownlinkBytes(), doubleToFixedDecimal(timeRangeAnalysis.getRrcEnergy(), 2), doubleToFixedDecimal(timeRangeAnalysis.getActiveTime(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageThroughput(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageUplinkThroughput(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageDownlinkThroughput(), 2) + getResultPanelNote(timeRangeAnalysis)));
timeRangeStartTime = startTime;
timeRangeEndTime = endTime;
} else {
String strErrorMessage = MessageFormat.format(resourceBundle.getString("timerangeanalysis.rangeError"), 0.00, doubleToFixedDecimal(traceEndTimeRounded, 3));
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = resourceBundle.getString("timerangeanalysis.startTimeError");
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
}
}
}
});
}
return calculateStatisticsButton;
}
use of com.att.aro.core.configuration.pojo.ProfileType in project VideoOptimzer by attdevsupport.
the class ProfileManager method createFromFile.
/**
* A factory method that creates a new profile of the proper type from the
* specified properties file
*
* @param file
* The properties file.
* @return The resulting profile object
* @throws IOException
* when an error occurs accessing the file
* @throws ProfileException
* when an error occurs reading the profile data
*/
public static Profile createFromFile(File file) throws IOException, ProfileException {
FileReader reader = new FileReader(file);
try {
Properties props = new Properties();
props.load(reader);
String stype = props.getProperty(PROFILE_TYPE);
ProfileType type = stype == null ? ProfileType.T3G : ProfileType.valueOf(stype);
switch(type) {
case T3G:
return profileFactory.create3G(props);
case LTE:
return profileFactory.createLTE(props);
case WIFI:
return profileFactory.createWiFi(props);
default:
throw new IllegalArgumentException("Invalid profile type: " + type);
}
} finally {
reader.close();
}
}
use of com.att.aro.core.configuration.pojo.ProfileType in project VideoOptimzer by attdevsupport.
the class ProfileFactoryImpl method create.
@Override
public Profile create(ProfileType typeParm, Properties prop) {
Profile prof = null;
ProfileType type = typeParm == null ? ProfileType.LTE : typeParm;
switch(type) {
case LTE:
prof = createLTE(prop);
break;
case T3G:
prof = create3G(prop);
break;
case WIFI:
prof = createWiFi(prop);
break;
default:
return null;
}
return prof;
}
use of com.att.aro.core.configuration.pojo.ProfileType in project VideoOptimzer by attdevsupport.
the class ProfileManager method getPredefinedProfile.
/**
* Loads the pre-defined profile with the specified name.
*
* @param name
* The name of a pre-defined profile returned by the
* getPredefinedProfileNames() method.
*
* @return The pre-defined profile, or null, if the profile is not found.
*
* @throws java.io.IOException
* - An unexpected exception that, occurs when there is an error
* reading the profile.
*
* @throws ProfileException
*/
public Profile getPredefinedProfile(String name) throws IOException, ProfileException {
String filename = predefinedProfiles.get(name);
if (filename != null) {
InputStream input = ProfileManager.class.getClassLoader().getResourceAsStream(filename);
if (input != null) {
try {
Properties prop = new Properties();
prop.load(input);
ProfileType type = ProfileType.T3G;
if (name.indexOf("3G") > 0) {
type = ProfileType.T3G;
} else if (name.indexOf("LTE") > 0) {
type = ProfileType.LTE;
} else if (name.indexOf("WiFi") > 0) {
type = ProfileType.WIFI;
} else {
return null;
}
if (profileFactory == null) {
profileFactory = ContextAware.getAROConfigContext().getBean(IProfileFactory.class);
}
Profile profile = profileFactory.create(type, prop);
profile.setName(name);
return profile;
} finally {
input.close();
}
}
}
// Return null when not successful
return null;
}
Aggregations