示例#1
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new RowLayout());

    DateTime calendar = new DateTime(shell, SWT.CALENDAR);
    calendar.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("calendar date changed");
          }
        });

    DateTime time = new DateTime(shell, SWT.TIME);
    time.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("time changed");
          }
        });

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
  protected void addDirtyMarker(DateTime dateTime) {

    if (dateTime != null) {
      dateTime.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              markDirty();
            }
          });
    }
  }
示例#3
0
  public MainMenuComposite(Composite parent, int style) {
    super(parent, style);
    DateTime calendar = new DateTime(this, SWT.CALENDAR);
    calendar.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            System.out.println("calendar date changed");
          }
        });
    calendar.setBounds(10, 10, 300, 300);
    calendar.pack();

    // TODO Auto-generated constructor stub
  }
  private void initDateTime(Composite parent) {
    dateTime = new DateTime(parent, SWT.BORDER | SWT.TIME);
    dateTime.setToolTipText("Time");
    dateTime.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            calendarValue.set(Calendar.HOUR_OF_DAY, dateTime.getHours());
            calendarValue.set(Calendar.MINUTE, dateTime.getMinutes());
            calendarValue.set(Calendar.SECOND, dateTime.getSeconds());
          }
        });
  }
  private void initDateCalendar(Composite parent) {
    dateCalendar = new DateTime(parent, SWT.BORDER | SWT.DROP_DOWN);
    dateCalendar.setToolTipText("Calendar");
    dateCalendar.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            calendarValue.set(Calendar.YEAR, dateCalendar.getYear());
            calendarValue.set(Calendar.MONTH, dateCalendar.getMonth());
            calendarValue.set(Calendar.DAY_OF_MONTH, dateCalendar.getDay());
          }
        });
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite area = new Composite(parent, SWT.NONE);
    area.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    area.setLayout(new GridLayout(1, false));

    Composite dateComposite = new Composite(area, SWT.NONE);
    dateComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    dateComposite.setLayout(new GridLayout(1, false));
    dtDate = new DateTime(area, SWT.DATE | SWT.DROP_DOWN);
    dtDate.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            loadArticlesUsedOnSelectedDay();
            tableViewer.setInput(currOrder.getEntries());
          }
        });

    Composite tableComposite = new Composite(area, SWT.NONE);
    tableComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    TableColumnLayout tcLayout = new TableColumnLayout();
    tableComposite.setLayout(tcLayout);

    tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableViewerColumn tvc = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tcAmount = tvc.getColumn();
    tcLayout.setColumnData(tcAmount, new ColumnPixelData(70, false, false));
    tcAmount.setText(Messages.DailyOrderDialog_Amount);

    tvc = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tcArticle = tvc.getColumn();
    tcLayout.setColumnData(tcArticle, new ColumnPixelData(300, true, true));
    tcArticle.setText(Messages.DailyOrderDialog_Article);

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new OrderLabelProvider());

    loadArticlesUsedOnSelectedDay();
    tableViewer.setInput(currOrder.getEntries());

    return area;
  }
 public void fire(Object event) {
   FlatPopupMenu dlg = new FlatPopupMenu(button, null, true, false, false, false);
   DateTime ctrl = new DateTime(dlg.getControl(), SWT.CALENDAR | SWT.LONG);
   long date = DateTimeUtil.getDateFromString(text.getText());
   if (date != 0) {
     Calendar c = Calendar.getInstance();
     c.setTimeInMillis(date);
     ctrl.setYear(c.get(Calendar.YEAR));
     ctrl.setMonth(c.get(Calendar.MONTH));
     ctrl.setDay(c.get(Calendar.DAY_OF_MONTH));
   }
   ctrl.addSelectionListener(
       new SelectionListenerWithData<DateTime>(ctrl) {
         public void widgetSelected(SelectionEvent e) {
           Calendar c = Calendar.getInstance();
           c.set(Calendar.YEAR, data().getYear());
           c.set(Calendar.MONTH, data().getMonth());
           c.set(Calendar.DAY_OF_MONTH, data().getDay());
           text.setText(DateTimeUtil.getDateString(c.getTimeInMillis()));
         }
       });
   dlg.show(button, FlatPopupMenu.Orientation.BOTTOM, true);
 }
  protected Control createDialogArea(Composite parent) {
    parent.setBackground(EccTreeControl.color);
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));

    TabItem basicItem = new TabItem(tabFolder, SWT.NONE);
    basicItem.setText("基本");

    Composite composite1 = new Composite(tabFolder, SWT.NONE);
    composite1.setBackground(EccTreeControl.color);
    basicItem.setControl(composite1);

    SashForm sashForm = new SashForm(composite1, SWT.VERTICAL);
    sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    sashForm.setSize(445, 211);
    sashForm.setLocation(0, 0);

    Composite composite_1 = new Composite(sashForm, SWT.NONE);
    composite_1.setBackground(EccTreeControl.color);

    ICollection ico = FileTools.getBussCollection("TaskName", name, "EccTaskPlan");
    IEnumerator ien = ico.GetEnumerator();
    while (ien.MoveNext()) {
      bo = (BusinessObject) ien.get_Current();
      if (bo != null && bo.GetField("Model").get_NativeValue().toString().equals("绝对时间任务计划")) {
        TaskName = bo.GetField("TaskName").get_NativeValue().toString();
        Instruction = bo.GetField("Instruction").get_NativeValue().toString();
        StatrtTime = bo.GetField("StatrtTime").get_NativeValue().toString();
        String[] s2 = StatrtTime.split(";");
        String[] b1 = s2[0].split(",");
        time = b1[1];
        String[] b2 = s2[1].split(",");
        time_1 = b2[1];
        String[] b3 = s2[2].split(",");
        time_2 = b3[1];
        String[] b4 = s2[3].split(",");
        time_3 = b4[1];
        String[] b5 = s2[4].split(",");
        time_4 = b5[1];
        String[] b6 = s2[5].split(",");
        time_5 = b6[1];
        String[] b7 = s2[6].split(",");
        time_6 = b7[1];

        Status = bo.GetField("Status").get_NativeValue().toString();
        String[] s1 = Status.split(";");
        String[] a1 = s1[0].split(":");
        date = a1[0]; // 星期日
        permission = a1[1];
        String[] a2 = s1[1].split(":");
        date_1 = a2[0]; // 星期一
        permission_1 = a2[1];
        String[] a3 = s1[2].split(":");
        date_2 = a3[0]; // 星期二
        permission_2 = a3[1];
        String[] a4 = s1[3].split(":");
        date_3 = a4[0]; // 星期三
        permission_3 = a4[1];
        String[] a5 = s1[4].split(":");
        date_4 = a5[0]; // 星期四
        permission_4 = a5[1];
        String[] a6 = s1[5].split(":");
        date_5 = a6[0]; // 星期五
        permission_5 = a6[1];
        String[] a7 = s1[6].split(":");
        date_6 = a7[0]; // 星期六
        permission_6 = a7[1];
      }
    }

    text = new Text(composite_1, SWT.BORDER); // 任务计划名称
    text.setLocation(137, 0);
    text.setSize(177, 18);
    text.setText(TaskName);
    text.setEnabled(false);

    Label lblNewLabel = new Label(composite_1, SWT.NONE);
    lblNewLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    lblNewLabel.setFont(SWTResourceManager.getFont("宋体", 10, SWT.NORMAL));
    lblNewLabel.setBounds(10, 2, 102, 18);
    lblNewLabel.setText("\u4EFB\u52A1\u8BA1\u5212\u540D\u79F0*:");

    Composite composite_2 = new Composite(sashForm, SWT.NONE);
    composite_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

    lblNewLabel_1 = new Label(composite_2, SWT.NONE);
    lblNewLabel_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_1.setBounds(20, 10, 54, 16);
    lblNewLabel_1.setText("星期日");

    btnCheckButton = new Button(composite_2, SWT.CHECK);
    btnCheckButton.setBounds(102, 8, 45, 16);
    btnCheckButton.setBackground(EccTreeControl.color);
    btnCheckButton.setText("\u5141\u8BB8");
    if (lblNewLabel_1.getText().equals(date) && permission.equals("允许")) {
      btnCheckButton.setSelection(true);
    } else if (lblNewLabel_1.getText().equals(date) && permission.equals("禁止")) {
      btnCheckButton.setSelection(false);
    }

    final DateTime startTime = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime.setLocation(164, 10);
    startTime.setSize(79, 15);
    int h = Integer.parseInt(time.substring(0, time.indexOf(":")));
    int m = Integer.parseInt(time.substring(time.indexOf(":") + 1, time.lastIndexOf(":")));
    int mm = Integer.parseInt(time.substring(time.lastIndexOf(":") + 1));
    startTime.setTime(h, m, mm);
    startTimeStr =
        startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
    startTime.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr =
                startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_2 = new Label(composite_2, SWT.NONE);
    lblNewLabel_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_2.setBounds(20, 32, 54, 16);
    lblNewLabel_2.setText("星期一");

    btnCheckButton_1 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_1.setBounds(102, 30, 45, 16);
    btnCheckButton_1.setBackground(EccTreeControl.color);
    btnCheckButton_1.setText("\u5141\u8BB8");
    if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("允许")) {
      btnCheckButton_1.setSelection(true);
    } else if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("禁止")) {
      btnCheckButton_1.setSelection(false);
    }

    final DateTime startTime_1 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_1.setLocation(164, 31);
    startTime_1.setSize(79, 15);
    int h1 = Integer.parseInt(time_1.substring(0, time_1.indexOf(":")));
    int m1 = Integer.parseInt(time_1.substring(time_1.indexOf(":") + 1, time_1.lastIndexOf(":")));
    int mm1 = Integer.parseInt(time_1.substring(time_1.lastIndexOf(":") + 1));
    startTime_1.setTime(h1, m1, mm1);
    startTimeStr_1 =
        startTime_1.getHours() + ":" + startTime_1.getMinutes() + ":" + startTime_1.getSeconds();
    startTime_1.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_1 =
                startTime_1.getHours()
                    + ":"
                    + startTime_1.getMinutes()
                    + ":"
                    + startTime_1.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_3 = new Label(composite_2, SWT.NONE);
    lblNewLabel_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_3.setBounds(20, 54, 54, 16);
    lblNewLabel_3.setText("星期二");

    btnCheckButton_2 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_2.setBackground(EccTreeControl.color);
    btnCheckButton_2.setBounds(102, 51, 45, 16);
    btnCheckButton_2.setText("\u5141\u8BB8");
    if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("允许")) {
      btnCheckButton_2.setSelection(true);
    } else if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("禁止")) {
      btnCheckButton_2.setSelection(false);
    }

    final DateTime startTime_2 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_2.setLocation(164, 52);
    startTime_2.setSize(79, 15);
    int h2 = Integer.parseInt(time_2.substring(0, time_2.indexOf(":")));
    int m2 = Integer.parseInt(time_2.substring(time_2.indexOf(":") + 1, time_2.lastIndexOf(":")));
    int mm2 = Integer.parseInt(time_2.substring(time_2.lastIndexOf(":") + 1));
    startTime_2.setTime(h2, m2, mm2);
    startTimeStr_2 =
        startTime_2.getHours() + ":" + startTime_2.getMinutes() + ":" + startTime_2.getSeconds();
    startTime_2.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_2 =
                startTime_2.getHours()
                    + ":"
                    + startTime_2.getMinutes()
                    + ":"
                    + startTime_2.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_4 = new Label(composite_2, SWT.NONE);
    lblNewLabel_4.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_4.setBounds(20, 76, 54, 16);
    lblNewLabel_4.setText("星期三");

    btnCheckButton_3 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_3.setBackground(EccTreeControl.color);
    btnCheckButton_3.setBounds(102, 71, 45, 16);
    btnCheckButton_3.setText("\u5141\u8BB8");
    if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("允许")) {
      btnCheckButton_3.setSelection(true);
    } else if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("禁止")) {
      btnCheckButton_3.setSelection(false);
    }

    final DateTime startTime_3 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_3.setLocation(164, 73);
    startTime_3.setSize(79, 15);
    int h3 = Integer.parseInt(time_3.substring(0, time_3.indexOf(":")));
    int m3 = Integer.parseInt(time_3.substring(time_3.indexOf(":") + 1, time_3.lastIndexOf(":")));
    int mm3 = Integer.parseInt(time_3.substring(time_3.lastIndexOf(":") + 1));
    startTime_3.setTime(h3, m3, mm3);
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTime_3.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_3 =
                startTime_3.getHours()
                    + ":"
                    + startTime_3.getMinutes()
                    + ":"
                    + startTime_3.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_5 = new Label(composite_2, SWT.NONE);
    lblNewLabel_5.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_5.setBounds(20, 98, 54, 16);
    lblNewLabel_5.setText("星期四");

    button = new Button(composite_2, SWT.CHECK);
    button.setBackground(EccTreeControl.color);
    button.setText("\u5141\u8BB8");
    button.setBounds(102, 93, 45, 16);
    if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("允许")) {
      button.setSelection(true);
    } else if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("禁止")) {
      button.setSelection(false);
    }

    final DateTime startTime_4 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_4.setLocation(164, 94);
    startTime_4.setSize(79, 15);
    int h4 = Integer.parseInt(time_4.substring(0, time_4.indexOf(":")));
    int m4 = Integer.parseInt(time_4.substring(time_4.indexOf(":") + 1, time_4.lastIndexOf(":")));
    int mm4 = Integer.parseInt(time_4.substring(time_4.lastIndexOf(":") + 1));
    startTime_4.setTime(h4, m4, mm4);
    startTimeStr_4 =
        startTime_4.getHours() + ":" + startTime_4.getMinutes() + ":" + startTime_4.getSeconds();
    startTime_4.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_4 =
                startTime_4.getHours()
                    + ":"
                    + startTime_4.getMinutes()
                    + ":"
                    + startTime_4.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_6 = new Label(composite_2, SWT.NONE);
    lblNewLabel_6.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_6.setBounds(20, 120, 54, 12);
    lblNewLabel_6.setText("星期五");
    btnCheckButton_4 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_4.setBackground(EccTreeControl.color);
    btnCheckButton_4.setBounds(102, 115, 45, 16);
    btnCheckButton_4.setText("\u5141\u8BB8");
    if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("允许")) {
      btnCheckButton_4.setSelection(true);
    } else if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("禁止")) {
      btnCheckButton_4.setSelection(false);
    }

    final DateTime startTime_5 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_5.setLocation(164, 115);
    startTime_5.setSize(79, 15);
    int h5 = Integer.parseInt(time_5.substring(0, time_5.indexOf(":")));
    int m5 = Integer.parseInt(time_5.substring(time_5.indexOf(":") + 1, time_5.lastIndexOf(":")));
    int mm5 = Integer.parseInt(time_5.substring(time_5.lastIndexOf(":") + 1));
    startTime_5.setTime(h5, m5, mm5);
    startTimeStr_5 =
        startTime_5.getHours() + ":" + startTime_5.getMinutes() + ":" + startTime_5.getSeconds();
    startTime_5.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_5 =
                startTime_5.getHours()
                    + ":"
                    + startTime_5.getMinutes()
                    + ":"
                    + startTime_5.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_7 = new Label(composite_2, SWT.NONE);
    lblNewLabel_7.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_7.setBounds(20, 142, 54, 16);
    lblNewLabel_7.setText("星期六");

    btnCheckButton_5 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_5.setBackground(EccTreeControl.color);
    btnCheckButton_5.setBounds(102, 137, 45, 16);
    btnCheckButton_5.setText("\u5141\u8BB8");
    if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("允许")) {
      btnCheckButton_5.setSelection(true);
    } else if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("禁止")) {
      btnCheckButton_5.setSelection(false);
    }

    final DateTime startTime_6 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_6.setLocation(164, 136);
    startTime_6.setSize(79, 15);
    int h6 = Integer.parseInt(time_6.substring(0, time_6.indexOf(":")));
    int m6 = Integer.parseInt(time_6.substring(time_6.indexOf(":") + 1, time_6.lastIndexOf(":")));
    int mm6 = Integer.parseInt(time_6.substring(time_6.lastIndexOf(":") + 1));
    startTime_6.setTime(h6, m6, mm6);
    startTimeStr_6 =
        startTime_6.getHours() + ":" + startTime_6.getMinutes() + ":" + startTime_6.getSeconds();
    startTime_6.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_6 =
                startTime_6.getHours()
                    + ":"
                    + startTime_6.getMinutes()
                    + ":"
                    + startTime_6.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    sashForm.setWeights(new int[] {1, 8});

    TabItem describeItem = new TabItem(tabFolder, SWT.NONE);
    describeItem.setText("描述");

    Composite composite2 = new Composite(tabFolder, SWT.NONE);
    composite2.setBackground(EccTreeControl.color);
    describeItem.setControl(composite2);
    composite2.setLayout(new BorderLayout(0, 0));

    Label label = new Label(composite2, SWT.HORIZONTAL);
    label.setAlignment(SWT.CENTER);
    label.setBackground(EccTreeControl.color);
    label.setBounds(0, 0, 54, 199);
    label.setLayoutData(BorderLayout.WEST);
    label.setText("\u63CF\u8FF0\uFF1A");

    text1 = new Text(composite2, SWT.WRAP | SWT.BORDER); // 描述
    text1.setLayoutData(BorderLayout.CENTER);
    text1.setText(Instruction);

    return composite;
  }
示例#9
0
  /**
   * Create contents of the dialog.
   *
   * @param parent
   */
  @Override
  protected Control createDialogArea(Composite parent) {

    getShell().setText("Geleistete Arbeit anlegen oder anpassen");

    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));

    parentForm = formToolkit.createForm(container);
    formToolkit.paintBordersFor(parentForm);
    formToolkit.decorateFormHeading(parentForm);
    parentForm.setText("Geleistete Arbeit anlegen oder anpassen");

    IToolBarManager toolbar = parentForm.getToolBarManager();
    Action reuseSelectionAction = new InternalReuseEntryAction();
    toolbar.add(reuseSelectionAction);
    toolbar.update(true);

    parentForm.getBody().setLayout(new GridLayout(1, false));

    Composite composite = formToolkit.createComposite(parentForm.getBody(), SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    formToolkit.paintBordersFor(composite);
    composite.setLayout(new GridLayout(4, false));

    Label dateLabel = new Label(composite, SWT.NONE);
    dateLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    formToolkit.adapt(dateLabel, true, true);
    dateLabel.setText("Datum");

    dateTime = new DateTime(composite, SWT.BORDER | SWT.CALENDAR);
    formToolkit.adapt(dateTime);
    formToolkit.paintBordersFor(dateTime);

    Label timeLabel = new Label(composite, SWT.NONE);
    timeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
    formToolkit.adapt(timeLabel, true, true);
    timeLabel.setText("Dauer (in h)");

    timeText = new Text(composite, SWT.NONE);
    timeText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    formToolkit.adapt(timeText, true, true);

    Label workLabel = new Label(composite, SWT.NONE);
    workLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    formToolkit.adapt(workLabel, true, true);
    workLabel.setText("Tätigkeit");

    workComboViewer = new ComboViewer(composite, SWT.NONE);
    Combo workCombo = workComboViewer.getCombo();
    workCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    formToolkit.paintBordersFor(workCombo);

    Label personLabel = new Label(composite, SWT.NONE);
    personLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    formToolkit.adapt(personLabel, true, true);
    personLabel.setText("Person");

    personComboViewer = new ComboViewer(composite, SWT.NONE);
    Combo personCombo = personComboViewer.getCombo();
    personCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    formToolkit.paintBordersFor(personCombo);

    Label commentLabel = new Label(composite, SWT.NONE);
    commentLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
    formToolkit.adapt(commentLabel, true, true);
    commentLabel.setText("Bemerkungen");

    commentText = new Text(composite, SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    GridData gd_commentText = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    gd_commentText.heightHint = 50;
    commentText.setLayoutData(gd_commentText);
    formToolkit.adapt(commentText, true, true);

    Label label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridData gd_label = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
    gd_label.heightHint = 10;
    label.setLayoutData(gd_label);
    formToolkit.adapt(label, true, true);

    bandTypeLabel = new Label(composite, SWT.NONE);
    bandTypeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    formToolkit.adapt(bandTypeLabel, true, true);
    bandTypeLabel.setText("Band Typ");

    bandTypeComboViewer = new ComboViewer(composite, SWT.NONE);
    bandTypeCombo = bandTypeComboViewer.getCombo();
    bandTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    formToolkit.paintBordersFor(bandTypeCombo);

    amountLabel = new Label(composite, SWT.NONE);
    amountLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    formToolkit.adapt(amountLabel, true, true);
    amountLabel.setText("Anzahl");

    amountText = new Text(composite, SWT.NONE);
    amountText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    formToolkit.adapt(amountText, true, true);

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    trackLink = new Link(composite, SWT.NONE);
    trackLink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    formToolkit.adapt(trackLink, true, true);
    trackLink.setText("<a>Bahn(en)</a>");

    trackText = new Text(composite, SWT.NONE);
    trackText.setEditable(false);
    trackText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    formToolkit.adapt(trackText, true, true);

    bandTypeLabel.setEnabled(false);
    bandTypeCombo.setEnabled(false);
    amountLabel.setEnabled(false);
    amountText.setEnabled(false);
    trackLink.setEnabled(false);
    trackText.setEnabled(false);

    DefaultStructuredContentProvider provider = new DefaultStructuredContentProvider();
    workComboViewer.setContentProvider(provider);
    personComboViewer.setContentProvider(provider);
    bandTypeComboViewer.setContentProvider(provider);

    InternalLabelProvider labelProvider = new InternalLabelProvider();
    workComboViewer.setLabelProvider(labelProvider);
    personComboViewer.setLabelProvider(labelProvider);
    bandTypeComboViewer.setLabelProvider(labelProvider);

    if (root.getWorks() != null && !root.getWorks().getWork().isEmpty()) {
      if (bandActionOnly) {
        workComboViewer.addFilter(new IntenalViewerFilter());
      }
      workComboViewer.setInput(root.getWorks().getWork());
    } else {
      workLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
    }
    if (root.getPersons() != null && !root.getPersons().getPerson().isEmpty()) {
      personComboViewer.setInput(root.getPersons().getPerson());
    } else {
      personLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
    }

    bandTypeComboViewer.setInput(BandTypes.values());

    if (editMode) {
      if (entry.getDate() != null) {
        Calendar c = Calendar.getInstance();
        c.setTime(entry.getDate());
        dateTime.setDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE));
      }
      if (entry.getTime() != null) {
        timeText.setText("" + entry.getTime());
      }
      if (entry.getComment() != null) {
        commentText.setText(entry.getComment());
      }
      if (entry.getPersonId() != null) {
        PersonType pt = null;
        if (root.getPersons() != null) {
          for (PersonType p : root.getPersons().getPerson()) {
            if (p.getId().equals(entry.getPersonId())) {
              pt = p;
              break;
            }
          }
        }
        if (pt != null) {
          StructuredSelection s = new StructuredSelection(pt);
          personComboViewer.setSelection(s);
          currentPersonType = pt;
        }
        personCombo.setEnabled(false);
      }
      if (entry.getWorkId() != null) {
        WorkType wt = null;
        if (root.getWorks() != null) {
          for (WorkType w : root.getWorks().getWork()) {
            if (w.getId().equals(entry.getWorkId())) {
              wt = w;
              break;
            }
          }
        }
        if (wt != null) {
          StructuredSelection s = new StructuredSelection(wt);
          workComboViewer.setSelection(s);
          currentWorkType = wt;
        }
        workCombo.setEnabled(false);
      }
      if (entry.getBandAction() != null) {
        if (entry.getBandAction().getBandType() != null) {
          StructuredSelection s = new StructuredSelection(entry.getBandAction().getBandType());
          bandTypeComboViewer.setSelection(s);
        }
        bandTypeLabel.setEnabled(true);
        bandTypeCombo.setEnabled(true);
        if (entry.getBandAction().getAmount() != null) {
          amountText.setText("" + entry.getBandAction().getAmount());
        }
        amountLabel.setEnabled(true);
        amountText.setEnabled(true);
        trackText.setText(getTrackString(entry.getBandAction()));
        trackLink.setEnabled(true);
        trackText.setEnabled(true);
      }
    }

    ModifyListener modifyListener =
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            if (e.widget == timeText) {
              entry.setTime(!timeText.getText().isEmpty() ? Float.valueOf(timeText.getText()) : 0);
            } else if (e.widget == commentText) {
              entry.setComment(!commentText.getText().isEmpty() ? commentText.getText() : null);
            } else if (e.widget == amountText) {
              if (entry.getBandAction() == null)
                entry.setBandAction(factory.createBandActionType());
              if (!amountText.getText().isEmpty()) {
                entry.getBandAction().setAmount(Integer.parseInt(amountText.getText()));
              } else {
                entry.getBandAction().setAmount(null);
              }
            }
          }
        };
    timeText.addModifyListener(modifyListener);
    commentText.addModifyListener(modifyListener);
    amountText.addModifyListener(modifyListener);

    SelectionAdapter selectionAdapter =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (e.widget == dateTime) {
              Calendar c = Calendar.getInstance();
              c.set(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay());
              entry.setDate(c.getTime());
            } else if (e.widget == trackLink) {
              InternalTrackSelectionDialog dialog =
                  new InternalTrackSelectionDialog(getShell(), entry.getBandAction());
              if (InternalTrackSelectionDialog.OK == dialog.open()) {
                BandActionType ba = dialog.getBandAction();
                if (entry.getBandAction() == null) entry.setBandAction(ba);
                else {
                  entry.getBandAction().getTrack().clear();
                  entry.getBandAction().getTrack().addAll(ba.getTrack());
                }
                trackText.setText(getTrackString(entry.getBandAction()));
              }
            }
          }
        };
    dateTime.addSelectionListener(selectionAdapter);
    trackLink.addSelectionListener(selectionAdapter);

    ISelectionChangedListener seleChangedListener =
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSource() == workComboViewer) {
              WorkType wt =
                  (WorkType)
                      ((IStructuredSelection) workComboViewer.getSelection()).getFirstElement();
              if (wt != null) {
                currentWorkType = wt;
                entry.setWorkId(wt.getId());
                if (wt.isAffectBand() != null && wt.isAffectBand()) {
                  bandTypeLabel.setEnabled(true);
                  bandTypeCombo.setEnabled(true);
                  amountLabel.setEnabled(true);
                  amountText.setEnabled(true);
                  trackLink.setEnabled(true);
                  trackText.setEnabled(true);
                } else {
                  bandTypeLabel.setEnabled(false);
                  bandTypeCombo.setEnabled(false);
                  amountLabel.setEnabled(false);
                  amountText.setEnabled(false);
                  trackLink.setEnabled(false);
                  trackText.setEnabled(false);
                }
              } else {
                currentWorkType = null;
              }
            } else if (event.getSource() == personComboViewer) {
              PersonType pt =
                  (PersonType)
                      ((IStructuredSelection) personComboViewer.getSelection()).getFirstElement();
              if (pt != null) {
                currentPersonType = pt;
                entry.setPersonId(pt.getId());
              } else {
                currentPersonType = null;
              }
            } else if (event.getSource() == bandTypeComboViewer) {
              BandTypes bt =
                  (BandTypes)
                      ((IStructuredSelection) bandTypeComboViewer.getSelection()).getFirstElement();
              if (entry.getBandAction() == null)
                entry.setBandAction(factory.createBandActionType());
              if (bt != null) {
                entry.getBandAction().setBandType(bt);
              } else {
                entry.getBandAction().setBandType(null);
              }
            }
          }
        };
    workComboViewer.addSelectionChangedListener(seleChangedListener);
    personComboViewer.addSelectionChangedListener(seleChangedListener);
    bandTypeComboViewer.addSelectionChangedListener(seleChangedListener);

    return container;
  }
  /** @see IDialogPage#createControl(Composite) */
  @Override
  public void createControl(Composite parent) {

    // Set up the composite to hold all the information
    sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    sc.setLayout(new FillLayout());

    final Composite composite = new Composite(sc, SWT.NULL);
    composite.setLocation(-708, 1);
    composite.setLayout(new GridLayout(2, false));

    // Specify the expansion Adapter
    expansionAdapter =
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            // advanced options expanded, resize
            composite.layout();
            sc.notifyListeners(SWT.Resize, null);

            // force shell resize
            Point size;
            if (e.getState()) size = getShell().computeSize(550, 920);
            else size = getShell().computeSize(550, 400);

            getShell().setSize(size);
          }
        };

    Label lblNewLabel = new Label(composite, SWT.NONE);
    lblNewLabel.setText("&ICAT site ID");

    icatIDCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatIDCombo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatIDCombo.widthHint = 269;
    icatIDCombo.setLayoutData(gd_icatIDCombo);
    icatIDCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            logger.debug("selection changed: " + icatIDCombo.getText());

            // change remaining parameters
            int index = icatIDCombo.getSelectionIndex();
            icatSiteNameText.setText(
                getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
            txtSftpServer.setText(
                getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));
            txtDirectory.setText(
                getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));
          }
        });

    /*
     * populate wizard with current ICAT preferences
     */
    icatIDCombo.removeAll();

    String[] tokens = preferenceStore.getDefaultString("ICAT_ID_PREF").split(DELIMITER);

    for (int count = 0; count < tokens.length; count++) {
      icatIDCombo.add(tokens[count]);
    }
    icatIDCombo.select(0);

    int index = icatIDCombo.getSelectionIndex();

    Label lblicatDatabase = new Label(composite, SWT.NONE);
    lblicatDatabase.setText("&ICAT site name:");

    icatSiteNameText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatSiteNameText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatSiteNameText.widthHint = 260;
    icatSiteNameText.setLayoutData(gd_icatSiteNameText);
    icatSiteNameText.setEditable(false);
    icatSiteNameText.setText(
        getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
    icatSiteNameText.setBounds(113, 53, 212, 27);

    Label fedidLbl = new Label(composite, SWT.NONE);
    fedidLbl.setText("&FedId:");

    txtFedid = new Text(composite, SWT.BORDER);
    GridData gd_txtFedid = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFedid.widthHint = 260;
    txtFedid.setLayoutData(gd_txtFedid);
    txtFedid.setText(initFedid);
    txtFedid.addKeyListener(this);

    Label passwordLbl = new Label(composite, SWT.NONE);
    passwordLbl.setBounds(4, 139, 64, 13);
    passwordLbl.setText("&Password:"******"&Project name:");
    txtProject = new Text(composite, SWT.BORDER);
    GridData gd_txtProject = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtProject.widthHint = 260;
    txtProject.setLayoutData(gd_txtProject);
    txtProject.setBounds(113, 173, 212, 27);
    txtProject.setText(initProject);
    txtProject.addKeyListener(this);
    sc.setContent(composite);
    sc.setExpandVertical(true);
    sc.setExpandHorizontal(true);

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    /** set-up advanced options GUI elements */
    advancedOptionsExpander = new ExpandableComposite(composite, SWT.NONE);
    GridData gd_advancedOptionsExpander = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_advancedOptionsExpander.widthHint = 242;
    advancedOptionsExpander.setLayoutData(gd_advancedOptionsExpander);
    advancedOptionsExpander.setLayout(new GridLayout(2, false));
    advancedOptionsExpander.setText("Advanced Options");
    advancedOptionsExpander.setExpanded(false);

    Composite optionsComposite = new Composite(advancedOptionsExpander, SWT.NONE);
    optionsComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    optionsComposite.setLayout(new GridLayout(3, false));

    Label sftpServerLbl = new Label(optionsComposite, SWT.NONE);
    sftpServerLbl.setText("&SFTP server:");

    txtSftpServer = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtSftpServer = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtSftpServer.widthHint = 193;
    txtSftpServer.setLayoutData(gd_txtSftpServer);
    txtSftpServer.setEditable(true);
    txtSftpServer.setText(
        getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));

    final Button btnSftpTest = new Button(optionsComposite, SWT.NONE);
    GridData gd_btnSftpTest = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSftpTest.widthHint = 100;
    btnSftpTest.setLayoutData(gd_btnSftpTest);
    btnSftpTest.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            /*
             * test server using ping
             */
            if (NetworkUtils.isReachable(txtSftpServer.getText())) {
              Image okImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/ok.png"));
              ;
              btnSftpTest.setImage(okImage);
            } else {
              Image noImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/no.png"));
              ;
              btnSftpTest.setImage(noImage);
            }
          }
        });
    btnSftpTest.setText("Test");

    txtSftpServer.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            btnSftpTest.setImage(null);
          }
        });

    Label lbldownloadDirectory = new Label(optionsComposite, SWT.NULL);
    lbldownloadDirectory.setText("&Download directory:");

    txtDirectory = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtDirectory.widthHint = 193;
    txtDirectory.setLayoutData(gd_txtDirectory);
    txtDirectory.setEditable(true);
    txtDirectory.setEnabled(true);

    txtDirectory.setText(
        getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));

    Button BtnBrowseDirectory = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseDirectory.widthHint = 100;
    BtnBrowseDirectory.setLayoutData(gd_BtnBrowseDirectory);
    BtnBrowseDirectory.setText("Browse...");
    BtnBrowseDirectory.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleDownloadDirBrowse();
          }
        });

    Label lbltruststorePath = new Label(optionsComposite, SWT.NONE);
    lbltruststorePath.setBounds(10, 131, 103, 19);
    lbltruststorePath.setText("&Truststore path:");

    txtTruststore = new Text(optionsComposite, SWT.BORDER);
    txtTruststore.setText(
        getToken(index, preferenceStore.getString("ICAT_TRUSTSTORE_PATH_PREF"), DELIMITER));
    GridData gd_txtTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststore.widthHint = 193;
    txtTruststore.setLayoutData(gd_txtTruststore);
    txtTruststore.setEnabled(true);
    txtTruststore.setEditable(true);

    Button BtnBrowseTruststore = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseTruststore.widthHint = 100;
    BtnBrowseTruststore.setLayoutData(gd_BtnBrowseTruststore);
    BtnBrowseTruststore.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleTruststoreBrowse();
          }
        });
    BtnBrowseTruststore.setText("Browse...");

    Label lbltruststorePassword = new Label(optionsComposite, SWT.NONE);
    lbltruststorePassword.setText("&Truststore password:"******"ICAT_TRUSTSTORE_PASS_PREF"), DELIMITER));
    GridData gd_txtTruststorePassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststorePassword.widthHint = 193;
    txtTruststorePassword.setLayoutData(gd_txtTruststorePassword);
    txtTruststorePassword.setEnabled(true);
    txtTruststorePassword.addKeyListener(this);

    final Button btnShowPassword = new Button(optionsComposite, SWT.CHECK);
    btnShowPassword.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (btnShowPassword.getSelection()) {
              txtTruststorePassword.setEchoChar((char) 0);
            } else {
              txtTruststorePassword.setEchoChar('*');
            }
          }
        });
    btnShowPassword.setText("Show password");

    // set default FROM date to current date
    Calendar calA = Calendar.getInstance();

    Label lblFrom = new Label(optionsComposite, SWT.TOP);
    lblFrom.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblFrom.setText("Visit StartDate from:");
    dateFrom = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateFrom.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    dateFrom.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    GridData gd_dateFrom = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateFrom.widthHint = 193;
    dateFrom.setLayoutData(gd_dateFrom);
    dateFrom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set from date
            setSqlFromDate(dateFrom);
          }
        });

    dateFrom.setYear(2006); // calA.get(Calendar.YEAR));
    dateFrom.setMonth(calA.get(Calendar.MONTH));
    dateFrom.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlFromDate(dateFrom);

    Label lblTo = new Label(optionsComposite, SWT.TOP);
    lblTo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblTo.setText("Visit StartDate to:");
    dateTo = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateTo.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    dateTo.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    GridData gd_dateTo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateTo.widthHint = 193;
    dateTo.setLayoutData(gd_dateTo);
    dateTo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set to date
            setSqlToDate(dateTo);
          }
        });
    // end with current date + 1 month
    dateTo.setYear(calA.get(Calendar.YEAR));
    dateTo.setMonth(calA.get(Calendar.MONTH) + 1);
    dateTo.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlToDate(dateTo);

    advancedOptionsExpander.setClient(optionsComposite);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    advancedOptionsExpander.addExpansionListener(expansionAdapter);
    setControl(composite);

    dialogChanged();

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
  }
示例#11
0
  @Override
  public void createControl(Composite parent) {
    container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);

    layout.numColumns = 2;
    Label label1 = new Label(container, SWT.NULL);
    label1.setText("Select Your Agent");
    listViewer = new ListViewer(container);
    list.add("Big Travels");
    list.add("Aviator Travels");
    list.add("BTM Travels");
    list.add("Arihanth Travels");
    list.add("Atlas Travels");
    Object[] list1 = list.toArray();
    listViewer.add(list1);

    Label label2 = new Label(container, SWT.NULL);
    label2.setText("Select travel start date:");
    dateFrom = new DateTime(container, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN);
    listViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            sb = "";
            // sb.append("tatal " + selection.size() + " items selected: ");
            for (java.util.Iterator iterator = selection.iterator(); iterator.hasNext(); ) {
              sb = (String) (iterator.next());
              // sb.replace(0,sb.length(),(String) iterator.next());
              break;
            }

            System.out.println("Your agent is " + sb);
          }
        });
    dateFrom.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(SelectionEvent e) {

            // System.out.println ("Calendar date selected (MM/DD/YYYY) = " + (dateFrom.getMonth ()
            // + 1) + "/" + dateFrom.getDay () + "/" + dateFrom.getYear ());
            date.delete(0, date.length());
            date.append((dateFrom.getMonth() + 1));
            date.append("/");
            date.append(dateFrom.getDay());
            date.append("/");
            date.append(dateFrom.getYear());
            // System.out.println("After adding to date "+date);
            // System.out.println ("Date selected (MM/YYYY) = " + (date.getMonth () + 1) + "/" +
            // date.getYear ());

            // System.out.println ("Time selected (HH:MM) = " + time.getHours () + ":" +
            // (time.getMinutes () < 10 ? "0" : "") + time.getMinutes ());

            // dialog.close ();

          }
        });

    // dateFrom.setDate();
    /*L bel label1 = new Label(container, SWT.NULL);
    label1.setText("Travel Name");

    text1 = new Text(container, SWT.BORDER | SWT.SINGLE);
    text1.setText("");
    text1.addKeyListener(new KeyListener() {

      @Override
      public void keyPressed(KeyEvent e) {
      }

      @Override
      public void keyReleased(KeyEvent e) {
        if (!text1.getText().isEmpty()) {
          setPageComplete(true);

        }
      }

    });*/
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    // listViewer.setLayoutData(gd);
    // Required to avoid an error in the system
    setControl(container);
    setPageComplete(false);
  }