protected void filter() {
    TsCarMstDTO item = car.getSelectionItem();
    ArrayList<TsWgtInfDTO> items = filter(item);

    gridViewer.setInput(items.toArray(new TsWgtInfDTO[0]));
    gridViewer.getGrid().setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
  }
 private void select() {
   TsCarMstDTO item = car.getSelectionItem();
   if (item.getCar_num().length() == 0) {
     TsWgtInfManager wim = new TsWgtInfManager();
     TsWgtInfDTO param = new TsWgtInfDTO();
     param.setWgt_stat_cd(DTSConstants.WGT_STAT_FST);
     ArrayList<TsWgtInfDTO> fstList = wim.selectTsWgtInf(param);
     for (int i = 0; i < fstList.size(); i++) fstList.get(i).setNo(i + 1);
     listData = fstList.toArray(new TsWgtInfDTO[0]);
     gridViewer.setInput(listData);
   } else {
     filter();
   }
 }
  /**
   * Open the dialog.
   *
   * @return the result
   */
  public Object open() {
    preferences = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, DTSConstants.PLUGIN_ID);
    user = SessionManager.getInstance().getUsr();
    createContents();
    shell.open();
    shell.layout();

    car.setFocus();
    init();

    Display display = getParent().getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return result;
  }
 /** init */
 private void init() {
   TsMstManager mgr = new TsMstManager();
   car.setItems(mgr.selectTsCarMst(null));
   select();
 } // initData
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(624, 617);
    shell.setText(getText());
    GridLayout gl_shell = new GridLayout(1, false);
    gl_shell.horizontalSpacing = 0;
    gl_shell.marginHeight = 0;
    gl_shell.verticalSpacing = 0;
    gl_shell.marginWidth = 0;
    shell.setLayout(gl_shell);
    shell.setBackground(ColorRepository.getColor(ColorRepository.BG_CONTENTS));
    //		shell.setBackgroundMode(SWT.TRANSPARENT);

    CLabel lblTitle = new CLabel(shell, SWT.CENTER);
    lblTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    GridData gd_lblTitle = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_lblTitle.heightHint = 44;
    lblTitle.setLayoutData(gd_lblTitle);
    lblTitle.setFont(titleFont);
    lblTitle.setBackgroundImage(ImageRepository.getImage(ImageRepository.POPUP_TITLE_BG));
    lblTitle.setText("2차 계량 - 대상 차량 선택");

    Composite compContents = new Composite(shell, SWT.NONE);
    compContents.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    compContents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout gl_compContents = new GridLayout(1, false);
    gl_compContents.marginTop = 10;
    gl_compContents.marginRight = 10;
    gl_compContents.marginLeft = 10;
    gl_compContents.marginBottom = 10;
    gl_compContents.verticalSpacing = 0;
    gl_compContents.marginWidth = 0;
    gl_compContents.marginHeight = 0;
    compContents.setLayout(gl_compContents);

    compCenter = new Composite(compContents, SWT.BORDER);
    compCenter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    compCenter.setLayout(new GridLayout(2, false));

    car = new CarComposite(compCenter, SWT.NONE);
    car.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            filter();
          }
        });
    car.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    car.setFont(defaultFont);
    car.setTitle("차량 번호: ");
    car.addFocusListener(new HelpAdapter("차량번호를 입력하거나 목록에서 선택 후 Enter."));

    Button btnSearch = new Button(compCenter, SWT.NONE);
    btnSearch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            select();
          }
        });
    btnSearch.setFont(btnFont);
    btnSearch.setText(" 조 회 ");

    initGird(compContents);

    Composite btn = new Composite(shell, SWT.NONE);
    btn.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    btn.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    btn.setBackgroundMode(SWT.INHERIT_FORCE);
    if (user.hasAuth(DTSConstants.AUTH_DEL_FST)) {
      btn.setLayout(new GridLayout(4, false));
    } else {
      btn.setLayout(new GridLayout(3, false));
    }

    Button btnSave = new Button(btn, SWT.NONE);
    GridData gd_btnSave = new GridData(SWT.RIGHT, SWT.FILL, true, false);
    gd_btnSave.heightHint = 36;
    gd_btnSave.widthHint = 130;
    btnSave.setLayoutData(gd_btnSave);
    btnSave.setFont(btnFont);
    btnSave.setText("2차 계량");
    btnSave.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onClickOK();
          }
        });

    Button btnPrint = new Button(btn, SWT.NONE);
    GridData gd_btnPrint = new GridData(SWT.RIGHT, SWT.FILL, true, false);
    gd_btnPrint.heightHint = 36;
    gd_btnPrint.widthHint = 130;
    btnPrint.setLayoutData(gd_btnPrint);
    btnPrint.setFont(btnFont);
    btnPrint.setText("전표 출력");
    btnPrint.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            Grid g = gridViewer.getGrid();
            if (g.getSelectionIndex() == -1) {
              MessageDialog.openInformation(
                  shell, "데이터 선택 필요", "선택된 데이터가 없습니다. \n\n목록에서 선택 후 작업하세요.");
              return;
            } else {
              if (listData != null && listData.length > g.getSelectionIndex()) {
                TsWgtInfDTO dto = listData[g.getSelectionIndex()];

                PrintUtil.print(dto, preferences.getInt(DTSPreConstants.GN_PRINT_COUNT));
              }
            }
          }
        });

    if (user.hasAuth(DTSConstants.AUTH_DEL_FST)) {
      Button btnDelete = new Button(btn, SWT.NONE);
      GridData gd_btnDelete = new GridData(SWT.CENTER, SWT.FILL, true, false);
      gd_btnDelete.heightHint = 36;
      gd_btnDelete.widthHint = 130;
      btnDelete.setLayoutData(gd_btnDelete);
      btnDelete.setFont(btnFont);
      btnDelete.setText("삭 제");
      btnDelete.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              onClickDelete();
            }
          });
    }
    Button btnCancel = new Button(btn, SWT.NONE);
    btnCancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            shell.close();
          }
        });
    GridData gd_btnCancel = new GridData(SWT.LEFT, SWT.FILL, true, false);
    gd_btnCancel.heightHint = 36;
    gd_btnCancel.widthHint = 130;
    btnCancel.setLayoutData(gd_btnCancel);
    btnCancel.setFont(btnFont);
    btnCancel.setText("취  소");

    lblHelp = new CLabel(shell, SWT.LEFT);
    lblHelp.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    GridData gd_lblHelp = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_lblHelp.heightHint = 25;
    lblHelp.setLayoutData(gd_lblHelp);
    lblHelp.setText("도움말:");
    lblHelp.setFont(helpFont);
    lblHelp.setBackgroundImage(ImageRepository.getImage(ImageRepository.POPUP_HELP_BG));

    shell.addListener(
        SWT.Traverse,
        new Listener() {
          public void handleEvent(Event event) {
            if (event.detail == SWT.TRAVERSE_ESCAPE) {
              event.doit = false;
            }
          }
        });
  } // createContents