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; } ListTableModel model = getDataModel(); ICFDbTestTextDefObj o = (ICFDbTestTextDefObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = null; String classCode = o.getClassCode(); if (classCode.equals("TXTD")) { frame = swingSchema.getTextDefFactory().newViewEditJInternalFrame(o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFDbTestSwingTextDefJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("TXTC")) { frame = swingSchema.getTextColFactory().newViewEditJInternalFrame((ICFDbTestTextColObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFDbTestSwingTextColJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("TXTT")) { frame = swingSchema.getTextTypeFactory().newViewEditJInternalFrame((ICFDbTestTextTypeObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFDbTestSwingTextTypeJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else { frame = null; } 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 Object getValueAt(int row, int column) { final String S_ProcName = "getValueAt"; if ((row < 0) || (column < -1)) { return (null); } if (arrayOfTextDef == null) { return (null); } int len = arrayOfTextDef.length; if (row >= len) { return (null); } ICFDbTestTextDefObj obj = arrayOfTextDef[row]; if (obj == null) { return (null); } Object retval; switch (column) { case COLID_ROW_HEADER: retval = obj; break; case COLID_OBJQUALIFIEDNAME: retval = obj.getObjQualifiedName(); break; case COLID_OBJKIND: String classCode = obj.getClassCode(); if (classCode.equals("TXTD")) { retval = "TextDef"; } else if (classCode.equals("TXTC")) { retval = "TextCol"; } else if (classCode.equals("TXTT")) { retval = "TextType"; } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Unsupported class code \"" + classCode + "\" detected"); } break; case COLID_ID: retval = new Long(obj.getRequiredId()); break; case COLID_NAME: retval = obj.getRequiredName(); if (retval == null) { retval = ""; } break; case COLID_DEFAULTVISIBILITY: retval = new Boolean(obj.getRequiredDefaultVisibility()); break; case COLID_INITVAL: retval = obj.getOptionalInitVal(); if (retval == null) { retval = ""; } break; default: retval = null; break; } return (retval); }
public void actionPerformed(ActionEvent e) { final String S_ProcName = "actionPerformed"; ICFDbTestSchemaObj schemaObj = swingSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFDbTestTextDefObj selectedInstance = getSwingFocusAsTextDef(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("TXTD".equals(classCode)) { JInternalFrame frame = swingSchema.getTextDefFactory().newAskDeleteJInternalFrame(selectedInstance); ((ICFDbTestSwingTextDefJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); frame.addInternalFrameListener(getViewEditInternalFrameListener()); 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(); } } else if ("TXTC".equals(classCode)) { ICFDbTestTextColObj obj = (ICFDbTestTextColObj) selectedInstance; JInternalFrame frame = swingSchema.getTextColFactory().newAskDeleteJInternalFrame(obj); ((ICFDbTestSwingTextColJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); frame.addInternalFrameListener(getViewEditInternalFrameListener()); 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(); } } else if ("TXTT".equals(classCode)) { ICFDbTestTextTypeObj obj = (ICFDbTestTextTypeObj) selectedInstance; JInternalFrame frame = swingSchema.getTextTypeFactory().newAskDeleteJInternalFrame(obj); ((ICFDbTestSwingTextTypeJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); frame.addInternalFrameListener(getViewEditInternalFrameListener()); 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(); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFDbTestTextDefObj, ICFDbTestTextColObj, ICFDbTestTextTypeObj"); } } }