Package xgenerator.ui.swing.model

Examples of xgenerator.ui.swing.model.MetadataTableModel


   * </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


   * </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

   * @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

   * @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

   * @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

   */
  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();
View Full Code Here

      }

      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();
View Full Code Here

    this.setComponentPopupMenu(buildTablePopupMenu());

    /*
     * 必须先设置TableModel,然后再设置TableColumnModel
     */
    this.setModel(new MetadataTableModel());
    this.setPreferredTableColumnStyle();

    /*
     * 添加TableModelListener
     */
 
View Full Code Here

        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);
      //} else if(ConstraintTypeComboBoxModel.PK_TYPE.equals(keyType) || ConstraintTypeComboBoxModel.UK_TYPE.equals(keyType) || ConstraintTypeComboBoxModel.CHECK_TYPE.equals(keyType) || ConstraintTypeComboBoxModel.NOT_NULL_TYPE.equals(keyType) || ConstraintTypeComboBoxModel.DEFAULT_TYPE.equals(keyType)) {
      } else {
        metadataTableModel.setCellEditableAt(false, selectedRowIndex, MetadataTableModel.REFERENCING_TABLE_INDEX);
        metadataTableModel.setCellEditableAt(false, selectedRowIndex, MetadataTableModel.REFERENCING_COLUMN_INDEX);
        metadataTableModel.setCellEditableAt(false, selectedRowIndex, MetadataTableModel.DELETE_RULE_INDEX);
        metadataTableModel.setValueAt(null, selectedRowIndex, MetadataTableModel.REFERENCING_TABLE_INDEX);
        metadataTableModel.setValueAt(null, selectedRowIndex, MetadataTableModel.REFERENCING_COLUMN_INDEX);
        metadataTableModel.setValueAt(null, selectedRowIndex, MetadataTableModel.DELETE_RULE_INDEX);
      }
    }
  }
View Full Code Here

TOP

Related Classes of xgenerator.ui.swing.model.MetadataTableModel

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.