@Override public void updatePanel(CloudBalance cloudBalance) { Set<CloudComputer> deadCloudComputerSet = new LinkedHashSet<>(computerToPanelMap.keySet()); deadCloudComputerSet.remove(null); for (CloudComputer computer : cloudBalance.getComputerList()) { deadCloudComputerSet.remove(computer); CloudComputerPanel computerPanel = computerToPanelMap.get(computer); if (computerPanel == null) { computerPanel = new CloudComputerPanel(this, computer); computersPanel.add(computerPanel); computerToPanelMap.put(computer, computerPanel); } computerPanel.clearProcesses(); } unassignedPanel.clearProcesses(); for (CloudProcess process : cloudBalance.getProcessList()) { CloudComputer computer = process.getComputer(); CloudComputerPanel computerPanel = computerToPanelMap.get(computer); computerPanel.addProcess(process); } for (CloudComputer deadComputer : deadCloudComputerSet) { CloudComputerPanel deadComputerPanel = computerToPanelMap.remove(deadComputer); computersPanel.remove(deadComputerPanel); } for (CloudComputerPanel computerPanel : computerToPanelMap.values()) { computerPanel.update(); } // If computersPanel.add() or computersPanel.remove() was called, the component needs to be validated. computersPanel.validate(); }
@Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { boolean visible = e.getItem().toString().equals("CSV"); delimiterPanel.setVisible(visible); quotesPanel.setVisible(visible); mainPanel.validate(); ExportDialog.this.pack(); } } });
/** * This shows the stream in text for any of it's filtered or unfiltered version. * @param document StyledDocument instance that holds the text. * @param toolTipController ToolTipController instance. */ void showStreamText(StyledDocument document, ToolTipController toolTipController) { contentPanel.removeAll(); StreamTextView textView = new StreamTextView(document, toolTipController); contentPanel.add(textView.getView(), BorderLayout.CENTER); contentPanel.validate(); }
/** * This shows the stream as image. * @param image BufferedImage instance that holds the text. */ void showStreamImage(BufferedImage image) { contentPanel.removeAll(); contentPanel.add(new StreamImageView(image).getView(), BorderLayout.CENTER); contentPanel.validate(); }
private void displayResult(JComponent tableView) { resultTreePanel.invalidate(); resultTreePanel.removeAll(); resultTreePanel.add(new JBScrollPane(tableView)); resultTreePanel.validate(); }
private void selectSubCategory(SubCategory subCategory) { List<Example> examples = subCategory.examples; examplesPanel.removeAll(); for (final Example e : examples) { ExampleButton b = new ExampleButton(e.title, new ImageIcon(e.thumbnail)); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { openExample(e); } }); examplesPanel.add(b); } updateExamplesPanelSize(); examplesPanel.validate(); examplesPanel.repaint(); }
private void selectCategory(Category category) { subCategoriesPanel.removeAll(); final List<SubCategory> subCategories = category.subCategories; for (final SubCategory subCategory : subCategories) { final SubCategoryButton b = new SubCategoryButton(subCategory); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { for (Component c : subCategoriesPanel.getComponents()) { SubCategoryButton b = (SubCategoryButton) c; b.setSelected(false); } b.setSelected(true); selectSubCategory(subCategory); } }); subCategoriesPanel.add(b); } subCategoriesPanel.validate(); subCategoriesPanel.repaint(); ((SubCategoryButton) subCategoriesPanel.getComponent(0)).setSelected(true); selectSubCategory(subCategories.get(0)); }
/** * Refresh the examples browser by loading everything from disk. */ private void reload() { final List<Category> categories = parseCategories(examplesDir); categoriesPanel.removeAll(); for (final Category category : categories) { final CategoryButton b = new CategoryButton(category); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { for (Component c : categoriesPanel.getComponents()) { CategoryButton b = (CategoryButton) c; b.setSelected(false); } b.setSelected(true); selectCategory(category); } }); categoriesPanel.add(b); } categoriesPanel.validate(); categoriesPanel.repaint(); ((CategoryButton) categoriesPanel.getComponent(0)).setSelected(true); selectCategory(categories.get(0)); }
centerPanel.add(categoryList, BorderLayout.WEST); centerPanel.add(nodeScroll, BorderLayout.CENTER); centerPanel.validate();
void initCombo(final ComboBox combobox, final JPanel parentPanel) { combobox.setModel(new DefaultComboBoxModel<>(JsonDataType.values())); combobox.setRenderer(new ColoredListCellRenderer() { @Override protected void customizeCellRenderer(JList jList, Object o, int i, boolean b, boolean b2) { append(((JsonDataType) o).type); } }); combobox.setSelectedItem(null); combobox.addItemListener(itemEvent -> { JsonDataType selectedType = (JsonDataType) combobox.getSelectedItem(); currentEditor = UI_COMPONENT_BY_JSON_DATATYPE.get(selectedType); currentEditor.reset(); parentPanel.invalidate(); parentPanel.removeAll(); parentPanel.add(currentEditor.getComponent(), BorderLayout.CENTER); parentPanel.validate(); }); combobox.setSelectedItem(JsonDataType.STRING); }
@Override public void run(@NotNull ProgressIndicator indicator) { try { UIUtil.invokeLaterIfNeeded(() -> loadingDecorator.startLoading(false)); final MongoQueryOptions queryOptions = wayPoint.getQueryOptions(); if (!useCachedResults) { currentResults = mongoManager.findMongoDocuments( configuration, wayPoint.getCollection(), queryOptions); } UIUtil.invokeLaterIfNeeded(() -> { resultPanel.updateResultView(currentResults, pagination); rowCountLabel.setText(String.format("%s documents", currentResults.getDocuments().size())); initActions(resultPanel.resultTreeTableView); }); } catch (final Exception ex) { UIUtil.invokeLaterIfNeeded(() -> { errorPanel.invalidate(); errorPanel.removeAll(); errorPanel.add(new ErrorPanel(ex), BorderLayout.CENTER); errorPanel.validate(); errorPanel.setVisible(true); }); } finally { UIUtil.invokeLaterIfNeeded(loadingDecorator::stopLoading); } } });
@Override public void removeUpdate(DocumentEvent e) { tabName.repaint(); parent.validate(); }
@Override public void run() { // Register component instance with the layout on the fly jPanelMain.removeAll(); jPanelMain.add( descriptor.getComponent(), BorderLayout.CENTER ); jPanelMain.validate(); jPanelMain.repaint(); } } );
@Override public void changedUpdate(DocumentEvent e) { tabName.repaint(); parent.validate(); } });
public void addRobotButton(JButton b) { if (b instanceof RobotButton) { robotButtons.add((RobotButton) b); } getRobotButtonsPanel().add(b); b.setVisible(true); getRobotButtonsPanel().validate(); }
public void run() { Component[] components = workflowPanel.getComponents(); for (int i = 0; i < components.length; i++) { workflowPanel.remove(components[i]); } workflowPanel.validate(); Container cont = workflowPanel; while (cont != null) { cont.validate(); cont = cont.getParent(); } }
public void run() { Component[] components = workflowPanel.getComponents(); for (int i = 0; i < components.length; i++) { workflowPanel.remove(components[i]); } workflowPanel.validate(); Container cont = workflowPanel; while (cont != null) { cont.validate(); cont = cont.getParent(); } }
private void revalidateDetailsPanel() { detailsPanel.invalidate(); repaint(); if (detailsPanel.getParent() != null) { detailsPanel.getParent().validate(); } else { detailsPanel.validate(); } }
private void revalidateDetailsPanel() { detailsPanel.invalidate(); repaint(); if (detailsPanel.getParent() != null) { detailsPanel.getParent().validate(); } else { detailsPanel.validate(); } }