use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.
the class RequestResponseDetailsPanel method getJRequestResponseTable.
/**
* Initializes and returns the the DataTable that contains Http request and
* response informations.
*/
public DataTable<HttpRequestResponseInfo> getJRequestResponseTable() {
if (jRequestResponseTable == null) {
jRequestResponseTable = new DataTable<HttpRequestResponseInfo>(jRequestResponseTableModel);
jRequestResponseTable.setName(ResourceBundleHelper.getMessageString("diagnostics.request.response.view.tableName"));
jRequestResponseTable.setAutoCreateRowSorter(true);
jRequestResponseTable.setGridColor(Color.LIGHT_GRAY);
DataTablePopupMenu popupMenu = (DataTablePopupMenu) jRequestResponseTable.getPopup();
popupMenu.initialize();
jRequestResponseTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
// Enable view and save as buttons appropriately
HttpRequestResponseInfo httpRRInfo = jRequestResponseTable.getSelectedItem();
boolean validResponse = httpRRInfo != null && httpRRInfo.getContentLength() > 0 && httpRRInfo.getDirection() == HttpDirection.RESPONSE && httpRRInfo.getStatusCode() != 0;
boolean isVideo = (validResponse) ? ((httpRRInfo != null && httpRRInfo.getContentType() != null) ? httpRRInfo.getContentType().contains("video/") : false) : false;
boolean isApplicationZip = httpRRInfo != null && httpRRInfo.getContentType() != null && httpRRInfo.getContentType().contains("application/zip");
boolean isContentTypeAvailable = httpRRInfo != null && httpRRInfo.getContentType() != null;
getViewBtn().setEnabled(!isApplicationZip && !isVideo && validResponse && isContentTypeAvailable);
getSaveBtn().setEnabled(!isApplicationZip && validResponse && isContentTypeAvailable);
}
});
jRequestResponseTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
if (event.getClickCount() == 2 && getViewBtn().isEnabled()) {
try {
viewContent(jRequestResponseTable.getSelectedItem());
} catch (Exception e) {
LOG.error("Failed to open the content in the view window with unexpected error", e);
new MessageDialogFactory().showPlainDialog(RequestResponseDetailsPanel.this.getTopLevelAncestor(), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Message"), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Title"));
}
}
}
});
}
return jRequestResponseTable;
}
use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.
the class RequestResponseDetailsPanel method getViewBtn.
/**
* Initializes and returns the "View" button for the Request-Response Table.
*/
private JButton getViewBtn() {
if (viewBtn == null) {
viewBtn = new JButton(ResourceBundleHelper.getMessageString("button.View"));
viewBtn.setEnabled(false);
viewBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
viewContent(jRequestResponseTable.getSelectedItem());
} catch (Exception e) {
LOG.error("Failed to open the content in the view window with unexpected error", e);
new MessageDialogFactory().showPlainDialog(RequestResponseDetailsPanel.this.getTopLevelAncestor(), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Message"), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Title"));
}
}
});
}
return viewBtn;
}
use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.
the class ARODataCollectorMenu method chooseDevice.
private IAroDevice chooseDevice(IAroDevices aroDevices, List<IDataCollector> collectors) {
ArrayList<IAroDevice> deviceList = aroDevices.getDeviceList();
IAroDevice device = null;
int delayTimeDL = 0;
int throttleDL = 0;
int throttleUL = 0;
boolean throttleDLEnable = false;
boolean throttleULEnable = false;
boolean profileBoolean = false;
String traceFolderName = "";
String profileLocation = "";
if (((MainFrame) parent).getPreviousOptions() != null) {
previousOptions = ((MainFrame) parent).getPreviousOptions();
}
metaDataModel = new MetaDataModel();
DataCollectorSelectNStartDialog dialog = new DataCollectorSelectNStartDialog(((MainFrame) parent).getJFrame(), parent, deviceList, traceFolderName, collectors, true, previousOptions, metaDataModel);
if (dialog.getResponse()) {
device = dialog.getDevice();
traceFolderName = dialog.getTraceFolder();
device.setCollector(dialog.getCollectorOption());
/*debug purpose*/
delayTimeDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayDS();
dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayUS();
throttleDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleDL();
throttleUL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleUL();
throttleDLEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleDLEnabled();
throttleULEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleULEnabled();
profileLocation = dialog.getDeviceOptionPanel().getAttenuatorModel().getLocalPath();
profileBoolean = dialog.getDeviceOptionPanel().getAttenuatorModel().isLoadProfile();
LOG.info("set U delay: " + delayTimeDL + ", set D delay: " + delayTimeDL + ", set U throttle: " + throttleUL + ", set D throttle: " + throttleDL + ", set profile: " + profileBoolean + ", set profileLocation: " + profileLocation);
if (device.isPlatform(IAroDevice.Platform.iOS)) {
IDataCollector iosCollector = findIOSCollector(collectors);
if ((throttleDLEnable || throttleULEnable) && !NetworkUtil.isNetworkUp(SharedNetIF)) {
MessageDialogFactory.getInstance().showInformationDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.finalwarning"), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.noshared"));
return null;
}
if (!checkSetSuPassword(iosCollector)) {
return null;
} else {
LOG.info("pw validated");
}
}
String traceFolderPath = (device.getPlatform().equals(IAroDevice.Platform.Android)) ? Util.getAROTraceDirAndroid() + System.getProperty("file.separator") + traceFolderName : Util.getAROTraceDirIOS() + System.getProperty("file.separator") + traceFolderName;
String currentPath = ((MainFrame) parent).getTracePath();
if (fileManager.directoryExistAndNotEmpty(traceFolderPath)) {
int result = folderExistsDialog();
if (result == JOptionPane.OK_OPTION) {
if (traceFolderPath.equals(currentPath)) {
new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString("viewer.contentUnwritable"));
return null;
}
File mountPoint = fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT);
if (fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT).exists() && device.getPlatform().equals(IAroDevice.Platform.iOS)) {
IExternalProcessRunner runner = new ExternalProcessRunnerImpl();
String results = runner.executeCmd(String.format("umount %s;rmdir %s", mountPoint, mountPoint));
if (!results.isEmpty()) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " is BUSY");
return null;
} else {
int count = 0;
while (fileManager.directoryExistAndNotEmpty(mountPoint.toString())) {
if (++count > 5) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " will not release, please detach the iOS device and delete the foldere manually");
return null;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Log.error("sleep interrupted");
}
}
}
}
fileManager.deleteFolderContents(traceFolderPath);
} else {
return null;
}
}
Hashtable<String, Object> extras = prepareStartCollectorExtras(device, traceFolderName, dialog);
updateMetaData(device, traceFolderName, dialog);
extras.put("DIALOG_SIZE", dialog.getBaseSize());
if (dialog.getDeviceOptionPanel().getLabeledExpandedOptionFields().isVisible()) {
extras.put("MetaDataExpanded", true);
}
((MainFrame) parent).startCollector(device, traceFolderName, extras, metaDataModel);
} else {
traceFolderName = null;
}
dialog.dispose();
return device;
}
use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.
the class AROFileMenu method handlePrint.
private void handlePrint() {
final JComponent currentTabComponent = (JComponent) parent.getCurrentTabComponent();
if (currentTabComponent instanceof IAROPrintable) {
final IAROPrintable aroPrintable = (IAROPrintable) currentTabComponent;
final PrinterJob printJob = PrinterJob.getPrinterJob();
if (printJob.printDialog()) {
new Thread(new Runnable() {
@Override
public void run() {
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
printJob.setPrintable(new AROPrintablePanel(aroPrintable.getPrintablePanel()));
try {
printJob.print();
} catch (PrinterException e) {
String[] messageWrapper = new String[1];
messageWrapper[0] = e.getLocalizedMessage();
new MessageDialogFactory().showErrorDialog(null, tabPanelCommon.getText(MenuItem.error_printer, messageWrapper));
}
}
}).start();
}
} else {
throw new AROUIIllegalStateException(tabPanelCommon.getText(MenuItem.error_printer_notprintable));
}
}
use of com.att.aro.ui.commonui.MessageDialogFactory in project VideoOptimzer by attdevsupport.
the class AROFileMenu method openTraceFolderInTimeRange.
/**
* Choose a trace folder and transfer to time-range dialog
*
* @param aEvent
* @param isRecent
*/
private void openTraceFolderInTimeRange(ActionEvent aEvent) {
File traceFolder = null;
Object event = aEvent.getSource();
if (event instanceof JMenuItem) {
traceFolder = selectTraceFolder(aEvent, false);
if (traceFolder != null) {
try {
JDialog splash = new TransitionDialog(parent.getFrame(), "Preparing to open Time-Range chooser/editor dialog");
TimeRangeEditorDialog dialog;
dialog = displayTimeRangeEditor(traceFolder, false, splash);
if (dialog != null && dialog.isContinueWithAnalyze()) {
launchTraceFolderAnalysis(traceFolder, dialog.getTimeRange());
}
} catch (Exception e) {
LOG.error("Exception in TimeRangeDialog:", e);
new MessageDialogFactory().showErrorDialog(null, "Exception in TimeRangeDialog:" + e.getMessage());
}
} else {
LOG.error("failed to identify action event:" + aEvent.getClass().getName());
}
}
}
Aggregations