ModuleGridNonSelectableDialog.java :  » Project-Management » airTODO » org » airtodo » gui » dialog_table » Java Open Source

Java Open Source » Project Management » airTODO 
airTODO » org » airtodo » gui » dialog_table » ModuleGridNonSelectableDialog.java
package org.airtodo.gui.dialog_table;

import java.awt.Dialog;
import java.awt.Window;
import java.sql.SQLException;
import java.util.Map;
import java.util.Vector;

import org.air.framework.core.Utils;
import org.air.framework.db.DbUtilsCommon;
import org.air.framework.gui.dialogs.grid.AbstractGridDialog;
import org.air.framework.gui.dialogs.grid.IAddDeleteGridDialog;
import org.air.framework.gui.dialogs.grid.IOpenGridDialog;
import org.air.framework.gui.dialogs.input.AbstractDeleteDialog;
import org.air.framework.i18n.NlsRecords;
import org.airtodo.db.DbUtils;
import org.airtodo.gui.dialog_delete.AttachmentDeleteDialog;
import org.airtodo.gui.dialog_open.ModuleOpenDialog;
import org.airtodo.headers.Module;
import org.airtodo.records.Modules;

public class ModuleGridNonSelectableDialog extends AbstractGridDialog implements IAddDeleteGridDialog, IOpenGridDialog {
  private long projectId;

  //
  //  C O N S T R U C T O R
  //
  public ModuleGridNonSelectableDialog() {
    super();
  }

  //
  //  C O N S T R U C T O R
  //
  public ModuleGridNonSelectableDialog(Dialog owner) {
    super(owner, new Module());
  }

  //
  //  C O N S T R U C T O R
  //
  public ModuleGridNonSelectableDialog(Dialog owner, String title) {
    super(owner, new Module());
    setTitle(title + " - " + NlsRecords.getTextPluralImenitelniy(Modules.class));
  }

  //
  //  C O N S T R U C T O R
  //
  public ModuleGridNonSelectableDialog(Dialog owner, Long id) {
    super(owner, new Module(), id);
  }

  @Override
  public Vector<Map> getDataVector() throws SQLException {
    return DbUtils.selectModulesByProjectId(projectId);
  }

  public AbstractDeleteDialog getDeleteDialog(AbstractGridDialog owner) {
    return new AttachmentDeleteDialog(owner);
  }

  public Window getOpenDialog(AbstractGridDialog abstractAddDeleteOpenDialog) {
    return new ModuleOpenDialog(abstractAddDeleteOpenDialog);
  }

  @Override
  public String getDialogTitle() {
    return NlsRecords.getTextPluralImenitelniy(Modules.class);
  }

  public int insert(Map map) throws SQLException {
    map.put(Utils.getColumnIdentifier(Modules.PROJECT_ID), projectId);
    return DbUtilsCommon.insert(map, Modules.class);
  }

  public void setProjectId(long projectId) {
    this.projectId = projectId;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.