/** * Sets the agent name. * * @param agentName * Agent name. * @param agentImg * Image to go next to the agent name. If <code>null</code> is passed no changed to * the current image will be done. */ public void setAgent(String agentName, Image agentImg) { agentLabel.setText(TextFormatter.clearLineBreaks(TextFormatter.crop(agentName, MAX_TEXT_LENGTH))); agentLabel.setToolTipText(agentName); if (null != agentImg) { agentLabel.setImage(agentImg); } }
/** * {@inheritDoc} */ @Override protected StyledString getStyledText(Object element, int index) { if (element instanceof IEnvironmentProvider) { Environment environment = ((IEnvironmentProvider) element).getEnvironment(); switch (index) { case 0: return new StyledString(environment.getName()); case 1: if (null != environment.getUpdatedDate()) { return new StyledString(NumberFormatter.formatTime(environment.getUpdatedDate())); } else { return new StyledString(NumberFormatter.formatTime(environment.getCreatedDate())); } case 2: if (CollectionUtils.isEmpty(environment.getProfileIds())) { return new StyledString(String.valueOf(0)); } else { return new StyledString(String.valueOf(environment.getProfileIds().size())); } case 3: return TextFormatter.emptyStyledStringIfNull(TextFormatter.clearLineBreaks(environment.getDescription())); default: return EMPTY; } } return EMPTY; }
/** * Updates the combo menu with agents. */ private void updateAgentsCombo() { agentsCombo.removeAll(); if ((null != availableAgents) && !availableAgents.isEmpty()) { agentsCombo.setEnabled(true); int i = 0; int selectedIndex = -1; for (PlatformIdent platformIdent : availableAgents) { agentsCombo.add(TextFormatter.getAgentDescription(platformIdent)); if (ObjectUtils.equals(platformIdent, displayedAgent)) { selectedIndex = i; } i++; } if (-1 != selectedIndex) { agentsCombo.select(selectedIndex); } } else { agentsCombo.setEnabled(false); } mainForm.getHead().layout(); }
styledString.append('[', StyledString.DECORATIONS_STYLER); String status = tags.get(Tags.HTTP_STATUS.getKey()); styledString.append(getHttpStatusStyledString(status)); styledString.append("] ", StyledString.DECORATIONS_STYLER); styledString.append(getFqnAbbreviated(runnableType)); return styledString; styledString.append(methodIdent.getMethodName() + "() - " + getFqnAbbreviated(methodIdent.getFQN()));
styledString.append('[', StyledString.DECORATIONS_STYLER); String status = tags.get(Tags.HTTP_STATUS.getKey()); styledString.append(getHttpStatusStyledString(status)); styledString.append(" | ", StyledString.DECORATIONS_STYLER); styledString.append(StringUtils.defaultString(tags.get(Tags.HTTP_METHOD.getKey()), "?"), StyledString.DECORATIONS_STYLER); styledString.append(getFqnAbbreviated(runnableType)); return styledString; styledString.append(getMethodWithParameters(methodIdent) + " - " + methodIdent.getFQN());
styledString = new StyledString(TextFormatter.crop(TextFormatter.clearLineBreaks(errorMessage), MAX_ERROR_MSG_SIZE)); } else { invocations = data.getInvocationParentsIdSet().size(); return TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations);
table.addContentRow("Description:", null, new DetailsCellContent[] { new DetailsCellContent(TextFormatter.getSpanDetailsFull(span, repositoryDefinition.getCachedDataService()).toString()) }); new DetailsCellContent(ImageFormatter.getPropagationImage(span.getPropagationType()), TextFormatter.getPropagationStyled(span.getPropagationType()).toString()) }); new DetailsCellContent[] { new DetailsCellContent(ImageFormatter.getReferenceImage(span.getReferenceType()), TextFormatter.getDescriptiveReference(span)) });
switch (enumId) { case PARAMETERS: return new StyledString(TextFormatter.getSqlParametersText(data.getParameterValues())); case INVOCATION_AFFILLIATION: int percentage = (int) (data.getInvocationAffiliationPercentage() * 100); invocations = data.getInvocationParentsIdSet().size(); return TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations); case COUNT: return new StyledString(Long.toString(data.getCount()));
/** * Returns the styled text for a specific column. * * @param data * The data object to extract the information from. * @param enumId * The enumeration ID. * @return The styled string containing the information from the data object. */ private StyledString getStyledTextForColumn(AggregatedExceptionSensorData data, Column enumId) { switch (enumId) { case FQN: return new StyledString(data.getThrowableType()); case INVOCATION_AFFILLIATION: int percentage = (int) (data.getInvocationAffiliationPercentage() * 100); int invocations = 0; if (null != data.getInvocationParentsIdSet()) { invocations = data.getInvocationParentsIdSet().size(); } return TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations); case CREATED: return new StyledString(String.valueOf(data.getCreated())); case RETHROWN: return new StyledString(String.valueOf(data.getPassed())); case HANDLED: return new StyledString(String.valueOf(data.getHandled())); default: return new StyledString("error"); } }
switch (enumId) { case ELEMENT: return TextFormatter.getStyledMethodString(methodIdent); case START_DELTA: InvocationSequenceData root = data; styledString = new StyledString(); if (InvocationSequenceDataHelper.hasSQLData(data)) { styledString.append(TextFormatter.clearLineBreaks(data.getSqlStatementData().getSqlWithParameterValues())); styledString.append(parameterContentData.getName()); styledString.append("': "); styledString.append(TextFormatter.clearLineBreaks(parameterContentData.getContent()));
return new StyledString(methodIdent.getClassName()); case METHOD: return new StyledString(TextFormatter.getMethodWithParameters(methodIdent)); case INVOCATION_AFFILLIATION: int percentage = (int) (data.getInvocationAffiliationPercentage() * 100); invocations = data.getInvocationParentsIdSet().size(); return TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations); case COUNT: return new StyledString(String.valueOf(data.getCount()));
/** * {@inheritDoc} */ @Override protected StyledString getStyledText(Object element, int index) { if (element instanceof IApplicationProvider) { ApplicationDefinition appDef = ((IApplicationProvider) element).getApplication(); switch (index) { case 0: return new StyledString(appDef.getApplicationName()); case 1: return new StyledString(String.valueOf(appDef.getBusinessTransactionDefinitions().size())); case 2: return new StyledString(TextFormatter.clearLineBreaks(StringUtils.defaultString(appDef.getDescription()))); default: return EMPTY; } } return EMPTY; }
/** * Updates the form title. Sub-classes can extend if needed. */ protected void updateFormTitle() { if (null != displayedCmrRepositoryDefinition) { mainForm.setImage(ImageFormatter.getCmrRepositoryImage(displayedCmrRepositoryDefinition, true)); mainForm.setText(displayedCmrRepositoryDefinition.getName()); mainForm.setToolTipText(TextFormatter.getCmrRepositoryDescription(displayedCmrRepositoryDefinition)); mainForm.setMessage(null); } else { mainForm.setImage(null); mainForm.setText("No repository exists"); mainForm.setMessage("Repositories can be added from the Repository Manager", IMessageProvider.WARNING); mainForm.setToolTipText(null); } }
/** * Validates the current input. */ private void validateInput() { final String alertId = alertIDText.getText().trim(); alert = StringUtils.isEmpty(alertId) ? null : availableAlerts.get(alertId); // NOPMD if (null == alert) { okButton.setEnabled(false); if (StringUtils.isEmpty(alertId)) { AlertSelectionDialog.this.setMessage("No alert id specified!", IMessageProvider.ERROR); } else { AlertSelectionDialog.this.setMessage("There is no alert with id '" + alertId + "'!", IMessageProvider.ERROR); } } else { okButton.setEnabled(true); AlertSelectionDialog.this.setMessage( "Selected alert:\n" + TextFormatter.getAlertDescription(alert), IMessageProvider.INFORMATION); } }
/** * {@inheritDoc} */ @Override public DetailsTable generate(DefaultData defaultData, RepositoryDefinition repositoryDefinition, Composite parent, FormToolkit toolkit) { InvocationAwareData invocationAwareData = (InvocationAwareData) defaultData; DetailsTable table = new DetailsTable(parent, toolkit, "Invocation Affiliation", 1); table.addContentRow("In Invocations:", null, new DetailsCellContent[] { new YesNoDetailsCellContent(!invocationAwareData.isOnlyFoundOutsideInvocations()) }); if (!invocationAwareData.isOnlyFoundOutsideInvocations()) { int percentage = (int) (invocationAwareData.getInvocationAffiliationPercentage() * 100); int invocations = invocationAwareData.getInvocationParentsIdSet().size(); String affiliation = TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations).getString(); table.addContentRow("Affiliation:", null, new DetailsCellContent[] { new DetailsCellContent(affiliation) }); } return table; }
/** * Sets the description. * * @param view * View description. * @param viewImg * Image to go next to the view description. If <code>null</code> is passed no * changed to the current image will be done. */ public void setView(String view, Image viewImg) { viewLabel.setText(TextFormatter.clearLineBreaks(view)); viewLabel.setToolTipText(view); if (null != viewImg) { viewLabel.setImage(viewImg); } layoutInternal(); }
/** * Updates the form title. */ private void updateFormTitle() { if (null != displayedRepositoryDefinition) { if (displayedRepositoryDefinition instanceof CmrRepositoryDefinition) { CmrRepositoryDefinition cmrRepositoryDefinition = (CmrRepositoryDefinition) displayedRepositoryDefinition; mainForm.setImage(ImageFormatter.getCmrRepositoryImage(cmrRepositoryDefinition, true)); mainForm.setText(cmrRepositoryDefinition.getName()); mainForm.setToolTipText(TextFormatter.getCmrRepositoryDescription(cmrRepositoryDefinition)); } else if (displayedRepositoryDefinition instanceof StorageRepositoryDefinition) { StorageRepositoryDefinition storageRepositoryDefinition = (StorageRepositoryDefinition) displayedRepositoryDefinition; mainForm.setImage(ImageFormatter.getStorageRepositoryImage(storageRepositoryDefinition)); mainForm.setText(storageRepositoryDefinition.getName()); mainForm.setToolTipText(getStorageDescirption(storageRepositoryDefinition)); } mainForm.setMessage(null); } else { mainForm.setImage(null); mainForm.setText("No repository loaded"); mainForm.setMessage("Repositories can be loaded from Repository or Storage Manager", IMessageProvider.WARNING); mainForm.setToolTipText(null); } }
/** * Creates {@link InputDefinition} for Alert-Invocations view. * * @param cmrRepository * CMR Repository definition. * @param alert * The alert. * @return The {@link InputDefinition} instance. */ private InputDefinition createInputDefinition(CmrRepositoryDefinition cmrRepository, Alert alert) { InputDefinition inputDefinition = new InputDefinition(); inputDefinition.setRepositoryDefinition(cmrRepository); AlertInputDefinitionExtra alertInputExtra = new AlertInputDefinitionExtra(); alertInputExtra.setAlert(alert); inputDefinition.addInputDefinitonExtra(InputDefinitionExtrasMarkerFactory.ALERT_EXTRAS_MARKER, alertInputExtra); inputDefinition.setId(SensorTypeEnum.ALERT_INVOCATION); EditorPropertiesData editorPropertiesData = new EditorPropertiesData(); editorPropertiesData.setSensorImage(SensorTypeEnum.ALERT_INVOCATION.getImage()); editorPropertiesData.setSensorName("Alert Invocation Sequences"); editorPropertiesData.setViewImage(ImageFormatter.getAlertImage(alert)); editorPropertiesData.setViewName(TextFormatter.getAlertDescription(alert)); inputDefinition.setEditorPropertiesData(editorPropertiesData); IdDefinition idDefinition = new IdDefinition(); idDefinition.setPlatformId(0); inputDefinition.setIdDefinition(idDefinition); return inputDefinition; }
/** * Sets the title text and image. * * @param group * Group description. * @param groupdImg * Image to go next to the title. If <code>null</code> is passed no changed to the * current image will be done. */ public void setGroup(String group, Image groupdImg) { groupLabel.setText(TextFormatter.clearLineBreaks(TextFormatter.crop(group, MAX_TEXT_LENGTH))); groupLabel.setToolTipText(group); if (null != groupdImg) { groupLabel.setImage(groupdImg); } layoutInternal(); }
/** * {@inheritDoc} */ @Override protected StyledString getStyledText(Object element, int index) { if (element instanceof IProfileProvider) { Profile profile = ((IProfileProvider) element).getProfile(); switch (index) { case 0: return new StyledString(profile.getName()); case 1: if (null != profile.getUpdatedDate()) { return new StyledString(NumberFormatter.formatTime(profile.getUpdatedDate())); } else { return new StyledString(NumberFormatter.formatTime(profile.getCreatedDate())); } case 5: return TextFormatter.emptyStyledStringIfNull(TextFormatter.clearLineBreaks(profile.getDescription())); default: return EMPTY; } } return EMPTY; }