示例#1
0
  public void addExpressionRow(String expressionName) {
    RowData rowdata = (RowData) expressionGroup.getLayoutData();
    rowdata.height += 120;
    expressionGroup.setLayoutData(new RowData(rowdata.width, rowdata.height));
    Rectangle rect = expressionGroup.getBounds();
    rect.height += 120;
    expressionGroup.setBounds(rect);
    /*Create a row*/
    ExpressionBean expBean = expressions.get(new Integer(expCount - 1));
    Label previousLabel = expBean.getLabel();
    rect = previousLabel.getBounds();
    Label lblNew = new Label(expressionGroup, SWT.NONE);
    lblNew.setBounds(10, rect.y + 90, 120, 15);
    lblNew.setText(expressionName);
    lblNew.setFocus();

    Text previousText = expBean.getText();
    rect = previousText.getBounds();

    Text newText = new Text(expressionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    newText.setBounds(135, rect.y + 90, 550, 70);
    expressions.put(new Integer(expCount), new ExpressionBean(lblNew, newText));
    expCount++;
    expScrolledComposite.setMinSize(expressionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  }
示例#2
0
  public void addDescriptionRow(String sectionName) {
    RowData rowdata = (RowData) descriptionGroup.getLayoutData();
    rowdata.height += 60;
    descriptionGroup.setLayoutData(new RowData(rowdata.width, rowdata.height));
    Rectangle rect = descriptionGroup.getBounds();
    rect.height += 60;
    descriptionGroup.setBounds(rect);

    /*Add the row*/
    Text prevText = sections.get(new Integer(secCount - 1)).getEndTokens();
    rect = prevText.getBounds();
    Text newText_1 = new Text(descriptionGroup, SWT.BORDER);
    newText_1.setBounds(10, rect.y + 40, 75, 20);
    newText_1.setFocus();

    Label lblNew = new Label(descriptionGroup, SWT.NONE);
    lblNew.setBounds(120, rect.y + 40, 145, 20);
    lblNew.setText(sectionName);

    Text newText_2 = new Text(descriptionGroup, SWT.BORDER);
    newText_2.setBounds(270, rect.y + 40, 115, 20);

    Text newText_3 = new Text(descriptionGroup, SWT.BORDER);
    newText_3.setBounds(420, rect.y + 40, 115, 20);

    Text newText_4 = new Text(descriptionGroup, SWT.BORDER);
    newText_4.setBounds(570, rect.y + 40, 115, 20);
    sections.put(
        new Integer(secCount), new SectionBean(newText_1, lblNew, newText_2, newText_3, newText_4));
    secCount++;

    descScrolledComposite.setMinSize(descriptionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  }
示例#3
0
 /** @generated */
 public void relocate(CellEditor celleditor) {
   Text text = (Text) celleditor.getControl();
   Rectangle rect = getLabel().getTextBounds().getCopy();
   getLabel().translateToAbsolute(rect);
   int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
   rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
   if (!rect.equals(new Rectangle(text.getBounds()))) {
     text.setBounds(rect.x, rect.y, rect.width, rect.height);
   }
 }
示例#4
0
 @Override
 public void onSashMoved(int height) {
   if (m_optionScroll != null) {
     int substract =
         m_promptText.getBounds().height + m_textInput.getContents().getBounds().height + 25;
     int finalHeight = height - substract;
     ;
     if (finalHeight < 40) finalHeight = 40;
     m_optionScroll.setSize(getClientArea().width, finalHeight);
   }
 }
 /** @generated */
 public void relocate(CellEditor celleditor) {
   Text text = (Text) celleditor.getControl();
   Rectangle rect = getMultilineEditableFigure().getBounds().getCopy();
   rect.x = getMultilineEditableFigure().getEditionLocation().x;
   rect.y = getMultilineEditableFigure().getEditionLocation().y;
   getMultilineEditableFigure().translateToAbsolute(rect);
   if (getMultilineEditableFigure().getText().length() > 0) {
     rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
   }
   if (!rect.equals(new Rectangle(text.getBounds()))) {
     text.setBounds(rect.x, rect.y, rect.width, rect.height);
   }
 }