Search in sources :

Example 1 with AROUIPanelException

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));
}
Also used : AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) JLabel(javax.swing.JLabel) Cursor(java.awt.Cursor)

Example 2 with AROUIPanelException

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);
    }
}
Also used : GridBagLayout(java.awt.GridBagLayout) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) JLabel(javax.swing.JLabel)

Example 3 with AROUIPanelException

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;
}
Also used : JPanel(javax.swing.JPanel) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) JLabel(javax.swing.JLabel)

Example 4 with AROUIPanelException

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.");
    }
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) RRCStateMachineSimulationPanel3G(com.att.aro.ui.view.statistics.statemachine.RRCStateMachineSimulationPanel3G) RRCStateMachineSimulationPanelWiFi(com.att.aro.ui.view.statistics.statemachine.RRCStateMachineSimulationPanelWiFi) RRCStateMachineSimulationPanelLTE(com.att.aro.ui.view.statistics.statemachine.RRCStateMachineSimulationPanelLTE)

Example 5 with AROUIPanelException

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;
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException)

Aggregations

AROUIPanelException (com.att.aro.ui.exception.AROUIPanelException)11 JLabel (javax.swing.JLabel)4 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)2 Cursor (java.awt.Cursor)2 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 CacheControlResult (com.att.aro.core.bestpractice.pojo.CacheControlResult)1 ConnectionClosingResult (com.att.aro.core.bestpractice.pojo.ConnectionClosingResult)1 DuplicateContentResult (com.att.aro.core.bestpractice.pojo.DuplicateContentResult)1 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)1 UnnecessaryConnectionResult (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult)1 UsingCacheResult (com.att.aro.core.bestpractice.pojo.UsingCacheResult)1 AbstractRrcStateMachine (com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine)1 BurstAnalysisInfo (com.att.aro.core.packetanalysis.pojo.BurstAnalysisInfo)1 CacheEntry (com.att.aro.core.packetanalysis.pojo.CacheEntry)1 Diagnosis (com.att.aro.core.packetanalysis.pojo.Diagnosis)1 RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)1 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)1 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)1