private void registerButton(IConfigRegistry configRegistry) { String CUSTOM_CELL_LABEL = "LABEL4"; buttonPainter = new ButtonCellPainter( new CellPainterDecorator( new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(GUIHelper.getImage("preferences")))); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_PAINTER, buttonPainter, DisplayMode.NORMAL, CUSTOM_CELL_LABEL); // Add your listener to the button // buttonPainter.addClickListener(new MyMouseAction()); // Set the color of the cell. This is picked up by the button painter to style the button Style style = new Style(); style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_GREEN); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, CUSTOM_CELL_LABEL); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, CUSTOM_CELL_LABEL); }
protected void configureSelectionAnchorGridLineStyle(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.anchorGridBorderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE); }
protected void configureSelectionStyle(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.selectionFont); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.selectionBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.selectionFgColor); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT); }
private static void registerPricingCellStyle(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, ALIGN_CELL_CONTENTS_RIGHT_CONFIG_LABEL); }
/** @param configRegistry */ protected void addFillLayoutStyleConfig(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor); cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, DEFAULT_FILL_LAYOUT_CELL_CONFIG_LABEL); }
protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.selectedHeaderFgColor); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.selectedHeaderBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.selectedHeaderFont); cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.selectedHeaderBorderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.COLUMN_HEADER); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.CORNER); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.ROW_HEADER); }
/** @param configRegistry */ protected void configureHeaderFullySelectedStyle(IConfigRegistry configRegistry) { // Header fully selected Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, fullySelectedHeaderBgColor); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE); }
/** @param configRegistry */ protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) { Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectedHeaderFgColor); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectedHeaderBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); switch (getConfig().getHorizontalAlignment()) { case SWT.LEFT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT); break; case SWT.RIGHT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT); break; case SWT.CENTER: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); break; } cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, selectedHeaderBorderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.COLUMN_HEADER); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.CORNER); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.ROW_HEADER); }
protected void applySelectedStyle(Style newColumnCellStyle, String configLabel) { if (newColumnCellStyle == null) { this.stylesToPersist.remove(configLabel); } else { newColumnCellStyle.setAttributeValue( CellStyleAttributes.BORDER_STYLE, this.dialog.getNewColumnBorderStyle()); this.stylesToPersist.put(configLabel, newColumnCellStyle); } this.configRegistry.registerConfigAttribute( CELL_STYLE, newColumnCellStyle, NORMAL, configLabel); }
protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) { // Selection anchor style for normal display mode Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.anchorBorderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); // Selection anchor style for select display mode cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.anchorBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.anchorFgColor); cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.anchorBorderStyle); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); }
@Override public void configureRegistry(IConfigRegistry configRegistry) { super.configureRegistry(configRegistry); Style errorStyle = new Style(); errorStyle.setAttributeValue(CellStyleAttributes.IMAGE, ERROR_IMAGE); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, errorStyle, DisplayMode.NORMAL, Level.SEVERE.toString()); Style warningStyle = new Style(); warningStyle.setAttributeValue(CellStyleAttributes.IMAGE, WARNING_IMAGE); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, warningStyle, DisplayMode.NORMAL, Level.WARNING.toString()); Style informationStyle = new Style(); informationStyle.setAttributeValue(CellStyleAttributes.IMAGE, INFORMATION_IMAGE); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, informationStyle, DisplayMode.NORMAL, Level.INFO.toString()); }
public void configureRegistry(IConfigRegistry configRegistry) { // Register cell style Style cellStyle = new Style(); cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); cellStyle.setAttributeValue( CellStyleAttributes.VERTICAL_ALIGNMENT, VerticalAlignmentEnum.MIDDLE); cellStyle.setAttributeValue( PercentageBarDecorator.PERCENTAGE_BAR_COMPLETE_REGION_START_COLOR, GUIHelper.getColor(new RGB(251, 149, 123))); cellStyle.setAttributeValue( PercentageBarDecorator.PERCENTAGE_BAR_COMPLETE_REGION_END_COLOR, GUIHelper.getColor(new RGB(248, 253, 219))); cellStyle.setAttributeValue( PercentageBarDecorator.PERCENTAGE_BAR_INCOMPLETE_REGION_COLOR, GUIHelper.getColor(new RGB(236, 217, 255))); configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle); // Register custom painter, paints bars configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_PAINTER, new PercentageBarCellPainter(), DisplayMode.NORMAL, GridRegion.BODY.toString()); // Register custom converter, converts to percentage configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new PercentageDisplayConverter(), DisplayMode.NORMAL, GridRegion.BODY.toString()); }
/** @param configRegistry */ protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) { // Selection anchor style for normal display mode Style cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectionBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectionFgColor); switch (getConfig().getHorizontalAlignment()) { case SWT.LEFT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT); break; case SWT.RIGHT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT); break; case SWT.CENTER: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); break; } configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); // Selection anchor style for select display mode cellStyle = new Style(); cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectionBgColor); cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectionFgColor); switch (getConfig().getHorizontalAlignment()) { case SWT.LEFT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT); break; case SWT.RIGHT: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT); break; case SWT.CENTER: cellStyle.setAttributeValue( CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); break; } configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); }
@Override public void configureRegistry(IConfigRegistry configRegistry) { // Configure custom comparator on the rating column configRegistry.registerConfigAttribute( FilterRowConfigAttributes.FILTER_COMPARATOR, getIngnorecaseComparator(), DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2); // If threshold comparison is used we have to convert the string entered by the // user to the correct underlying type (double), so that it can be compared // Configure Bid column configRegistry.registerConfigAttribute( FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER, doubleDisplayConverter, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5); configRegistry.registerConfigAttribute( FilterRowConfigAttributes.TEXT_MATCHING_MODE, TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5); // Configure Ask column configRegistry.registerConfigAttribute( FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER, doubleDisplayConverter, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6); configRegistry.registerConfigAttribute( FilterRowConfigAttributes.TEXT_MATCHING_MODE, TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6); // Configure a combo box on the pricing type column // Register a combo box editor to be displayed in the filter row cell // when a value is selected from the combo, the object is converted to a string // using the converter (registered below) configRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITOR, new ComboBoxCellEditor( Arrays.asList(new PricingTypeBean("MN"), new PricingTypeBean("AT"))), DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4); // The pricing bean object in column is converted to using this display converter // A 'text' match is then performed against the value from the combo box configRegistry.registerConfigAttribute( FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER, PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL, "PRICING_TYPE_PROP_NAME"); // Shade the row to be slightly darker than the blue background. final Style rowStyle = new Style(); rowStyle.setAttributeValue( CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.getColor(197, 212, 231)); configRegistry.registerConfigAttribute( CellConfigAttributes.CELL_STYLE, rowStyle, DisplayMode.NORMAL, GridRegion.FILTER_ROW); }