/** * Gets the icon of a component based on it's {@link ComponentDescriptor}. * * @param descriptor * @param newWidth * @return */ public static ImageIcon getDescriptorIcon(final ComponentDescriptor<?> descriptor, final int newWidth) { return getDescriptorIcon(descriptor, newWidth, false); }
public static ImageIcon getDescriptorIcon(final ComponentDescriptor<?> descriptor) { return getDescriptorIcon(descriptor, ICON_SIZE_LARGE); }
@Override public Icon getIcon() { return IconUtils.getDescriptorIcon(_descriptor, IconUtils.ICON_SIZE_MENU_ITEM, false); }
private static Image getBannerImage(final ComponentBuilder componentBuilder) { final ImageIcon descriptorIcon = IconUtils.getDescriptorIcon(componentBuilder.getDescriptor(), IconUtils.ICON_SIZE_LARGE); return descriptorIcon.getImage(); }
public String getIconSrc(final int width) throws IOException { // Attach the image final Image descriptorIcon = IconUtils.getDescriptorIcon(_componentDescriptor, width).getImage(); /* We need a buffered image type in order to obtain the */ final BufferedImage bufferedImage = ComponentDocumentationBuilder.toBufferedImage(descriptorIcon); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] imageInByte; try { ImageIO.write(bufferedImage, "png", baos); imageInByte = baos.toByteArray(); } finally { FileHelper.safeClose(baos); } /* Encode the image */ final String encodedImage = Base64.encodeBase64String(imageInByte); /* * Atach the prefix that will make html <img> know how to decode the * image */ return HTMLBASE64_PREFIX + encodedImage; }
public static Icon getDescriptorIcon(final ComponentDescriptor<?> descriptor, final boolean configured, final int iconWidth) { if (descriptor instanceof HasIcon) { final ImageIcon imageIcon = getIconFromData(descriptor, iconWidth); if (imageIcon != null) { return imageIcon; } } final ImageIcon descriptorIcon = getDescriptorIcon(descriptor, iconWidth); if (configured) { return descriptorIcon; } return addErrorOverlay(descriptorIcon); }
private void showComponentPopupMenu(final Object userObject, final MouseEvent mouseEvent) { final ComponentDescriptor<?> componentDescriptor = (ComponentDescriptor<?>) userObject; if (SwingUtilities.isLeftMouseButton(mouseEvent) && mouseEvent.getClickCount() > 1) { _analysisJobBuilder.addComponent(componentDescriptor); } else if (SwingUtilities.isRightMouseButton(mouseEvent)) { final JMenuItem addTableItem = WidgetFactory.createMenuItem("Add component", IconUtils.getDescriptorIcon(componentDescriptor, IconUtils.ICON_SIZE_MENU_ITEM, false)); addTableItem.addActionListener(e -> _analysisJobBuilder.addComponent(componentDescriptor)); final JMenuItem referenceDocumentationItem = WidgetFactory.createMenuItem("Documentation", IconUtils.MENU_DOCUMENTATION); referenceDocumentationItem.addActionListener( new ComponentReferenceDocumentationActionListener(_analysisJobBuilder.getConfiguration(), componentDescriptor)); final JPopupMenu popup = new JPopupMenu(componentDescriptor.getDisplayName()); popup.add(addTableItem); popup.add(referenceDocumentationItem); popup.show((Component) mouseEvent.getSource(), mouseEvent.getX(), mouseEvent.getY()); } }
public Tab<AnalyzerResultPanel> getOrCreateResultPanel(final ComponentJob componentJob, final boolean finished) { synchronized (_resultPanels) { final Tab<AnalyzerResultPanel> existingTab = _resultPanels.get(componentJob); if (existingTab != null) { return existingTab; } String title = LabelUtils.getLabel(componentJob, false, false, false); if (title.length() > 40) { title = title.substring(0, 39) + "..."; } final Icon icon = IconUtils.getDescriptorIcon(componentJob.getDescriptor(), IconUtils.ICON_SIZE_TAB); final AnalyzerResultPanel resultPanel = new AnalyzerResultPanel(_rendererFactory, _progressInformationPanel, componentJob); final Tab<AnalyzerResultPanel> tab = _tabbedPane.addTab(title, icon, resultPanel); tab.setTooltip(LabelUtils.getLabel(componentJob, false, true, true)); _resultPanels.put(componentJob, tab); return tab; } }
@Override protected JComponent getDialogContent() { final AnalyzerDescriptor<CreateExcelSpreadsheetAnalyzer> descriptor = excelOutputAnalyzerBuilder.getDescriptor(); final CloseableTabbedPane tabbedPane = new CloseableTabbedPane(true); tabbedPane.addTab(descriptor.getDisplayName(), IconUtils.getDescriptorIcon(descriptor, IconUtils.ICON_SIZE_TAB), presenter.createJComponent()); tabbedPane.setUnclosableTab(0); return tabbedPane; }
panel.setBackground(WidgetUtils.BG_COLOR_DARK); final JLabel iconLabel = new JLabel(IconUtils.getDescriptorIcon(_descriptor, IconUtils.ICON_SIZE_LARGE)); iconLabel.setBorder(new EmptyBorder(0, 0, 0, 10)); iconLabel.setOpaque(false);
@Override protected JComponent getDialogContent() { final AnalyzerDescriptor<CreateCsvFileAnalyzer> descriptor = csvOutputAnalyzerBuilder.getDescriptor(); final CloseableTabbedPane tabbedPane = new CloseableTabbedPane(true); tabbedPane.addTab(descriptor.getDisplayName(), IconUtils.getDescriptorIcon(descriptor, IconUtils.ICON_SIZE_TAB), presenter.createJComponent()); tabbedPane.setUnclosableTab(0); return tabbedPane; }
public AnalyzerResultPanel(final RendererFactory rendererFactory, final ProgressInformationPanel progressInformationPanel, final ComponentJob componentJob) { super(WidgetUtils.COLOR_DEFAULT_BACKGROUND); _rendererFactory = rendererFactory; _progressInformationPanel = progressInformationPanel; _componentJob = componentJob; setBorder(new EmptyBorder(10, 10, 10, 10)); setLayout(new BorderLayout()); final ComponentDescriptor<?> descriptor = componentJob.getDescriptor(); final Icon icon = IconUtils.getDescriptorIcon(descriptor, IconUtils.ICON_SIZE_TASK_PANE); final String headerText = getHeaderText(); final JLabel header1 = createHeader(icon, headerText, WidgetUtils.FONT_HEADER1, WidgetUtils.BG_COLOR_DARK); final JLabel header2 = createHeader(null, getSubHeaderText(componentJob, headerText), WidgetUtils.FONT_SMALL, WidgetUtils.BG_COLOR_BLUE_MEDIUM); final DCPanel headerPanel = new DCPanel(); headerPanel.setLayout(new VerticalLayout(4)); headerPanel.add(header1); headerPanel.add(header2); headerPanel.setBorder(new EmptyBorder(0, 0, 4, 0)); add(headerPanel, BorderLayout.NORTH); _loadingIcon = new LoadingIcon(); add(_loadingIcon, BorderLayout.CENTER); }
.getTreeCellRendererComponent(tree, descriptor.getDisplayName(), selected, expanded, leaf, row, hasFocus); icon = IconUtils.getDescriptorIcon(descriptor, IconUtils.ICON_SIZE_MENU_ITEM, false); } else if (value instanceof String) { if (LIBRARY_STRING.equals(value)) {