public PhysicalLocationPanel(OWLEditorKit owlEditorKit, Set<OWLOntology> ontologies) { this.owlEditorKit = owlEditorKit; this.ontologies.addAll(ontologies); setLayout(new BorderLayout(3, 3)); ontologiesPanel = new MList(){ protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<>(super.getButtons(value)); buttons.add(new ReloadMListButton(e -> handleReload())); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(new ShowFileMListButton(e -> handleShowFile())); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(new SaveMListButton(e -> handleSave())); } return buttons; } }; ontologiesPanel.setCellRenderer(new OntologyListCellRenderer()); load(); JPanel boxHolder = new JPanel(new BorderLayout()); boxHolder.setOpaque(false); boxHolder.add(ontologiesPanel, BorderLayout.NORTH); add(ComponentFactory.createScrollPane(boxHolder), BorderLayout.CENTER); }
private void createUI() { setLayout(new BorderLayout(3, 3)); reload = new ReloadMListButton(); showFile = new ShowFileMListButton(); saveFile = new SaveMListButton(); ontologiesPanel = new MList(){ protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<MListButton>(super.getButtons(value)); buttons.add(reload); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(showFile); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(saveFile); } return buttons; } }; ontologiesPanel.setCellRenderer(new OntologyListCellRenderer()); load(); JPanel boxHolder = new JPanel(new BorderLayout()); boxHolder.setOpaque(false); boxHolder.add(ontologiesPanel, BorderLayout.NORTH); add(ComponentFactory.createScrollPane(boxHolder), BorderLayout.CENTER); }
private void createUI() { setLayout(new BorderLayout(3, 3)); reload = new ReloadMListButton(); showFile = new ShowFileMListButton(); saveFile = new SaveMListButton(); ontologiesPanel = new MList(){ protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<MListButton>(super.getButtons(value)); buttons.add(reload); OWLOntology ont = ((OntologyListItem)value).ont; if (owlEditorKit.getModelManager().getOntologyPhysicalURI(ont).getScheme().equals("file")){ buttons.add(showFile); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(saveFile); } return buttons; } }; ontologiesPanel.setCellRenderer(new OntologyListCellRenderer()); load(); JPanel boxHolder = new JPanel(new BorderLayout()); boxHolder.setOpaque(false); boxHolder.add(ontologiesPanel, BorderLayout.NORTH); add(ComponentFactory.createScrollPane(boxHolder), BorderLayout.CENTER); }
public PhysicalLocationPanel(OWLEditorKit owlEditorKit, Set<OWLOntology> ontologies) { this.owlEditorKit = owlEditorKit; this.ontologies.addAll(ontologies); setLayout(new BorderLayout(3, 3)); ontologiesPanel = new MList(){ protected List<MListButton> getButtons(Object value) { List<MListButton> buttons = new ArrayList<>(super.getButtons(value)); buttons.add(new ReloadMListButton(e -> handleReload())); OWLOntology ont = ((OntologyListItem)value).ont; URI ontologyPhysicalURI = owlEditorKit.getModelManager().getOntologyPhysicalURI(ont); if (UIUtil.isLocalFile(ontologyPhysicalURI)){ buttons.add(new ShowFileMListButton(e -> handleShowFile())); } if (owlEditorKit.getModelManager().getDirtyOntologies().contains(ont)){ buttons.add(new SaveMListButton(e -> handleSave())); } return buttons; } }; ontologiesPanel.setCellRenderer(new OntologyListCellRenderer()); load(); JPanel boxHolder = new JPanel(new BorderLayout()); boxHolder.setOpaque(false); boxHolder.add(ontologiesPanel, BorderLayout.NORTH); add(ComponentFactory.createScrollPane(boxHolder), BorderLayout.CENTER); }