public ColumnTitleFigure(MapperTablePart xmlTreePart) {
    this.xmlTreePart = xmlTreePart;
    AbstractInOutTree xmlTree = (AbstractInOutTree) xmlTreePart.getModel();
    if (xmlTree instanceof InputXmlTree) {
      InputXmlTree inputTree = (InputXmlTree) xmlTree;
      if (inputTree.isLookup()) {
        Label expression = new Label();
        expression.setText("Exp.key");
        expression.setBorder(new MarginBorder(3, 10, 3, -1));
        expression.setLabelAlignment(PositionConstants.LEFT);
        this.add(expression);
      }
    } else {
      Label expression = new Label();
      expression.setText("Expression");
      expression.setBorder(new MarginBorder(3, 10, 3, -1));
      expression.setLabelAlignment(PositionConstants.LEFT);
      this.add(expression);
    }

    Label column1 = new Label();
    column1.setText("Column");
    column1.setBorder(new MarginBorder(3, 10, 3, -1));
    column1.setLabelAlignment(PositionConstants.LEFT);
    this.add(column1);

    setLayoutManager(new ColumnTitleLayout());

    setBackgroundColor(ColorConstants.menuBackground);
    setOpaque(true);
  }
Beispiel #2
0
  public HeaderFigure() {
    setLayoutManager(new GridLayout());

    LineBorder border = new LineBorder();
    border.setStyle(SWT.LINE_DASH);
    setBorder(border);
    setBackgroundColor(ColorConstants.button);
    setOpaque(true);

    label = new Label();
    label.setLabelAlignment(PositionConstants.LEFT);

    add(label);
  }
    public InterceptorsFigure() {
      ToolbarLayout layout = new ToolbarLayout();
      setLayoutManager(layout);
      setBorder(new LineBorder(ColorConstants.black, 1));

      /* Header Label */
      Label constantLabel = new Label("Interceptors");
      constantLabel.setLabelAlignment(PositionConstants.LEFT);
      constantLabel.setIcon(
          S2EditorUI.getImageDescriptor("icons/arraypartition_obj.gif").createImage());
      constantLabel.setBackgroundColor(new Color(null, 0xb7, 0xe4, 0xa8));
      constantLabel.setOpaque(true);
      constantLabel.setForegroundColor(ColorConstants.titleForeground);
      constantLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
      add(constantLabel);

      bodyFigure = new BodyFigure();
      add(bodyFigure);
    }
  /*
   * (non-Javadoc)
   *
   * @see org.talend.designer.gefabstractmap.figures.table.AbstractTable#createColumns()
   */
  @Override
  protected void createColumns() {
    TableColumn column = new TableColumn(ColumnKeyConstant.TREE_SETTING_PROPERTY);
    column.setText("Property");
    addColumn(column);

    ColumnSash sash = new ColumnSash(this);
    sash.setLeftColumn(column);
    addSeparator(sash);

    column = new TableColumn(ColumnKeyConstant.TREE_SETTING_VALUE);
    column.setText("Value");
    sash.setRightColumn(column);
    addColumn(column);

    Figure container = getTableItemContainer();

    joinModelRow = new Figure();
    joinModelRow.setLayoutManager(new RowLayout());
    Label label = new Label();
    label.setText("Join Model");
    label.setLabelAlignment(PositionConstants.LEFT);
    CompoundBorder compoundBorder =
        new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    joinModelRow.add(label);
    joinModel = new ComboCellLabel();
    joinModel.setDirectEditType(DirectEditType.JOIN_MODEL);
    joinModel.setText(inputTable.getJoinModel());
    joinModel.setLabelAlignment(PositionConstants.LEFT);
    joinModel.setBorder(new RowBorder(2, 5, 2, -1));
    joinModelRow.add(joinModel);
    container.add(joinModelRow);

    //
    joinOptimizationRow = new Figure();
    joinOptimizationRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Join Optimization");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    joinOptimizationRow.add(label);
    joinOptimization = new ComboCellLabel();
    joinOptimization.setDirectEditType(DirectEditType.JOIN_OPTIMIZATION);
    joinOptimization.setText(getJoinOptimizationDisplayName(inputTable.getJoinOptimization()));
    joinOptimization.setLabelAlignment(PositionConstants.LEFT);
    joinOptimization.setBorder(new RowBorder(2, 5, 2, -1));
    joinOptimizationRow.add(joinOptimization);
    container.add(joinOptimizationRow);

    //
    customPartitionerRow = new Figure();
    customPartitionerRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Custom Partitioner");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    customPartitionerRow.add(label);
    customPartitioner = new TextCellLabel();
    customPartitioner.setDirectEditType(DirectEditType.CUSTOM_PARTITIONER);
    customPartitioner.setText(inputTable.getCustomPartitioner());
    customPartitioner.setLabelAlignment(PositionConstants.LEFT);
    customPartitioner.setBorder(new RowBorder(2, 5, 2, -1));
    customPartitionerRow.add(customPartitioner);
    container.add(customPartitionerRow);

    //
    increaseParallelismRow = new Figure();
    increaseParallelismRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Increase Parallelism");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    increaseParallelismRow.add(label);
    increaseParallelism = new TextCellLabel();
    increaseParallelism.setDirectEditType(DirectEditType.INCREASE_PARALLELISM);
    increaseParallelism.setText(inputTable.getIncreaseParallelism());
    increaseParallelism.setLabelAlignment(PositionConstants.LEFT);
    increaseParallelism.setBorder(new RowBorder(2, 5, 2, -1));
    increaseParallelismRow.add(increaseParallelism);
    container.add(increaseParallelismRow);
    container.setOpaque(true);
    container.setBackgroundColor(ColorConstants.white);

    container.addMouseListener(
        new MouseListener() {

          Figure selectedFigure = null;

          @Override
          public void mousePressed(MouseEvent me) {
            boolean joinOptimization = joinOptimizationRow.containsPoint(me.x, me.y);
            if (joinOptimization) {
              if (selectedFigure != joinOptimizationRow) {
                joinOptimizationRow.setOpaque(true);
                joinOptimizationRow.setBackgroundColor(
                    ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                customPartitionerRow.setOpaque(false);
                joinModelRow.setOpaque(false);
                increaseParallelismRow.setOpaque(false);
              }
              return;
            }
            boolean customPartitioner = customPartitionerRow.containsPoint(me.x, me.y);
            if (customPartitioner) {
              if (selectedFigure != customPartitionerRow) {
                customPartitionerRow.setOpaque(true);
                customPartitionerRow.setBackgroundColor(
                    ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                joinOptimizationRow.setOpaque(false);
                joinModelRow.setOpaque(false);
                increaseParallelismRow.setOpaque(false);
              }
              return;
            }
            boolean joinModel = joinModelRow.containsPoint(me.x, me.y);
            if (joinModel) {
              if (selectedFigure != joinModelRow) {
                joinModelRow.setOpaque(true);
                joinModelRow.setBackgroundColor(
                    ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                joinOptimizationRow.setOpaque(false);
                customPartitionerRow.setOpaque(false);
                increaseParallelismRow.setOpaque(false);
              }
              return;
            }
            boolean increaseParallelism = increaseParallelismRow.containsPoint(me.x, me.y);
            if (increaseParallelism) {
              if (selectedFigure != increaseParallelismRow) {
                increaseParallelismRow.setOpaque(true);
                increaseParallelismRow.setBackgroundColor(
                    ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                joinOptimizationRow.setOpaque(false);
                customPartitionerRow.setOpaque(false);
                joinModelRow.setOpaque(false);
              }
            }
          }

          @Override
          public void mouseReleased(MouseEvent me) {}

          @Override
          public void mouseDoubleClicked(MouseEvent me) {}
        });
  }