public AppSubscriptionsPanel( final ClientDavConnection connection, final ClientApplication clientApplication, final DavApplication dav) { super(new BorderLayout()); _jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); ApplicationSubscriptionInfo subscriptionInfo; try { subscriptionInfo = connection.getSubscriptionInfo(dav, clientApplication); } catch (IOException e) { subscriptionInfo = null; e.printStackTrace(); JOptionPane.showMessageDialog( this, "Konnte die Anmeldungen nicht auflisten. " + e.getMessage()); } final TitledBorder sendBorder = BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Sende-Anmeldungen"); final TitledBorder receiveBorder = BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Empfangs-Anmeldungen"); final TitledBorder labelBorder = BorderFactory.createTitledBorder("Details"); final JComponent paneSend = new JPanel(new BorderLayout()); _senderList = new JList( new MyListModel( subscriptionInfo == null ? Collections.emptyList() : subscriptionInfo.getSenderSubscriptions())); paneSend.add(new JScrollPane(_senderList), BorderLayout.CENTER); final JComponent paneReceive = new JPanel(new BorderLayout()); _receiverList = new JList( new MyListModel( subscriptionInfo == null ? Collections.emptyList() : subscriptionInfo.getReceiverSubscriptions())); paneReceive.add(new JScrollPane(_receiverList), BorderLayout.CENTER); paneSend.setBorder(sendBorder); paneReceive.setBorder(receiveBorder); _jSplitPane.setLeftComponent(paneSend); _jSplitPane.setRightComponent(paneReceive); _jSplitPane.setResizeWeight(0.5); _senderList.addMouseListener(new MyMouseListener(_senderList)); _receiverList.addMouseListener(new MyMouseListener(_receiverList)); _senderList.setFocusable(false); _receiverList.setFocusable(false); this.add(_jSplitPane, BorderLayout.CENTER); _label = new JEditorPane("text/html", ""); _label.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); _label.setFont(_label.getFont().deriveFont(Font.PLAIN)); _label.setBorder(labelBorder); _label.setEditable(false); final JScrollPane pane = new JScrollPane(_label); pane.setBorder(BorderFactory.createEmptyBorder()); pane.setPreferredSize(new Dimension(400, 160)); this.add(pane, BorderLayout.SOUTH); }
/** * Creates a JEditorPane (for viewing the web) and puts it in a panel and returns it * * @param pageURL the URL of the page to open in this text pane * @param width, height */ public static JPanel createEditorPane(String pageURL, int width, int height) { // build editor pane JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.setFont(FontManager.PREFERRED_FONT); // set the page java.net.URL url = null; try { url = new java.net.URL(pageURL); } catch (java.net.MalformedURLException m) { // bad URL System.err.println("Bad url! " + m); } if (url != null) { try { editorPane.setPage(url); } catch (java.io.IOException io) { // error with setting page // System.err.println("Error loading page " + url); } } // enable hyperlinks editorPane.addHyperlinkListener( new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { Utils.browse(evt.getURL().toString()); } } }); // put it in a scroll pane JScrollPane scrollPane = new JScrollPane(editorPane); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy( JScrollPane .HORIZONTAL_SCROLLBAR_AS_NEEDED); // mostly for the license, which has preformatted text // put it in a JPanel JPanel panel = new JPanel(new java.awt.BorderLayout()); panel.add(scrollPane); panel.setPreferredSize(new java.awt.Dimension(width, height)); return panel; }
public CodePane(SimpleEventManager _sem) throws Exception { this.sem = _sem; sem.addListener(this); Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12); text = new JEditorPane(); text.getDocument() .addDocumentListener( new DocumentListener() { public void changedUpdate(DocumentEvent arg0) { onChange(); } public void insertUpdate(DocumentEvent arg0) { onChange(); } public void removeUpdate(DocumentEvent arg0) { onChange(); } }); text.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent ke) { // TODO Auto-generated method stub if (ke.isControlDown() && (ke.getKeyCode() == KeyEvent.VK_S)) { sem.fireEvent("save", null, null); } } public void keyReleased(KeyEvent arg0) {} public void keyTyped(KeyEvent arg0) {} }); text.setFont(font); setLayout(new BorderLayout()); add(new JScrollPane(text)); }
public void setEditorFont(Font f) { editor.setFont(f); }
public void initializeMainView( final SuperAdapter superAdapter, Container contentPane, Dimension bigPanelDim, Dimension panelDim) { contentPane.setLayout(new BorderLayout()); final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); contentPane.add(mainPanel, BorderLayout.CENTER); mainPanel.setBackground(Color.white); final JPanel toolbarPanel = new JPanel(); toolbarPanel.setBorder(null); toolbarPanel.setLayout(new GridBagLayout()); mainPanel.add(toolbarPanel, BorderLayout.NORTH); JPanel bigPanel = new JPanel(); bigPanel.setLayout(new BorderLayout()); bigPanel.setBackground(Color.white); bigPanel.setPreferredSize(new Dimension(bigPanelDim)); bigPanel.setMaximumSize(new Dimension(bigPanelDim)); bigPanel.setMinimumSize(new Dimension(bigPanelDim)); JPanel bottomPanel = new JPanel(); bottomPanel.setBackground(Color.white); JMenuBar menuBar = null; try { menuBar = superAdapter.createMenuBar(); } catch (Exception e) { e.printStackTrace(); } assert menuBar != null; contentPane.add(menuBar, BorderLayout.NORTH); GridBagConstraints toolbarConstraints = new GridBagConstraints(); toolbarConstraints.anchor = GridBagConstraints.LINE_START; toolbarConstraints.fill = GridBagConstraints.HORIZONTAL; toolbarConstraints.gridx = 0; toolbarConstraints.gridy = 0; toolbarConstraints.weightx = 0.1; // --- Chromosome panel --- JPanel chrSelectionPanel = new JPanel(); toolbarPanel.add(chrSelectionPanel, toolbarConstraints); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setLayout(new BorderLayout()); JPanel chrLabelPanel = new JPanel(); JLabel chrLabel = new JLabel("Chromosomes"); chrLabel.setHorizontalAlignment(SwingConstants.CENTER); chrLabelPanel.setBackground(HiCGlobals.backgroundColor); chrLabelPanel.setLayout(new BorderLayout()); chrLabelPanel.add(chrLabel, BorderLayout.CENTER); chrSelectionPanel.add(chrLabelPanel, BorderLayout.PAGE_START); JPanel chrButtonPanel = new JPanel(); chrButtonPanel.setBackground(new Color(238, 238, 238)); chrButtonPanel.setLayout(new BoxLayout(chrButtonPanel, BoxLayout.X_AXIS)); // ---- chrBox1 ---- chrBox1 = new JComboBox<Chromosome>(); chrBox1.setModel( new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)})); chrBox1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); chrBox1.setPreferredSize(new Dimension(95, 70)); chrButtonPanel.add(chrBox1); // ---- chrBox2 ---- chrBox2 = new JComboBox<Chromosome>(); chrBox2.setModel( new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)})); chrBox2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); chrBox2.setPreferredSize(new Dimension(95, 70)); chrButtonPanel.add(chrBox2); // ---- refreshButton ---- refreshButton = new JideButton(); refreshButton.setIcon( new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { superAdapter.safeRefreshButtonActionPerformed(); } }); refreshButton.setPreferredSize(new Dimension(24, 24)); chrButtonPanel.add(refreshButton); chrBox1.setEnabled(false); chrBox2.setEnabled(false); refreshButton.setEnabled(false); chrSelectionPanel.add(chrButtonPanel, BorderLayout.CENTER); chrSelectionPanel.setMinimumSize(new Dimension(200, 70)); chrSelectionPanel.setPreferredSize(new Dimension(210, 70)); // ======== Display Option Panel ======== JPanel displayOptionPanel = new JPanel(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); JPanel displayOptionLabelPanel = new JPanel(); displayOptionLabelPanel.setBackground(HiCGlobals.backgroundColor); displayOptionLabelPanel.setLayout(new BorderLayout()); JLabel displayOptionLabel = new JLabel("Show"); displayOptionLabel.setHorizontalAlignment(SwingConstants.CENTER); displayOptionLabelPanel.add(displayOptionLabel, BorderLayout.CENTER); displayOptionPanel.add(displayOptionLabelPanel, BorderLayout.PAGE_START); JPanel displayOptionButtonPanel = new JPanel(); displayOptionButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10)); displayOptionButtonPanel.setLayout(new GridLayout(1, 0, 20, 0)); displayOptionComboBox = new JComboBox<MatrixType>(); displayOptionComboBox.setModel( new DefaultComboBoxModel<MatrixType>(new MatrixType[] {MatrixType.OBSERVED})); displayOptionComboBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { superAdapter.safeDisplayOptionComboBoxActionPerformed(); normalizationComboBox.setEnabled(!isWholeGenome()); } }); displayOptionButtonPanel.add(displayOptionComboBox); displayOptionPanel.add(displayOptionButtonPanel, BorderLayout.CENTER); displayOptionPanel.setMinimumSize(new Dimension(140, 70)); displayOptionPanel.setPreferredSize(new Dimension(140, 70)); displayOptionPanel.setMaximumSize(new Dimension(140, 70)); toolbarConstraints.gridx = 1; toolbarConstraints.weightx = 0.1; toolbarPanel.add(displayOptionPanel, toolbarConstraints); displayOptionComboBox.setEnabled(false); // ======== Normalization Panel ======== JPanel normalizationPanel = new JPanel(); normalizationPanel.setBackground(new Color(238, 238, 238)); normalizationPanel.setBorder(LineBorder.createGrayLineBorder()); normalizationPanel.setLayout(new BorderLayout()); JPanel normalizationLabelPanel = new JPanel(); normalizationLabelPanel.setBackground(HiCGlobals.backgroundColor); normalizationLabelPanel.setLayout(new BorderLayout()); JLabel normalizationLabel = new JLabel("Normalization"); normalizationLabel.setHorizontalAlignment(SwingConstants.CENTER); normalizationLabelPanel.add(normalizationLabel, BorderLayout.CENTER); normalizationPanel.add(normalizationLabelPanel, BorderLayout.PAGE_START); JPanel normalizationButtonPanel = new JPanel(); normalizationButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10)); normalizationButtonPanel.setLayout(new GridLayout(1, 0, 20, 0)); normalizationComboBox = new JComboBox<String>(); normalizationComboBox.setModel( new DefaultComboBoxModel<String>(new String[] {NormalizationType.NONE.getLabel()})); normalizationComboBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { superAdapter.safeNormalizationComboBoxActionPerformed(e); } }); normalizationButtonPanel.add(normalizationComboBox); normalizationPanel.add(normalizationButtonPanel, BorderLayout.CENTER); normalizationPanel.setPreferredSize(new Dimension(180, 70)); normalizationPanel.setMinimumSize(new Dimension(140, 70)); toolbarConstraints.gridx = 2; toolbarConstraints.weightx = 0.1; toolbarPanel.add(normalizationPanel, toolbarConstraints); normalizationComboBox.setEnabled(false); // ======== Resolution Panel ======== hiCPanel = new JPanel(); hiCPanel.setBackground(Color.white); hiCPanel.setLayout(new HiCLayout()); bigPanel.add(hiCPanel, BorderLayout.CENTER); JPanel wrapGapPanel = new JPanel(); wrapGapPanel.setBackground(Color.white); wrapGapPanel.setMaximumSize(new Dimension(5, 5)); wrapGapPanel.setMinimumSize(new Dimension(5, 5)); wrapGapPanel.setPreferredSize(new Dimension(5, 5)); wrapGapPanel.setBorder(LineBorder.createBlackLineBorder()); bigPanel.add(wrapGapPanel, BorderLayout.EAST); // splitPanel.insertPane(hiCPanel, 0); // splitPanel.setBackground(Color.white); // ---- rulerPanel2 ---- JPanel topPanel = new JPanel(); topPanel.setBackground(Color.green); topPanel.setLayout(new BorderLayout()); hiCPanel.add(topPanel, BorderLayout.NORTH); trackLabelPanel = new TrackLabelPanel(superAdapter.getHiC()); trackLabelPanel.setBackground(Color.white); hiCPanel.add(trackLabelPanel, HiCLayout.NORTH_WEST); trackPanelX = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.X); trackPanelX.setMaximumSize(new Dimension(4000, 50)); trackPanelX.setPreferredSize(new Dimension(1, 50)); trackPanelX.setMinimumSize(new Dimension(1, 50)); trackPanelX.setVisible(false); topPanel.add(trackPanelX, BorderLayout.NORTH); rulerPanelX = new HiCRulerPanel(superAdapter.getHiC()); rulerPanelX.setMaximumSize(new Dimension(4000, 50)); rulerPanelX.setMinimumSize(new Dimension(1, 50)); rulerPanelX.setPreferredSize(new Dimension(1, 50)); rulerPanelX.setBorder(null); topPanel.add(rulerPanelX, BorderLayout.SOUTH); // ---- rulerPanel1 ---- JPanel leftPanel = new JPanel(); leftPanel.setBackground(Color.white); leftPanel.setLayout(new BorderLayout()); hiCPanel.add(leftPanel, BorderLayout.WEST); trackPanelY = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.Y); trackPanelY.setMaximumSize(new Dimension(50, 4000)); trackPanelY.setPreferredSize(new Dimension(50, 1)); trackPanelY.setMinimumSize(new Dimension(50, 1)); trackPanelY.setVisible(false); leftPanel.add(trackPanelY, BorderLayout.WEST); rulerPanelY = new HiCRulerPanel(superAdapter.getHiC()); rulerPanelY.setMaximumSize(new Dimension(50, 4000)); rulerPanelY.setPreferredSize(new Dimension(50, 800)); rulerPanelY.setBorder(null); rulerPanelY.setMinimumSize(new Dimension(50, 1)); leftPanel.add(rulerPanelY, BorderLayout.EAST); // ---- heatmapPanel ---- // Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); // int panelSize = screenDimension.height - 210; int panelWidth = (int) panelDim.getWidth(); int panelHeight = (int) panelDim.getHeight(); System.err.println("Window W: " + panelWidth + " H" + panelHeight); JPanel wrapHeatmapPanel = new JPanel(new BorderLayout()); wrapHeatmapPanel.setMaximumSize(new Dimension(panelDim)); wrapHeatmapPanel.setMinimumSize(new Dimension(panelDim)); wrapHeatmapPanel.setPreferredSize(new Dimension(panelDim)); wrapHeatmapPanel.setBackground(Color.BLUE); wrapHeatmapPanel.setVisible(true); heatmapPanel = new HeatmapPanel(superAdapter); heatmapPanel.setMaximumSize(new Dimension(panelWidth - 5, panelHeight - 5)); heatmapPanel.setMinimumSize(new Dimension(panelWidth - 5, panelHeight - 5)); heatmapPanel.setPreferredSize(new Dimension(panelWidth - 5, panelHeight - 5)); heatmapPanel.setBackground(Color.white); wrapHeatmapPanel.add(heatmapPanel, BorderLayout.CENTER); // hiCPanel.setMaximumSize(new Dimension(panelWidth, panelHeight)); // hiCPanel.setMinimumSize(new Dimension(panelWidth, panelHeight)); // hiCPanel.setPreferredSize(new Dimension(panelWidth, panelHeight)); hiCPanel.add(wrapHeatmapPanel, BorderLayout.CENTER); // ======== Resolution Slider Panel ======== // Resolution panel resolutionSlider = new ResolutionControl(superAdapter); resolutionSlider.setPreferredSize(new Dimension(200, 70)); resolutionSlider.setMinimumSize(new Dimension(150, 70)); toolbarConstraints.gridx = 3; toolbarConstraints.weightx = 0.1; toolbarPanel.add(resolutionSlider, toolbarConstraints); // ======== Color Range Panel ======== colorRangePanel = new JColorRangePanel(superAdapter, heatmapPanel, preDefMapColor); toolbarConstraints.gridx = 4; toolbarConstraints.weightx = 0.5; toolbarPanel.add(colorRangePanel, toolbarConstraints); goPanel = new GoToPanel(superAdapter); toolbarConstraints.gridx = 5; toolbarConstraints.weightx = 0.25; toolbarPanel.add(goPanel, toolbarConstraints); // not sure this is working // toolbarPanel.setPreferredSize(new Dimension(panelHeight,100)); toolbarPanel.setEnabled(false); // ======== Right side panel ======== JPanel rightSidePanel = new JPanel(new BorderLayout()); // (new BorderLayout()); rightSidePanel.setBackground(Color.white); rightSidePanel.setPreferredSize(new Dimension(210, 1000)); rightSidePanel.setMaximumSize(new Dimension(10000, 10000)); // ======== Bird's view mini map ======== JPanel thumbPanel = new JPanel(); thumbPanel.setLayout(new BorderLayout()); // ---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(superAdapter); thumbnailPanel.setBackground(Color.white); thumbnailPanel.setMaximumSize(new Dimension(210, 210)); thumbnailPanel.setMinimumSize(new Dimension(210, 210)); thumbnailPanel.setPreferredSize(new Dimension(210, 210)); // JPanel gapPanel = new JPanel(); // gapPanel.setMaximumSize(new Dimension(1, 1)); // rightSidePanel.add(gapPanel,BorderLayout.WEST); thumbPanel.add(thumbnailPanel, BorderLayout.CENTER); thumbPanel.setBackground(Color.white); rightSidePanel.add(thumbPanel, BorderLayout.NORTH); // ========= mouse hover text ====== JPanel tooltipPanel = new JPanel(new BorderLayout()); tooltipPanel.setBackground(Color.white); tooltipPanel.setPreferredSize(new Dimension(210, 490)); mouseHoverTextPanel = new JEditorPane(); mouseHoverTextPanel.setEditable(false); mouseHoverTextPanel.setContentType("text/html"); mouseHoverTextPanel.setFont(new Font("sans-serif", 0, 20)); mouseHoverTextPanel.setBackground(Color.white); mouseHoverTextPanel.setBorder(null); int mouseTextY = rightSidePanel.getBounds().y + rightSidePanel.getBounds().height; // *Dimension prefSize = new Dimension(210, 490); Dimension prefSize = new Dimension(210, 390); mouseHoverTextPanel.setPreferredSize(prefSize); JScrollPane tooltipScroller = new JScrollPane(mouseHoverTextPanel); tooltipScroller.setBackground(Color.white); tooltipScroller.setBorder(null); tooltipPanel.setPreferredSize(new Dimension(210, 500)); tooltipPanel.add(tooltipScroller); tooltipPanel.setBounds(new Rectangle(new Point(0, mouseTextY), prefSize)); tooltipPanel.setBackground(Color.white); tooltipPanel.setBorder(null); rightSidePanel.add(tooltipPanel, BorderLayout.CENTER); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right + 20; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); mainPanel.add(bigPanel, BorderLayout.CENTER); mainPanel.add(rightSidePanel, BorderLayout.EAST); }
public NcmlEditor(JPanel buttPanel, PreferencesExt prefs) { this.prefs = prefs; fileChooser = new FileManager(null, null, null, (PreferencesExt) prefs.node("FileManager")); AbstractAction coordAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { addCoords = (Boolean) getValue(BAMutil.STATE); String tooltip = addCoords ? "add Coordinates is ON" : "add Coordinates is OFF"; coordButt.setToolTipText(tooltip); } }; addCoords = prefs.getBoolean("coordState", false); String tooltip2 = addCoords ? "add Coordinates is ON" : "add Coordinates is OFF"; BAMutil.setActionProperties(coordAction, "addCoords", tooltip2, true, 'C', -1); coordAction.putValue(BAMutil.STATE, Boolean.valueOf(addCoords)); coordButt = BAMutil.addActionToContainer(buttPanel, coordAction); protoChooser = new ComboBox((PreferencesExt) prefs.node("protoChooser")); addProtoChoices(); buttPanel.add(protoChooser); protoChooser.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String ptype = (String) protoChooser.getSelectedItem(); String proto = protoMap.get(ptype); if (proto != null) { editor.setText(proto); } } }); editor = new JEditorPane(); // Instantiate a XMLEditorKit with wrapping enabled. XMLEditorKit kit = new XMLEditorKit(false); // Set the wrapping style. kit.setWrapStyleWord(true); editor.setEditorKit(kit); // Set the font style. editor.setFont(new Font("Monospaced", Font.PLAIN, 12)); // Set the tab size editor.getDocument().putProperty(PlainDocument.tabSizeAttribute, 2); // Enable auto indentation. editor.getDocument().putProperty(XMLDocument.AUTO_INDENTATION_ATTRIBUTE, true); // Enable tag completion. editor.getDocument().putProperty(XMLDocument.TAG_COMPLETION_ATTRIBUTE, true); // Initialise the folding kit.setFolding(true); // Set a style kit.setStyle(XMLStyleConstants.ATTRIBUTE_NAME, Color.RED, Font.BOLD); // Put the editor in a panel that will force it to resize, when a different view is choosen. ScrollableEditorPanel editorPanel = new ScrollableEditorPanel(editor); JScrollPane scroller = new JScrollPane(editorPanel); // Add the number margin as a Row Header View scroller.setRowHeaderView(new LineNumberMargin(editor)); AbstractAction wrapAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { XMLEditorKit kit = (XMLEditorKit) editor.getEditorKit(); kit.setLineWrappingEnabled(!kit.isLineWrapping()); editor.updateUI(); } }; BAMutil.setActionProperties(wrapAction, "Wrap", "Toggle Wrapping", false, 'W', -1); BAMutil.addActionToContainer(buttPanel, wrapAction); AbstractAction saveAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String location = (ds == null) ? ncmlLocation : ds.getLocation(); if (location == null) location = "test"; int pos = location.lastIndexOf("."); if (pos > 0) location = location.substring(0, pos); String filename = fileChooser.chooseFilenameToSave(location + ".ncml"); if (filename == null) return; if (doSaveNcml(editor.getText(), filename)) ncmlLocation = filename; } }; BAMutil.setActionProperties(saveAction, "Save", "Save NcML", false, 'S', -1); BAMutil.addActionToContainer(buttPanel, saveAction); AbstractAction netcdfAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (outChooser == null) { outChooser = new NetcdfOutputChooser((Frame) null); outChooser.addPropertyChangeListener( "OK", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { writeNetcdf((NetcdfOutputChooser.Data) evt.getNewValue()); } }); } String location = (ds == null) ? ncmlLocation : ds.getLocation(); if (location == null) location = "test"; int pos = location.lastIndexOf("."); if (pos > 0) location = location.substring(0, pos); outChooser.setOutputFilename(location); outChooser.setVisible(true); } }; BAMutil.setActionProperties(netcdfAction, "netcdf", "Write netCDF file", false, 'N', -1); BAMutil.addActionToContainer(buttPanel, netcdfAction); AbstractAction transAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { doTransform(editor.getText()); } }; BAMutil.setActionProperties( transAction, "Import", "read textArea through NcMLReader\n write NcML back out via resulting dataset", false, 'T', -1); BAMutil.addActionToContainer(buttPanel, transAction); AbstractButton compareButton = BAMutil.makeButtcon("Select", "Check NcML", false); compareButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Formatter f = new Formatter(); checkNcml(f); infoTA.setText(f.toString()); infoTA.gotoTop(); infoWindow.show(); } }); buttPanel.add(compareButton); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); // the info window infoTA = new TextHistoryPane(); infoWindow = new IndependentWindow("Extra Information", BAMutil.getImage("netcdfUI"), infoTA); infoWindow.setBounds( (Rectangle) prefs.getBean("InfoWindowBounds", new Rectangle(300, 300, 500, 300))); }