List of usage examples for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED
int HORIZONTAL_SCROLLBAR_AS_NEEDED
To view the source code for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_AS_NEEDED.
Click Source Link
From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java
private void setUpGui() { buildMenuBar();/*from www.j a v a 2 s. c o m*/ buildToolBar(); buildPopup(); buildTree(); BufferedImage image = null; try { image = ImageIO.read(getClass().getResource("/jFunk.png")); setIconImage(image); } catch (Exception e) { log.warn("Could not read icon image, standard icon will be used. Exception was: " + e.getMessage()); } setJMenuBar(menuBar); if (!readState()) { setSize(520, 600); setLocationRelativeTo(null); } final JScrollPane scrollPane = new JScrollPane(tree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); final Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(jPanelUtilities, BorderLayout.NORTH); contentPane.add(scrollPane, BorderLayout.CENTER); addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { exit(); } }); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.FormPane.java
/** * Creates a Pane for editing a Workbench as a form. * @param workbenchPane the workbench pane to be parented into * @param workbench the workbench/* www . ja va 2s.c o m*/ */ public FormPane(final WorkbenchPaneSS workbenchPane, final Workbench workbench, final boolean readOnly) { setLayout(null); this.workbenchPane = workbenchPane; this.workbench = workbench; this.readOnly = readOnly; dropFlavors.add(InputPanel.INPUTPANEL_FLAVOR); docListener = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { stateChange(); } }; changeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { stateChange(); } }; buildUI(); scrollPane = new JScrollPane(this, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); }
From source file:edu.ku.brc.ui.tmanfe.SpreadSheet.java
/** * //from www . j a v a 2 s . co m */ protected void buildSpreadsheet() { this.setShowGrid(true); int numRows = model.getRowCount(); scrollPane = new JScrollPane(this, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); setAutoResizeMode(JTable.AUTO_RESIZE_OFF); final SpreadSheet ss = this; JButton cornerBtn = UIHelper.createIconBtn("Blank", IconManager.IconSize.Std16, "SelectAll", new ActionListener() { public void actionPerformed(ActionEvent ae) { ss.selectAll(); } }); cornerBtn.setEnabled(true); scrollPane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, cornerBtn); // Allows row and collumn selections to exit at the same time setCellSelectionEnabled(true); setRowSelectionAllowed(true); setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mousePressed(java.awt.event.MouseEvent) */ @SuppressWarnings("synthetic-access") @Override public void mouseReleased(MouseEvent e) { // XXX For Java 5 Bug prevRowSelInx = getSelectedRow(); prevColSelInx = getSelectedColumn(); if (e.getClickCount() == 2) { int rowIndexStart = getSelectedRow(); int colIndexStart = getSelectedColumn(); ss.editCellAt(rowIndexStart, colIndexStart); if (ss.getEditorComponent() != null && ss.getEditorComponent() instanceof JTextComponent) { ss.getEditorComponent().requestFocus(); final JTextComponent txtComp = (JTextComponent) ss.getEditorComponent(); String txt = txtComp.getText(); FontMetrics fm = txtComp.getFontMetrics(txtComp.getFont()); int x = e.getPoint().x - ss.getEditorComponent().getBounds().x - 1; int prevWidth = 0; for (int i = 0; i < txt.length(); i++) { int width = fm.stringWidth(txt.substring(0, i)); int basePlusHalf = prevWidth + (int) (((width - prevWidth) / 2) + 0.5); //System.out.println(prevWidth + " X[" + x + "] " + width+" ["+txt.substring(0, i)+"] " + i + " " + basePlusHalf); //System.out.println(" X[" + x + "] " + prevWidth + " - "+ basePlusHalf+" - " + width+" ["+txt.substring(0, i)+"] " + i); if (x < width) { // Clearing the selection is needed for Window for some reason final int inx = i + (x <= basePlusHalf ? -1 : 0); SwingUtilities.invokeLater(new Runnable() { @SuppressWarnings("synthetic-access") public void run() { txtComp.setSelectionStart(0); txtComp.setSelectionEnd(0); txtComp.setCaretPosition(inx > 0 ? inx : 0); } }); break; } prevWidth = width; } } } } }); // Create a row-header to display row numbers. // This row-header is made of labels whose Borders, // Foregrounds, Backgrounds, and Fonts must be // the one used for the table column headers. // Also ensure that the row-header labels and the table // rows have the same height. //i have no idea WHY this has to be called. i rearranged //the table and find replace panel, // i started getting an array index out of //bounds on the column header ON MAC ONLY. //tried firing this off, first and it fixed the problem.//meg this.getModel().fireTableStructureChanged(); /* * Create the Row Header Panel */ rowHeaderPanel = new JPanel((LayoutManager) null); if (getColumnModel().getColumnCount() > 0) { TableColumn column = getColumnModel().getColumn(0); TableCellRenderer renderer = getTableHeader().getDefaultRenderer(); if (renderer == null) { renderer = column.getHeaderRenderer(); } Component cellRenderComp = renderer.getTableCellRendererComponent(this, column.getHeaderValue(), false, false, -1, 0); cellFont = cellRenderComp.getFont(); } else { cellFont = (new JLabel()).getFont(); } // Calculate Row Height cellBorder = (Border) UIManager.getDefaults().get("TableHeader.cellBorder"); Insets insets = cellBorder.getBorderInsets(tableHeader); FontMetrics metrics = getFontMetrics(cellFont); rowHeight = insets.bottom + metrics.getHeight() + insets.top; rowLabelWidth = metrics.stringWidth("9999") + insets.right + insets.left; Dimension dim = new Dimension(rowLabelWidth, rowHeight * numRows); rowHeaderPanel.setPreferredSize(dim); // need to call this when no layout manager is used. rhCellMouseAdapter = new RHCellMouseAdapter(this); // Adding the row header labels for (int ii = 0; ii < numRows; ii++) { addRow(ii, ii + 1, false); } JViewport viewPort = new JViewport(); dim.height = rowHeight * numRows; viewPort.setViewSize(dim); viewPort.setView(rowHeaderPanel); scrollPane.setRowHeader(viewPort); // Experimental from the web, but I think it does the trick. addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (!ss.isEditing() && !e.isActionKey() && !e.isControlDown() && !e.isMetaDown() && !e.isAltDown() && e.getKeyCode() != KeyEvent.VK_SHIFT && e.getKeyCode() != KeyEvent.VK_TAB && e.getKeyCode() != KeyEvent.VK_ENTER) { log.error("Grabbed the event as input"); int rowIndexStart = getSelectedRow(); int colIndexStart = getSelectedColumn(); if (rowIndexStart == -1 || colIndexStart == -1) return; ss.editCellAt(rowIndexStart, colIndexStart); Component c = ss.getEditorComponent(); if (c instanceof JTextComponent) ((JTextComponent) c).setText(""); } } }); resizeAndRepaint(); // Taken from a JavaWorld Example (But it works) KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false); Action ssAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { SpreadSheet.this.actionPerformed(e); } }; getInputMap().put(cut, "Cut"); getActionMap().put("Cut", ssAction); getInputMap().put(copy, "Copy"); getActionMap().put("Copy", ssAction); getInputMap().put(paste, "Paste"); getActionMap().put("Paste", ssAction); ((JMenuItem) UIRegistry.get(UIRegistry.COPY)).addActionListener(this); ((JMenuItem) UIRegistry.get(UIRegistry.CUT)).addActionListener(this); ((JMenuItem) UIRegistry.get(UIRegistry.PASTE)).addActionListener(this); setSortOrderCycle(SortOrder.ASCENDING, SortOrder.DESCENDING, SortOrder.UNSORTED); }
From source file:net.sf.keystore_explorer.gui.dialogs.extensions.DViewExtensions.java
private void initComponents() { ExtensionsTableModel extensionsTableModel = new ExtensionsTableModel(); jtExtensions = new JKseTable(extensionsTableModel); TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(extensionsTableModel); sorter.setComparator(2, new ObjectIdComparator()); jtExtensions.setRowSorter(sorter);//from w w w. j av a 2s .c om jtExtensions.setShowGrid(false); jtExtensions.setRowMargin(0); jtExtensions.getColumnModel().setColumnMargin(0); jtExtensions.getTableHeader().setReorderingAllowed(false); jtExtensions.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS); jtExtensions.setRowHeight(Math.max(18, jtExtensions.getRowHeight())); for (int i = 0; i < jtExtensions.getColumnCount(); i++) { TableColumn column = jtExtensions.getColumnModel().getColumn(i); column.setHeaderRenderer( new ExtensionsTableHeadRend(jtExtensions.getTableHeader().getDefaultRenderer())); column.setCellRenderer(new ExtensionsTableCellRend()); } TableColumn criticalCol = jtExtensions.getColumnModel().getColumn(0); criticalCol.setResizable(false); criticalCol.setMinWidth(28); criticalCol.setMaxWidth(28); criticalCol.setPreferredWidth(28); ListSelectionModel selectionModel = jtExtensions.getSelectionModel(); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectionModel.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { try { CursorUtil.setCursorBusy(DViewExtensions.this); updateExtensionValue(); } finally { CursorUtil.setCursorFree(DViewExtensions.this); } } } }); jspExtensionsTable = PlatformUtil.createScrollPane(jtExtensions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jspExtensionsTable.getViewport().setBackground(jtExtensions.getBackground()); jpExtensionsTable = new JPanel(new BorderLayout(5, 5)); jpExtensionsTable.setPreferredSize(new Dimension(500, 200)); jpExtensionsTable.add(jspExtensionsTable, BorderLayout.CENTER); jpExtensionValue = new JPanel(new BorderLayout(5, 5)); jlExtensionValue = new JLabel(res.getString("DViewExtensions.jlExtensionValue.text")); jpExtensionValue.add(jlExtensionValue, BorderLayout.NORTH); jepExtensionValue = new JEditorPane(); jepExtensionValue.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize())); jepExtensionValue.setEditable(false); jepExtensionValue.setToolTipText(res.getString("DViewExtensions.jtaExtensionValue.tooltip")); // JGoodies - keep uneditable color same as editable jepExtensionValue.putClientProperty("JTextArea.infoBackground", Boolean.TRUE); // for displaying URLs in extensions as clickable links jepExtensionValue.setContentType("text/html"); jepExtensionValue.addHyperlinkListener(this); // use default font and foreground color from the component jepExtensionValue.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); jspExtensionValue = PlatformUtil.createScrollPane(jepExtensionValue, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpExtensionValueTextArea = new JPanel(new BorderLayout(5, 5)); jpExtensionValueTextArea.setPreferredSize(new Dimension(500, 200)); jpExtensionValueTextArea.add(jspExtensionValue, BorderLayout.CENTER); jpExtensionValue.add(jpExtensionValueTextArea, BorderLayout.CENTER); jbAsn1 = new JButton(res.getString("DViewExtensions.jbAsn1.text")); PlatformUtil.setMnemonic(jbAsn1, res.getString("DViewExtensions.jbAsn1.mnemonic").charAt(0)); jbAsn1.setToolTipText(res.getString("DViewExtensions.jbAsn1.tooltip")); jbAsn1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { CursorUtil.setCursorBusy(DViewExtensions.this); asn1DumpPressed(); } finally { CursorUtil.setCursorFree(DViewExtensions.this); } } }); jpExtensionValueAsn1 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jpExtensionValueAsn1.add(jbAsn1); jpExtensionValue.add(jpExtensionValueAsn1, BorderLayout.SOUTH); jpExtensions = new JPanel(new GridLayout(2, 1, 5, 5)); jpExtensions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5)))); jpExtensions.add(jpExtensionsTable); jpExtensions.add(jpExtensionValue); jbOK = new JButton(res.getString("DViewExtensions.jbOK.text")); jbOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { okPressed(); } }); jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false); extensionsTableModel.load(extensions); if (extensionsTableModel.getRowCount() > 0) { jtExtensions.changeSelection(0, 0, false, false); } getContentPane().add(jpExtensions, BorderLayout.CENTER); getContentPane().add(jpOK, BorderLayout.SOUTH); setResizable(false); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { closeDialog(); } }); getRootPane().setDefaultButton(jbOK); pack(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jbOK.requestFocus(); } }); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopScrollBoxLayout.java
private void applyScrollBarPolicy(ScrollBarPolicy scrollBarPolicy) { switch (scrollBarPolicy) { case BOTH://ww w . java2s .c o m impl.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); impl.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); content.setWidth("-1px"); content.setHeight("-1px"); break; case HORIZONTAL: impl.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); impl.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); content.setWidth("-1px"); content.setHeight("100%"); break; case VERTICAL: impl.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); impl.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); content.setWidth("100%"); content.setHeight("-1px"); break; case NONE: impl.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); impl.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); content.setWidth("100%"); content.setHeight("100%"); break; } }
From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java
/** * Constructor. // w w w . j a v a2s .c o m */ public ImageFrame(final int mapSize, final WorkbenchPaneSS wbPane, final Workbench workbench, final Taskable task, final boolean isReadOnly) { this.wbPane = wbPane; this.workbench = workbench; try { this.workbenchTask = (WorkbenchTask) task; } catch (ClassCastException e) { this.workbenchTask = null; } this.allowCloseWindow = true; this.defaultThumbIcon = IconManager.getIcon("image", IconSize.Std32); setIconImage(IconManager.getImage("AppIcon").getImage()); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if (allowCloseWindow) { wbPane.toggleImageFrameVisible(); } } }); Dimension minSize = new Dimension(mapSize, mapSize); cardImageLabel.setHorizontalTextPosition(SwingConstants.CENTER); PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,p,5px,p,f:p:g")); CellConstraints cc = new CellConstraints(); loadImgBtn = createButton(getResourceString("WB_LOAD_NEW_IMAGE")); builder.add(createLabel(getResourceString("WB_NO_IMAGE_ROW"), SwingConstants.CENTER), cc.xy(2, 2)); builder.add(loadImgBtn, cc.xy(2, 4)); loadImgBtn.setVisible(!isReadOnly); noCardImageMessagePanel = builder.getPanel(); noCardImageMessagePanel.setPreferredSize(minSize); noCardImageMessagePanel.setSize(minSize); builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,c:p,f:p:g")); builder.add(createLabel(getResourceString("WB_NO_ROW_SELECTED"), SwingConstants.CENTER), cc.xy(2, 2)); noRowSelectedMessagePanel = builder.getPanel(); noRowSelectedMessagePanel.setPreferredSize(minSize); noRowSelectedMessagePanel.setSize(minSize); mainPane = new JPanel(new BorderLayout()); mainPane.setSize(minSize); mainPane.setPreferredSize(minSize); mainPane.setMinimumSize(minSize); mainPane.add(cardImageLabel, BorderLayout.CENTER); scrollPane = new JScrollPane(mainPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); statusBar = new JStatusBar(); thumbnailer = new ImageThumbnailGenerator(); thumbnailer.setMaxSize(256, 256); thumbnailer.setQuality(1); tray = new ThumbnailTray(); tray.getModel().removeAllElements(); tray.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } setImageIndex(tray.getSelectedIndex()); } }); JPanel southPanel = new JPanel(); southPanel.setLayout(new BorderLayout()); //southPanel.add(indexSlider,BorderLayout.NORTH); southPanel.add(tray, BorderLayout.CENTER); southPanel.add(statusBar, BorderLayout.SOUTH); JPanel basePanel = new JPanel(); basePanel.setLayout(new BorderLayout()); basePanel.add(scrollPane, BorderLayout.CENTER); basePanel.add(southPanel, BorderLayout.SOUTH); setContentPane(basePanel); JMenuBar menuBar = new JMenuBar(); String title = "FileMenu"; String mneu = "FileMneu"; JMenu fileMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu); title = "WB_IMPORT_CARDS_TO_DATASET"; mneu = "WB_IMPORT_CARDS_MNEU"; if (!isReadOnly) { JMenuItem importImagesMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, null); importImagesMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { importImages(); } }); } /* title = "ImageFrame.CLOSE"; mneu = "ImageFrame.CloseMneu"; closeMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, null); closeMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { ImageFrame.this.setVisible(false); } });*/ title = "ImageFrame.View"; mneu = "ImageFrame.ViewMneu"; viewMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu); reduceMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_REDUCED_SIZE", "ImageFrame.ReducedSizeMneu", "", true, null); reduceMI.setSelected(true); reduceMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (row == null) { return; } // simply 'remember' that we want to show reduced images for this row rowToImageSizeHash.put(row.hashCode(), REDUCED_SIZE); // then 'reshow' the current image showImage(); } }); origMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_ORIG_SIZE", "ImageFrame.OrigMneu", "", true, null); origMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (row == null) { return; } // simply 'remember' that we want to show fill size images for this row rowToImageSizeHash.put(row.hashCode(), FULL_SIZE); // then 'reshow' the current image showImage(); } }); ButtonGroup btnGrp = new ButtonGroup(); btnGrp.add(reduceMI); btnGrp.add(origMI); viewMenu.addSeparator(); alwaysOnTopMI = UIHelper.createCheckBoxMenuItem(viewMenu, "WB_ALWAYS_ON_TOP", null, "", true, null); alwaysOnTopMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { ImageFrame.this.setAlwaysOnTop(alwaysOnTopMI.isSelected()); } }); addPropertyChangeListener("alwaysOnTop", this); if (!isReadOnly) { ActionListener deleteImg = new ActionListener() { public void actionPerformed(ActionEvent ae) { deleteImage(); } }; ActionListener replaceImg = new ActionListener() { public void actionPerformed(ActionEvent ae) { replaceImage(); } }; ActionListener addImg = new ActionListener() { public void actionPerformed(ActionEvent ae) { addImages(); } }; title = "ImageFrame.Image"; mneu = "ImageFrame.ImageMneu"; imageMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu); title = "WB_ADD_IMG"; mneu = "WB_ADD_IMG_MNEM"; addMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, addImg); title = "WB_REPLACE_IMG"; mneu = "WB_REPLACE_IMG_MNEU"; replaceMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, replaceImg); title = "WB_DEL_IMG_LINK"; mneu = "WB_DEL_IMG_LINK_MNEU"; deleteMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, deleteImg); loadImgBtn.addActionListener(addImg); } JMenu helpMenu = new JMenu(getResourceString("HELP")); menuBar.add(HelpMgr.createHelpMenuItem(helpMenu, getResourceString("WB_IMAGE_WINDOW"))); enableMenus(false); setJMenuBar(menuBar); pack(); HelpMgr.setHelpID(this, "WorkbenchWorkingWithImages"); }
From source file:com.hp.alm.ali.idea.ui.editor.field.HTMLAreaField.java
@Override public Component getComponent() { if (pane == null) { pane = new JBScrollPane(super.getComponent(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.setPreferredSize(new Dimension(600, 30)); pane.setMinimumSize(new Dimension(300, 30)); }//from ww w . ja v a 2 s . co m return pane; }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
public void refresh(final Instances dataSet, final int dateIdx) { final Instances gapsDescriptionsDataset = GapsUtil.buildGapsDescription(gcp, dataSet, dateIdx); final JXTable gapsDescriptionsTable = new JXTable(); final InstanceTableModel gapsDescriptionsTableModel = new InstanceTableModel(false); gapsDescriptionsTableModel.setDataset(gapsDescriptionsDataset); gapsDescriptionsTable.setModel(gapsDescriptionsTableModel); gapsDescriptionsTable.setEditable(true); gapsDescriptionsTable.setShowHorizontalLines(false); gapsDescriptionsTable.setShowVerticalLines(false); gapsDescriptionsTable.setVisibleRowCount(5); gapsDescriptionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); gapsDescriptionsTable.setSortable(false); gapsDescriptionsTable.packAll();//w w w. j a va 2 s. com gapsDescriptionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gapsDescriptionsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int modelRow = gapsDescriptionsTable.getSelectedRow(); if (modelRow < 0) modelRow = 0; final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()).doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()).doubleValue(); try { final ChartPanel cp = GapsUIUtil.buildGapChartPanel(dataSet, dateIdx, attr, gapsize, position); visualOverviewPanel.removeAll(); visualOverviewPanel.add(cp, BorderLayout.CENTER); geomapPanel.removeAll(); geomapPanel.add(gcp.getMapPanel(Arrays.asList(attrname), new ArrayList<String>(), false)); jxp.updateUI(); } catch (Exception ee) { ee.printStackTrace(); } } } }); gapsDescriptionsTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { final InstanceTableModel instanceTableModel = (InstanceTableModel) gapsDescriptionsTable.getModel(); final int row = gapsDescriptionsTable.rowAtPoint(e.getPoint()); //final int row=gapsDescriptionsTable.getSelectedRow(); final int modelRow = gapsDescriptionsTable.convertRowIndexToModel(row); //final int modelRow=(int)Double.valueOf(instanceTableModel.getValueAt(row,0).toString()).doubleValue(); //System.out.println(row+" "+modelRow); final String attrname = instanceTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); if (!e.isPopupTrigger()) { // nothing? } else { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem interactiveFillMenuItem = new JMenuItem("Fill this gap (interactively)"); interactiveFillMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final GapFillingFrame jxf = new GapFillingFrame(atv, dataSet, attr, dateIdx, GapsUtil.getCountOfValuesBeforeAndAfter(gapsize), position, gapsize, gcp, false); jxf.setSize(new Dimension(900, 700)); //jxf.setExtendedState(Frame.MAXIMIZED_BOTH); jxf.setLocationRelativeTo(jPopupMenu); jxf.setVisible(true); //jxf.setResizable(false); } }); jPopupMenu.add(interactiveFillMenuItem); final JMenuItem lookupInKnowledgeDBMenuItem = new JMenuItem( "Show the most similar cases from KnowledgeDB"); lookupInKnowledgeDBMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final double x = gcp.getCoordinates(attrname)[0]; final double y = gcp.getCoordinates(attrname)[1]; final String season = instanceTableModel.getValueAt(modelRow, 3).toString() .split("/")[0]; final boolean isDuringRising = instanceTableModel.getValueAt(modelRow, 11).toString() .equals("true"); try { final Calendar cal = Calendar.getInstance(); final String dateAsString = instanceTableModel.getValueAt(modelRow, 2).toString() .replaceAll("'", ""); cal.setTime(FormatterUtil.DATE_FORMAT.parse(dateAsString)); final int year = cal.get(Calendar.YEAR); new SimilarCasesFrame(dataSet, dateIdx, gcp, attrname, gapsize, position, x, y, year, season, isDuringRising); } catch (Exception e1) { e1.printStackTrace(); } } }); jPopupMenu.add(lookupInKnowledgeDBMenuItem); final JMenuItem mExport = new JMenuItem("Export this table as CSV"); mExport.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(gapsDescriptionsTable); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(gapsDescriptionsDataset, file); } catch (Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mExport); jPopupMenu.show(gapsDescriptionsTable, e.getX(), e.getY()); } } }); final int tableWidth = (int) gapsDescriptionsTable.getPreferredSize().getWidth() + 30; final JScrollPane scrollPane = new JScrollPane(gapsDescriptionsTable); scrollPane.setPreferredSize(new Dimension(Math.min(tableWidth, 500), 500)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.tablePanel.removeAll(); this.tablePanel.add(scrollPane, BorderLayout.CENTER); this.visualOverviewPanel.removeAll(); /* automatically compute the most similar series and the 'rising' flag */ new AbstractSimpleAsync<Void>(false) { @Override public Void execute() throws Exception { final int rc = gapsDescriptionsTableModel.getRowCount(); for (int i = 0; i < rc; i++) { final int modelRow = i; try { final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); /* most similar */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 7); final int cvba = GapsUtil.getCountOfValuesBeforeAndAfter(gapsize); Instances gapds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - cvba), Math.min(position + gapsize + cvba, dataSet.numInstances() - 1)); final String mostsimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(gapds, attr, WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(gapds), false); gapsDescriptionsTableModel.setValueAt(mostsimilar, modelRow, 7); /* 'rising' flag */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 11); final List<String> attributeNames = WekaDataStatsUtil.getAttributeNames(dataSet); attributeNames.remove("timestamp"); final String nearestStationName = gcp.findNearestStation(attr.name(), attributeNames); final Attribute nearestStationAttr = dataSet.attribute(nearestStationName); //System.out.println(nearestStationName+" "+nearestStationAttr); final boolean isDuringRising = GapsUtil.isDuringRising(dataSet, position, gapsize, new int[] { dateIdx, attr.index(), nearestStationAttr.index() }); gapsDescriptionsTableModel.setValueAt(isDuringRising, modelRow, 11); gapsDescriptionsTableModel.fireTableDataChanged(); } catch (Exception e) { gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 7); gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 11); e.printStackTrace(); } } return null; } @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } }.start(); /* select the first row */ gapsDescriptionsTable.setRowSelectionInterval(0, 0); }
From source file:ac.openmicrolabs.view.gui.OMLLoggerView.java
private JPanel createContentPane(final TimeSeriesCollection t, final String graphTitle, final double graphTimeRange, final String[] signals) { btmPanel.remove(reportButton);/*from w w w . j a v a2 s. co m*/ chanLabel = new JLabel[signals.length]; int activeSignalCount = 0; for (int i = 0; i < signals.length; i++) { chanLabel[i] = new JLabel(h.format("label", (char) ((i / PIN_COUNT) + ASCII_OFFSET) + "-0x" + String.format("%02x", (i % PIN_COUNT) + SLAVE_BITS).toUpperCase())); chanLabel[i].setHorizontalAlignment(JLabel.CENTER); if (signals[i] != null) { activeSignalCount++; } else { chanLabel[i].setEnabled(false); } } typeLabel = new JLabel[activeSignalCount]; valLabel = new JLabel[activeSignalCount]; minLabel = new JLabel[activeSignalCount]; maxLabel = new JLabel[activeSignalCount]; avgLabel = new JLabel[activeSignalCount]; int index = 0; for (int i = 0; i < signals.length; i++) { if (signals[i] != null) { typeLabel[index] = new JLabel(h.format("body", signals[i])); typeLabel[index].setHorizontalAlignment(JLabel.CENTER); index++; } } for (int i = 0; i < activeSignalCount; i++) { valLabel[i] = new JLabel(); valLabel[i].setHorizontalAlignment(JLabel.CENTER); minLabel[i] = new JLabel(); minLabel[i].setHorizontalAlignment(JLabel.CENTER); maxLabel[i] = new JLabel(); maxLabel[i].setHorizontalAlignment(JLabel.CENTER); avgLabel[i] = new JLabel(); avgLabel[i].setHorizontalAlignment(JLabel.CENTER); } // Set up main panel. JPanel mainPanel = new JPanel(); mainPanel.setLayout(null); mainPanel.setBackground(Color.white); // Create graph. snsChart = ChartFactory.createTimeSeriesChart(graphTitle, GRAPH_X_LABEL, GRAPH_Y_LABEL, t, true, true, false); final XYPlot plot = snsChart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(graphTimeRange); axis = plot.getRangeAxis(); axis.setRange(graphMinY, graphMaxY); ChartPanel snsChartPanel = new ChartPanel(snsChart); snsChartPanel.setPreferredSize(new Dimension(FRAME_WIDTH - PAD20, GRAPH_HEIGHT - PAD10)); // Set up graph panel. final JPanel graphPanel = new JPanel(); graphPanel.setSize(FRAME_WIDTH - PAD20, GRAPH_HEIGHT); graphPanel.setLocation(0, 0); graphPanel.setBackground(Color.white); graphPanel.add(snsChartPanel); // Set up results panel. final JPanel resultsPanel = createResultsPane(); // Set up scroll pane. final JScrollPane scrollPane = new JScrollPane(resultsPanel); scrollPane.setSize(FRAME_WIDTH - PAD20, FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT + PAD8); scrollPane.setLocation(PAD5, GRAPH_HEIGHT); scrollPane.setBackground(Color.white); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Set results panel size. resultsPanel.setPreferredSize(new Dimension(PAD40 + (signals.length * RESULTS_COL_WIDTH), FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT - PAD120)); resultsPanel.revalidate(); // Set up bottom panel. btmPanel.setLayout(null); btmPanel.setSize(FRAME_WIDTH, BTM_HEIGHT); btmPanel.setLocation(0, this.getHeight() - BTM_HEIGHT); btmPanel.setBackground(Color.white); // Instantiate bottom panel objects. footerLabel.setSize(LABEL_WIDTH, LABEL_HEIGHT); footerLabel.setLocation(LABEL_X, LABEL_Y); footerLabel.setText(""); doneButton.setIcon(new ImageIcon("img/22x22/stop.png")); doneButton.setSize(DONE_WIDTH, DONE_HEIGHT); doneButton.setLocation(FRAME_WIDTH - PAD20 - doneButton.getWidth(), PAD15); progressBar = new JProgressBar(); progressBar.setSize(FRAME_WIDTH - PAD40 - doneButton.getWidth() - footerLabel.getWidth(), PAD20); progressBar.setValue(0); progressBar.setLocation(footerLabel.getWidth() + PAD10, PAD22); // Populate bottom panel. btmPanel.add(footerLabel); btmPanel.add(progressBar); btmPanel.add(doneButton); // Populate main panel. mainPanel.add(graphPanel); mainPanel.add(scrollPane); mainPanel.add(btmPanel); return mainPanel; }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java
/** * // www. ja v a2 s . c o m */ @SuppressWarnings("unchecked") //$NON-NLS-1$ public ViewSetSelectorPanel(final BasicFormPreviewPanel previewPanel) { this.previewPanel = previewPanel; Vector<String> levelsVec = new Vector<String>(); SpecifyUser user = AppContextMgr.getInstance().getClassObject(SpecifyUser.class); @SuppressWarnings("unused") Hashtable<Discipline, Boolean> usedColTypes = new Hashtable<Discipline, Boolean>(); levelsVec.add(user.getUserType()); // for (Agent agent : user.getAgents()) // { // // XXX Commented Out // /*Discipline ct = agent.getDiscipline(); // if (usedColTypes.get(ct) == null) // { // levelsVec.add(ct.getName()); // usedColTypes.put(ct, true); // }*/ // } levelsVec.add("BackStop"); //$NON-NLS-1$ addBtn = UIHelper.createIconBtn("PlusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$ public void actionPerformed(ActionEvent arg0) { addControl(); } }); delBtn = UIHelper.createIconBtn("MinusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$ public void actionPerformed(ActionEvent arg0) { delControl(TYPE.SelectedObj); } }); ActionListener addViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addView(); } }; ActionListener delViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delView(); } }; viewControlPanel = new EditDeleteAddPanel(null, delViewAL, addViewAL); ActionListener addAltViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addAltView(); } }; ActionListener delAltViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delAltView(); } }; altViewControlPanel = new EditDeleteAddPanel(null, delAltViewAL, addAltViewAL); ActionListener addDefViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addViewDef(); } }; ActionListener delDefViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delViewDef(); } }; viewDefControlPanel = new EditDeleteAddPanel(null, delDefViewAL, addDefViewAL); ActionListener saveAL = new ActionListener() { public void actionPerformed(ActionEvent e) { save(); } }; EditDeleteAddPanel saveControlPanel = new EditDeleteAddPanel(null, null, saveAL); saveControlPanel.getAddBtn().setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16)); //$NON-NLS-1$ saveControlPanel.getAddBtn().setEnabled(true); setLayout(new BorderLayout()); levelsList = new JList(levelsVec); panel = new EditorPropPanel(controlHash, subcontrolHash, null, true, this); //panel.setFormViewDef(null); PanelBuilder pb = new PanelBuilder(new FormLayout("p,4px,p, 6px,10px,6px, p,6px,p, 6px,10px,6px, p,f:p:g", //$NON-NLS-1$ "p,2px,f:p:g,2px,p,10px,p,4px")); //$NON-NLS-1$ CellConstraints cc = new CellConstraints(); String[] labels = new String[] { "User Level", "ViewSets", " ", "Views", "AltViews", " ", "View Defs" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ int x = 1; for (String label : labels) { pb.add(createLabel(label, SwingConstants.CENTER), cc.xy(x, 1)); x += 2; } Color vsFGColor = new Color(224, 224, 224); Color vsBGColor = new Color(124, 124, 124); Dimension ps = new Dimension(200, 150); x = 1; JScrollPane sp = createScrollPane(levelsList); pb.add(sp, cc.xy(x, 3)); x += 2; viewSetsList = new JList(new DefaultListModel()); sp = createScrollPane(viewSetsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3)); x += 2; viewsList = new JList(new DefaultListModel()); sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; altViewsList = new JList(new DefaultListModel()); sp = createScrollPane(altViewsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3)); x += 2; viewDefsList = new JList(new DefaultListModel()); sp = createScrollPane(viewDefsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(saveControlPanel, cc.xy(1, 5)); //pb.add(createLabel(" "), cc.xy(3, 5)); //pb.add(createLabel(" "), cc.xy(5, 5)); pb.add(viewControlPanel, cc.xy(7, 5)); pb.add(altViewControlPanel, cc.xy(9, 5)); //pb.add(createLabel(" "), cc.xy(11, 5)); pb.add(viewDefControlPanel, cc.xy(13, 5)); pb.addSeparator("View Def Editor", cc.xywh(1, 7, 13, 1)); //$NON-NLS-1$ add(pb.getPanel(), BorderLayout.NORTH); pb = new PanelBuilder(new FormLayout("max(250px;p),4px,f:p:g", "t:p")); //$NON-NLS-1$ //$NON-NLS-2$ PanelBuilder inner = new PanelBuilder(new FormLayout("max(250px;p)", "t:p,2px,t:p")); //$NON-NLS-1$ //$NON-NLS-2$ tree = new JTree(); ((DefaultTreeModel) tree.getModel()).setRoot(null); sp = createScrollPane(tree); inner.add(sp, cc.xy(1, 1)); PanelBuilder btnPb = new PanelBuilder(new FormLayout("f:p:g,p,2px,p", "p")); //$NON-NLS-1$ //$NON-NLS-2$ btnPb.add(delBtn, cc.xy(2, 1)); btnPb.add(addBtn, cc.xy(4, 1)); inner.add(btnPb.getPanel(), cc.xy(1, 3)); pb.add(inner.getPanel(), cc.xy(1, 1)); pb.add(panel, cc.xy(3, 1)); add(pb.getPanel(), BorderLayout.CENTER); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { treeSelected(); } }); levelsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { levelSelected(); } } }); viewSetsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewSetSelected(); } } }); viewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewSelected(); } } }); altViewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { altViewSelected(); } } }); viewDefsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewDefSelected(); } } }); tree.addMouseListener(new MouseAdapter() { protected void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int xc = e.getX(); int yc = e.getY(); TreePath path = tree.getPathForLocation(xc, yc); if (path != null) { tree.setSelectionPath(path); } treeSelected(); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel() .getSelectionPath().getLastPathComponent(); if (selectedCell != null || selectedRow != null) { new TreePopupMenu((Component) e.getSource(), e, selectedCell); } else if (selectedNode.getUserObject() instanceof FormViewDef) { new TreePopupMenu((Component) e.getSource(), e); } } } public void mouseReleased(MouseEvent e) { doPopup(e); } public void mousePressed(MouseEvent e) { doPopup(e); } }); XStream xstream = new XStream(); xstream.alias("control", Control.class); //$NON-NLS-1$ xstream.useAttributeFor(Control.class, "type"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "type"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "name"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "required"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "defaultValue"); //$NON-NLS-1$ xstream.aliasAttribute("default", "defaultValue"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.alias("uicontrols", Vector.class); //$NON-NLS-1$ xstream.alias("attr", Attr.class); //$NON-NLS-1$ xstream.alias("param", Param.class); //$NON-NLS-1$ xstream.alias("subcontrol", SubControl.class); //$NON-NLS-1$ xstream.aliasAttribute("desc", "desc"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.aliasAttribute(Attr.class, "values", "values"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.useAttributeFor(SubControl.class, "type"); //$NON-NLS-1$ try { controls = (Vector<Control>) xstream.fromXML(FileUtils.readFileToString(new File("UIControls.xml"))); //$NON-NLS-1$ for (Control control : controls) { controlHash.put(control.getType(), control); if (control.getSubcontrols() != null) { for (SubControl sc : control.getSubcontrols()) { //System.out.println(" ["+sc.getType()+"] "); subcontrolHash.put(sc.getType(), sc); } } } } catch (IOException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ViewSetSelectorPanel.class, ex); ex.printStackTrace(); } }