Java Code Examples for org.eclipse.swt.graphics.Color#equals()
The following examples show how to use
org.eclipse.swt.graphics.Color#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MonthCalendarableItemControl.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void setBackground (Color color) { super.setBackground (color); // Are these settings the same as before? if (backgroundImage == null && gradientColors == null && gradientPercents == null) { if (color == null) { if (background == null) return; } else { if (color.equals(background)) return; } } background = color; backgroundImage = null; gradientColors = null; gradientPercents = null; redraw (); }
Example 2
Source File: AccordionLabel.java From birt with Eclipse Public License 1.0 | 6 votes |
public void setBackground( Color color ) { super.setBackground( color ); // Are these settings the same as before? if ( backgroundImage == null && gradientColors == null && gradientPercents == null ) { if ( color == null ) { if ( background == null ) return; } else { if ( color.equals( background ) ) return; } } background = color; backgroundImage = null; gradientColors = null; gradientPercents = null; redraw( ); }
Example 3
Source File: CustomSnapFeedbackPolicy.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @see org.eclipse.draw2d.IFigure#getLocalBackgroundColor() */ public Color getLocalBackgroundColor() { /* get the correct color */ Color temp = FigureUtilities.mixColors(super.getLocalBackgroundColor(), getParent().getBackgroundColor(), (double) opacity / FRAMES); if (temp.equals(localBgColor)) { /* * if it's the same than previous, just dispose the just new * created */ temp.dispose(); } else { /* else dispose the old color... */ if (localBgColor != null && !localBgColor.isDisposed()) { localBgColor.dispose(); } /* and replace it by the new one */ localBgColor = temp; } return localBgColor; }
Example 4
Source File: ComponentStatusLabel.java From arx with Apache License 2.0 | 6 votes |
@Override public void setBackground(Color color) { super.setBackground(color); // Are these settings the same as before? if (backgroundImage == null && gradientColors == null && gradientPercents == null) { if (color == null) { if (background == null) return; } else { if (color.equals(background)) return; } } background = color; backgroundImage = null; gradientColors = null; gradientPercents = null; redraw(); }
Example 5
Source File: TLCErrorViewTest.java From tlaplus with MIT License | 5 votes |
private boolean noneOf(Color c) { if (c.equals(TLCUIActivator.getDefault().getDeletedColor())) { return false; } if (c.equals(TLCUIActivator.getDefault().getChangedColor())) { return false; } if (c.equals(TLCUIActivator.getDefault().getAddedColor())) { return false; } return true; }
Example 6
Source File: ImageLabel.java From birt with Eclipse Public License 1.0 | 5 votes |
public void setBackground( Color color ) { super.setBackground( color ); // Are these settings the same as before? if ( color != null ) { Color background = getBackground( ); if ( color.equals( background ) ) { return; } } backgroundColor = color; redraw( ); }
Example 7
Source File: ScriptConsolePartitioner.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private boolean equalsColor(Color foreground, Color foreground2) { if (foreground == foreground2) { return true; } if (foreground == null || foreground2 == null) { return false; } return foreground.equals(foreground2); }
Example 8
Source File: MyTrackerView.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
@Override public void tableRefresh() { if (getComposite() == null || getComposite().isDisposed()){ return; } UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions(); if (uiFunctions != null) { uiFunctions.refreshIconBar(); } // Store values for columns that are calculate from peer information, so // that we only have to do one loop. (As opposed to each cell doing a loop) // Calculate code copied from TrackerTableItem TableRowCore[] rows = tv.getRows(); for (int x = 0; x < rows.length; x++) { TableRowSWT row = (TableRowSWT)rows[x]; if (row == null){ continue; } TRHostTorrent host_torrent = (TRHostTorrent)rows[x].getDataSource(true); if (host_torrent == null){ continue; } long uploaded = host_torrent.getTotalUploaded(); long downloaded = host_torrent.getTotalDownloaded(); long left = host_torrent.getTotalLeft(); int seed_count = host_torrent.getSeedCount(); host_torrent.setData("GUI_PeerCount", new Long(host_torrent.getLeecherCount())); host_torrent.setData("GUI_SeedCount", new Long(seed_count)); host_torrent.setData("GUI_BadNATCount", new Long(host_torrent.getBadNATCount())); host_torrent.setData("GUI_Uploaded", new Long(uploaded)); host_torrent.setData("GUI_Downloaded", new Long(downloaded)); host_torrent.setData("GUI_Left", new Long(left)); if ( seed_count != 0 ){ Color fg = row.getForeground(); if (fg != null && fg.equals(Colors.blues[Colors.BLUES_MIDDARK])) { row.setForeground(Colors.blues[Colors.BLUES_MIDDARK]); } } } }
Example 9
Source File: TmfEventsTable.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public void handleEvent(Event event) { TableItem item = (TableItem) event.item; List<?> styleRanges = (List<?>) item.getData(Key.STYLE_RANGES); GC gc = event.gc; Color background = item.getBackground(event.index); /* * Paint the background if it is not the default system color. In * Windows, if you let the widget draw the background, it will not * show the item's background color if the item is selected or hot. * If there are no style ranges and the item background is the * default system color, we do not want to paint it or otherwise we * would override the platform theme (e.g. alternating colors). */ if (styleRanges != null || !background.equals(item.getParent().getBackground())) { // we will paint the table item's background event.detail &= ~SWT.BACKGROUND; // paint the item's default background gc.setBackground(background); gc.fillRectangle(event.x, event.y, event.width, event.height); } /* * We will paint the table item's foreground. In Windows, if you * paint the background but let the widget draw the foreground, it * will override your background, unless the item is selected or * hot. */ event.detail &= ~SWT.FOREGROUND; // paint the highlighted background for all style ranges if (styleRanges != null) { Rectangle textBounds = item.getTextBounds(event.index); String text = item.getText(event.index); for (Object o : styleRanges) { if (o instanceof StyleRange) { StyleRange styleRange = (StyleRange) o; if (styleRange.data.equals(event.index)) { int startIndex = styleRange.start; int endIndex = startIndex + styleRange.length; int startX = gc.textExtent(text.substring(0, startIndex)).x; int endX = gc.textExtent(text.substring(0, endIndex)).x; gc.setBackground(styleRange.background); gc.fillRectangle(textBounds.x + startX, textBounds.y, (endX - startX), textBounds.height); } } } } }