use of com.att.aro.ui.exception.AROUIPanelException in project VideoOptimzer by attdevsupport.
the class TabPanelCommon method setTextAsLink.
public void setTextAsLink(Enum<?> enumParm, String value) {
if (enumParm == null) {
throw new AROUIPanelException("enumParm must be specified");
}
String key = getKeyFromEnum(enumParm);
StringBuilder text = new StringBuilder();
text.append("<html><a href=\"#\">");
text.append(value);
text.append("</a></html>");
setText(key, 1, text.toString());
JLabel infoLabel = labelContents.get(key);
infoLabel.setToolTipText(ResourceBundleHelper.getMessageString("trace.hyperlink"));
infoLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
use of com.att.aro.ui.exception.AROUIPanelException in project VideoOptimzer by attdevsupport.
the class TabPanelCommon method setText.
/**
* Sets the contents of label. Note: This is going away.
*
* @param key key of the bundle message (associated with the registered JLabel)
* @param value contents of this bucket
* @see #setText(String, int, String)
*/
private void setText(String key, String value) {
if (key == null || value == null || key.length() < 1) {
throw new AROUIPanelException("key and value must be specified");
}
JLabel infoLabel = labelContents.get(key);
if (infoLabel != null) {
((GridBagLayout) infoLabel.getParent().getLayout()).getConstraints(infoLabel);
infoLabel.setText(value);
}
}
use of com.att.aro.ui.exception.AROUIPanelException in project VideoOptimzer by attdevsupport.
the class TabPanelCommon method addLabelLine.
/**
* Registers two JLabel entities - one for the label text and one for the contents
* (contents populated later via setText).
*
* @param attributes Specification for the new JLabel label and label value entities
* @return
*/
public TabPanelCommonAttributes addLabelLine(TabPanelCommonAttributes attributes) {
if (attributes == null) {
throw new AROUIPanelException("attributes must be specified");
}
String labelText = attributes.getKey();
JLabel currentLabelContents = labelContents.get(labelText);
if (currentLabelContents == null) {
currentLabelContents = new JLabel();
currentLabelContents.setName(labelText + "_contents");
labelContents.put(labelText, currentLabelContents);
}
if (attributes.getContentsFontOverride() != null) {
currentLabelContents.setFont(attributes.getContentsFontOverride());
} else if (attributes.getContentsFont() != null) {
currentLabelContents.setFont(attributes.getContentsFont());
} else {
currentLabelContents.setFont(AroFonts.TEXT_FONT);
}
JLabel currentLabelContents2 = null;
if (labelContents2 != null) {
currentLabelContents2 = labelContents2.get(labelText);
if (currentLabelContents2 == null) {
currentLabelContents2 = new JLabel();
currentLabelContents2.setName(labelText + "_contents2");
labelContents2.put(labelText, currentLabelContents2);
}
if (attributes.getContentsFontOverride() != null) {
currentLabelContents2.setFont(attributes.getContentsFontOverride());
} else if (attributes.getContentsFont() != null) {
currentLabelContents2.setFont(attributes.getContentsFont());
} else {
currentLabelContents2.setFont(AroFonts.TEXT_FONT);
}
}
JLabel label = labels.get(labelText);
if (label == null) {
label = attributes.getLabelAlignmentOverride() != null ? new JLabel(resource.getString(labelText), attributes.getLabelAlignmentOverride()) : new JLabel(resource.getString(labelText));
label.setName(labelText + "_label");
if (attributes.getLabelFontOverride() != null) {
label.setFont(attributes.getLabelFontOverride());
} else if (attributes.getLabelFont() != null) {
label.setFont(attributes.getLabelFont());
} else if (attributes.isTitle()) {
label.setFont(AroFonts.TITLE_FONT);
} else if (attributes.isHeader()) {
label.setFont(AroFonts.HEADER_FONT_16);
} else if (attributes.isSubheader()) {
label.setFont(AroFonts.SUBHEADER_FONT);
} else {
label.setFont(AroFonts.LABEL_FONT);
}
labels.put(labelText, label);
}
JPanel dataPanel = getCurrentDataPanel();
dataPanel.add(label, getLabelConstraints(attributes));
dataPanel.add(currentLabelContents, getContentsConstraints(attributes));
if (attributes.getContents().length() > 0) {
currentLabelContents.setText(attributes.getContents());
}
if (currentLabelContents2 != null) {
if (attributes.getContents2().length() > 0) {
currentLabelContents2.setText(attributes.getContents2());
}
dataPanel.add(currentLabelContents2, getContentsConstraints2(attributes));
}
return attributes;
}
use of com.att.aro.ui.exception.AROUIPanelException in project VideoOptimzer by attdevsupport.
the class StatisticsTab method layoutRrcStateMachineSimulator.
/**
* 3G, LTE, and WiFi render different attributes for the RRC sub-panel on the statics tab.
* This takes care of ensuring the right ones are used.
*
* @param rrcStateMachineType
*/
private void layoutRrcStateMachineSimulator(RrcStateMachineType rrcStateMachineType) {
switch(rrcStateMachineType) {
case Type3G:
rrcStateMachineSimulationPanel3G = new RRCStateMachineSimulationPanel3G();
if (rrcStateMachineSimulationPanelLTE != null) {
mainPanel.remove(rrcStateMachineSimulationPanelLTE);
}
if (rrcStateMachineSimulationPanelWiFi != null) {
mainPanel.remove(rrcStateMachineSimulationPanelWiFi);
}
rrcStateMachineSimulationPanelLTE = null;
rrcStateMachineSimulationPanelWiFi = null;
mainPanel.add(rrcStateMachineSimulationPanel3G, new GridBagConstraints(0, 9, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
break;
case LTE:
rrcStateMachineSimulationPanelLTE = new RRCStateMachineSimulationPanelLTE();
if (rrcStateMachineSimulationPanel3G != null) {
mainPanel.remove(rrcStateMachineSimulationPanel3G);
}
if (rrcStateMachineSimulationPanelWiFi != null) {
mainPanel.remove(rrcStateMachineSimulationPanelWiFi);
}
rrcStateMachineSimulationPanel3G = null;
rrcStateMachineSimulationPanelWiFi = null;
mainPanel.add(rrcStateMachineSimulationPanelLTE, new GridBagConstraints(0, 9, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
break;
case WiFi:
rrcStateMachineSimulationPanelWiFi = new RRCStateMachineSimulationPanelWiFi();
if (rrcStateMachineSimulationPanel3G != null) {
mainPanel.remove(rrcStateMachineSimulationPanel3G);
}
if (rrcStateMachineSimulationPanelLTE != null) {
mainPanel.remove(rrcStateMachineSimulationPanelLTE);
}
rrcStateMachineSimulationPanel3G = null;
rrcStateMachineSimulationPanelLTE = null;
mainPanel.add(rrcStateMachineSimulationPanelWiFi, new GridBagConstraints(0, 9, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
break;
default:
throw new AROUIPanelException("Energy render implementation not available.");
}
}
use of com.att.aro.ui.exception.AROUIPanelException in project VideoOptimzer by attdevsupport.
the class EnergyEfficiencySimulation3G method getRrcStateMachineValue.
private String[] getRrcStateMachineValue(PacketAnalyzerResult analyzerResult, LabelKeys labelKey, String[] valueString) {
RrcStateMachine3G rrcStateMachine = (RrcStateMachine3G) analyzerResult.getStatemachine();
Double originalValue = null;
valueString[0] = "";
switch(analyzerResult.getStatemachine().getType()) {
case Type3G:
switch(labelKey) {
case energy_dch:
originalValue = rrcStateMachine.getDchEnergy();
break;
case energy_fach:
originalValue = rrcStateMachine.getFachEnergy();
break;
case energy_idle:
originalValue = rrcStateMachine.getIdleEnergy();
break;
case energy_idle2dch:
originalValue = rrcStateMachine.getIdleToDchEnergy();
break;
case energy_fach2dch:
originalValue = rrcStateMachine.getFachToDchEnergy();
break;
case energy_dchTail:
originalValue = rrcStateMachine.getDchTailEnergy();
break;
case energy_fachTail:
originalValue = rrcStateMachine.getFachTailEnergy();
break;
case energy_rrcTotal:
originalValue = rrcStateMachine.getTotalRRCEnergy();
break;
case energy_jpkb:
originalValue = rrcStateMachine.getJoulesPerKilobyte();
break;
default:
break;
}
break;
default:
throw new AROUIPanelException("Bad rrc state machine machine type " + analyzerResult.getStatemachine().getType() + " for expected type of 3G");
}
if (originalValue != null) {
valueString[0] = String.format("%1.2f", originalValue);
}
return valueString;
}
Aggregations