예제 #1
0
  /** @see de.willuhn.jameica.gui.AbstractView#bind() */
  public void bind() throws Exception {
    // draw the title
    GUI.getView().setTitle(Settings.i18n().tr("Project details"));

    // instanciate controller
    final ProjectControl control = new ProjectControl(this);

    Container c = new SimpleContainer(getParent());

    // layout with 2 columns
    ColumnLayout columns = new ColumnLayout(c.getComposite(), 2);

    // left side
    Container left = new SimpleContainer(columns.getComposite());
    left.addHeadline(Settings.i18n().tr("Details"));
    left.addInput(control.getName());
    left.addInput(control.getPrice());
    left.addInput(control.getStartDate());
    left.addInput(control.getEndDate());

    // right side
    Container right = new SimpleContainer(columns.getComposite(), true);
    right.addHeadline(Settings.i18n().tr("Description"));
    right.addInput(control.getDescription());

    c.addHeadline(Settings.i18n().tr("Summary"));
    c.addInput(control.getEffortSummary());

    // add some buttons
    ButtonArea buttons = new ButtonArea();
    buttons.addButton(Settings.i18n().tr("New Task"), new TaskDetail(), control.getCurrentObject());
    buttons.addButton(
        Settings.i18n().tr("Delete"), new ProjectDelete(), control.getCurrentObject());
    buttons.addButton(
        Settings.i18n().tr("Store"),
        new Action() {
          public void handleAction(Object context) throws ApplicationException {
            control.handleStore();
          }
        },
        null,
        true); // "true" defines this button as the default button

    // Don't forget to paint the button area
    buttons.paint(getParent());

    // show task tasks in this project
    new Headline(getParent(), Settings.i18n().tr("Tasks within this project"));
    control.getTaskList().paint(getParent());
  }
예제 #2
0
  /** @see de.willuhn.jameica.gui.dialogs.PasswordDialog#paint(org.eclipse.swt.widgets.Composite) */
  protected void paint(Composite parent) throws Exception {
    Container container = new SimpleContainer(parent, true, 1);
    container.addHeadline(i18n.tr("Matrixcode"));

    MatrixCode code = new MatrixCode(this.hhduc);
    InputStream stream = new ByteArrayInputStream(code.getImage());
    Image image = SWTUtil.getImage(stream);

    // Breite des Dialogs ermitteln (+ ein paar Pixel Toleranz am Rand)
    int width = image.getBounds().width + 200;

    Label imageLabel = new Label(container.getComposite(), SWT.NONE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalAlignment = SWT.CENTER;
    imageLabel.setLayoutData(gd);
    imageLabel.setImage(image);

    this.setSize(width, SWT.DEFAULT);

    // Hier stehen dann noch die Anweisungen von der Bank drin
    super.paint(parent);
    getShell().setMinimumSize(getShell().computeSize(width, SWT.DEFAULT));
  }