public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } FinderTableModel model = getDataModel(); ICFBamSysClusterObj o = (ICFBamSysClusterObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = swingSchema.getSysClusterFactory().newViewEditJInternalFrame(o); ((ICFBamSwingSysClusterJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); if (frame == null) { return; } Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } PickerTableModel model = getDataModel(); ICFBamIndexObj o = (ICFBamIndexObj) model.getValueAt(row, COLID_ROW_HEADER); invokeWhenChosen.choseIndex(o); try { Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { ((JInternalFrame) cont).setClosed(true); } } catch (Exception x) { } }
public CFBamSwingSysClusterFinderJPanel(ICFBamSwingSchema argSchema) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
public void setSwingFocus(ICFLibAnyObj value) { final String S_ProcName = "setSwingFocus"; if ((value == null) || (value instanceof ICFInternetMinorVersionObj)) { super.setSwingFocus(value); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "value", value, "ICFInternetMinorVersionObj"); } if (dataTable == null) { return; } if (value == null) { dataTable.clearSelection(); } else { ICFInternetMinorVersionObj curSelected; PickerTableModel tblDataModel = getDataModel(); int selectedRow = dataTable.getSelectedRow(); int modelIndex = dataTable.convertRowIndexToModel(selectedRow); if (selectedRow >= 0) { Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER); curSelected = (ICFInternetMinorVersionObj) selectedRowData; } else { curSelected = null; } if (curSelected != value) { int len = tblDataModel.getRowCount(); int idx = 0; while ((idx < len) && (tblDataModel.getValueAt(idx, COLID_ROW_HEADER) != value)) { idx++; } if (idx < len) { int viewRow = dataTable.convertRowIndexToView(idx); dataTable.clearSelection(); dataTable.addRowSelectionInterval(viewRow, viewRow); } } } }
public CFBamSwingIndexPickerJPanel( ICFBamSwingSchema argSchema, ICFBamIndexObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamIndexObj> argDataCollection, ICFBamSwingIndexChosen whenChosen) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedIndex(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsIndex(argFocus); }