public void update(int type) { switch (type) { case PigmapPackage.INPUT_TABLE__JOIN_MODEL: joinModel.setText(inputTable.getJoinModel()); break; case PigmapPackage.INPUT_TABLE__JOIN_OPTIMIZATION: joinOptimization.setText(getJoinOptimizationDisplayName(inputTable.getJoinOptimization())); break; case PigmapPackage.INPUT_TABLE__CUSTOM_PARTITIONER: customPartitioner.setText(inputTable.getCustomPartitioner()); break; case PigmapPackage.INPUT_TABLE__INCREASE_PARALLELISM: increaseParallelism.setText(inputTable.getIncreaseParallelism()); default: break; } }
/* * (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) {} }); }