Package xgenerator.ui.swing

Examples of xgenerator.ui.swing.MetadataTable


   * Title:功能方法名
   * </p>
   * @param e
   */
  public void copyComment2DescriptioinActionPerformed(ActionEvent e) {
    MetadataTable metadataTable = (MetadataTable) ui;
    MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
    int selectedRow = metadataTable.getSelectedRow();
   
    Object comments = metadataTableModel.getValueAt(selectedRow, MetadataTableModel.COMMENTS_INDEX);
   
    metadataTableModel.setValueAt(comments, selectedRow, MetadataTableModel.DISPLAY_NAME_INDEX);
    metadataTable.revalidate();
    metadataTable.updateUI();
  }
View Full Code Here


   * Title:功能方法名
   * </p>
   * @param e
   */
  public void copyAllComment2DescriptioinsActionPerformed(ActionEvent e) {
    MetadataTable metadataTable = (MetadataTable) ui;
    MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();

    for (int i = 0; i < metadataTableModel.getRowCount(); i++) {
      Object comments = metadataTableModel.getValueAt(i, MetadataTableModel.COMMENTS_INDEX);
      metadataTableModel.setValueAt(comments, i, MetadataTableModel.DISPLAY_NAME_INDEX);
    }

    metadataTable.revalidate();
    metadataTable.updateUI();
  }
View Full Code Here

   * </p>
   * @param e
   */
  public void insertRowAboveCurrentRowActionPerformed(ActionEvent e) {
    try {
      MetadataTable metadataTable = (MetadataTable) ui;
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
      int selectedRow = metadataTable.getSelectedRow();
     
      int rowAbove = selectedRow;
      //metadataTableModel.insertRow(rowAbove, metadataTableModel.mapRowData(tableColumnMetadataBean));
      //metadataTableModel.insertRowEditable(rowAbove);
      metadataTableModel.insertNewRow(rowAbove);
      metadataTable.revalidate();
      metadataTable.updateUI();
    } catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(ui, "插入行失败!");
    }
  }
View Full Code Here

   * </p>
   * @param e
   */
  public void insertRowBelowCurrentRowActionPerformed(ActionEvent e) {
    try {
      MetadataTable metadataTable = (MetadataTable) ui;
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
      int selectedRow = metadataTable.getSelectedRow();
     
      int rowBelow = selectedRow + 1;
      //metadataTableModel.insertRow(rowBelowIndex, metadataTableModel.mapRowData(tableColumnMetadataBean));
      //metadataTableModel.insertRowEditable(rowBelowIndex);
      metadataTableModel.insertNewRow(rowBelow);
      metadataTable.revalidate();
      metadataTable.updateUI();
    } catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(ui, "插入行失败!");
    }
  }
View Full Code Here

   * </p>
   * @param e
   */
  public void insertRowAtBottomActionPerformed(ActionEvent e) {
    try {
      MetadataTable metadataTable = (MetadataTable) ui;
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
     
      int lastRow = metadataTable.getRowCount();
      //metadataTableModel.insertRow(lastRowIndex, metadataTableModel.mapRow(tableColumnMetadataBean));
      //metadataTableModel.addRow(metadataTableModel.mapRowData(tableColumnMetadataBean));
      //metadataTableModel.insertRowEditable(lastRowIndex);
      metadataTableModel.insertNewRow(lastRow);
      metadataTable.revalidate();
      metadataTable.updateUI();
    } catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(ui, "插入行失败!");
    }
  }
View Full Code Here

   * </p>
   * @param e
   */
  public void deleteRowActionPerformed(ActionEvent e) {
    try {
      MetadataTable metadataTable = (MetadataTable) ui;
      int selectedRow = metadataTable.getSelectedRow();
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
     
      //metadataTableModel.removeRow(selectedRow);
      //metadataTableModel.removeRowEditable(selectedRow);
      //metadataTableModel.removeOneRow(selectedRow);
      metadataTableModel.removeRow(selectedRow);
      metadataTable.revalidate();
      metadataTable.updateUI();
      JOptionPane.showMessageDialog(ui, "删除行成功!");
    } catch (Exception ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(ui, "删除行失败!");
    }
View Full Code Here

   * @param e
   * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent)
   */
  public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
    try {
      MetadataTable metadataTable = (MetadataTable) ui;
      JGeneratorFrame jGeneratorFrame = (JGeneratorFrame) metadataTable.getParentComponent();
      JComboBox datasourceComboBox = jGeneratorFrame.getDataSourceComboBox();
      Object selectedItem = datasourceComboBox.getSelectedItem();
      String datasourceName = StringUtils.toString(selectedItem);
      System.out.println("datasourceName=" + datasourceName);
     
View Full Code Here

        throw new RuntimeException("请选择数据表!");
      }

      generatorGui.getStatusLabel().setText("数据源:" + dataSourceName + " 模型:" + tableName + " 正在加载元数据...");
     
      MetadataTable metadataTable = generatorGui.getMetadataTable();
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
      /*
       * 必须先设置TableModel,然后再设置TableColumnModel 在这里
       */
//      metadataTable.setModel(metadataTableModel); //在这里metadataTableModel没有变
//      metadataTable.setColumnModel(metadataTable.setPreferredTableColumnStyle());
     
      ModelMetadata modelMetadata = metadataTableModel.updateDataVector(dataSourceName, tableName);
      metadataTable.setPreferredTableColumnStyle();
      metadataTable.revalidate();
      metadataTable.updateUI();

      String filterTableNamePrefix = generatorGui.getFilterTableNamePrefixField().getText();
      String filterTableNameSuffix = generatorGui.getFilterTableNameSufferField().getText();
//      String filterColumnNamePrefix = generatorGui.getFilterColumnNamePrefixField().getText();
     
View Full Code Here

    if (e.getType() == TableModelEvent.UPDATE) {
      int selectedRow = e.getFirstRow()//返回首个选定行的索引,如果没有选定的行,则返回 -1
      int selectedColumn = e.getColumn()////返回所有选定列的索引
     
      if(-1 != selectedRow && -1 != selectedColumn) {
        MetadataTable metadataTable = (MetadataTable) ui;
       
        if(MetadataTableModel.IS_KEY_FIELD_INDEX == selectedColumn) {//isKey
          Object cellValueObj = metadataTable.getValueAt(selectedRow, selectedColumn);
          boolean isKey = ((Boolean) cellValueObj).booleanValue();
          MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
          metadataTableModel.setCellEditableAt(isKey, selectedRow, MetadataTableModel.CONSTRAINT_TYPE_INDEX);
          metadataTableModel.setCellEditableAt(isKey, selectedRow, MetadataTableModel.REFERENCING_TABLE_INDEX);
          metadataTableModel.setCellEditableAt(isKey, selectedRow, MetadataTableModel.REFERENCING_COLUMN_INDEX);
          metadataTableModel.setCellEditableAt(isKey, selectedRow, MetadataTableModel.DELETE_RULE_INDEX);
          metadataTableModel.setValueAt(null, selectedRow, MetadataTableModel.CONSTRAINT_TYPE_INDEX);
          metadataTableModel.setValueAt(null, selectedRow, MetadataTableModel.REFERENCING_TABLE_INDEX);
          metadataTableModel.setValueAt(null, selectedRow, MetadataTableModel.REFERENCING_COLUMN_INDEX);
          metadataTableModel.setValueAt(null, selectedRow, MetadataTableModel.DELETE_RULE_INDEX);
        } else if(MetadataTableModel.IS_QUERY_FIELD_INDEX == selectedColumn) {//isQueryField
          Object cellValueObj = metadataTable.getValueAt(selectedRow, selectedColumn);
          boolean isQueryField = ((Boolean) cellValueObj).booleanValue();
          MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
          metadataTableModel.setCellEditableAt(isQueryField, selectedRow, MetadataTableModel.QUERY_MODE_INDEX);
          metadataTableModel.setValueAt(null, selectedRow, MetadataTableModel.QUERY_MODE_INDEX);
        }
      }
    }
View Full Code Here

   */
  public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      Object selectedItem = e.getItem();
      String keyType = null != selectedItem ? selectedItem.toString() : null;
      MetadataTable metadataTable = (MetadataTable) ui;
      MetadataTableModel metadataTableModel = (MetadataTableModel) metadataTable.getModel();
      int selectedRowIndex = metadataTable.getSelectedRow();
     
      if(ConstraintTypeComboBoxModel.FK_TYPE.equals(keyType)) {
        metadataTableModel.setCellEditableAt(true, selectedRowIndex, MetadataTableModel.REFERENCING_TABLE_INDEX);
        metadataTableModel.setCellEditableAt(true, selectedRowIndex, MetadataTableModel.REFERENCING_COLUMN_INDEX);
        metadataTableModel.setCellEditableAt(true, selectedRowIndex, MetadataTableModel.DELETE_RULE_INDEX);
View Full Code Here

TOP

Related Classes of xgenerator.ui.swing.MetadataTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.