diff --git a/releng/org.eclipse.nebula.updatesite/category.xml b/releng/org.eclipse.nebula.updatesite/category.xml index d6a0bbe50..bf86a66d2 100644 --- a/releng/org.eclipse.nebula.updatesite/category.xml +++ b/releng/org.eclipse.nebula.updatesite/category.xml @@ -132,7 +132,7 @@ - + diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.feature/feature.xml b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.feature/feature.xml index 35cffea31..59c64e6d3 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.feature/feature.xml +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.feature/feature.xml @@ -2,7 +2,7 @@ @@ -23,7 +23,7 @@ install-size="0" version="0.0.0" unpack="false"/> - + org.eclipse.nebula nebulaslider - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT org.eclipse.nebula.widgets.nebulaslider.feature eclipse-feature - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT Nebula Slider Feature diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/pom.xml b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/pom.xml index 72add1072..3b29186d0 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/pom.xml +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/pom.xml @@ -16,7 +16,7 @@ http://www.eclipse.org/legal/epl-v10.html org.eclipse.nebula nebulaslider - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT org.eclipse.nebula.widgets.nebulaslider.snippets diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderConfiguration.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderConfiguration.java new file mode 100644 index 000000000..a4e91b755 --- /dev/null +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderConfiguration.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2024 Laurent CARON + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial + * implementation and API + *******************************************************************************/ +package org.eclipse.nebula.widgets.opal.nebulaslider.snippets; + +import org.eclipse.nebula.widgets.opal.nebulaslider.NebulaSlider; +import org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +public class NebulaCustomSliderConfiguration extends NebularSliderDefaultConfiguration { + + public NebulaCustomSliderConfiguration(final NebulaSlider parentSlider) { + super(parentSlider); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getBarInsideColor() + */ + @Override + public Color getBarInsideColor() { + return getAndDisposeColor(231, 225, 219); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getBarBorderColor() + */ + @Override + public Color getBarBorderColor() { + return getAndDisposeColor(219, 211, 203); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getBarSelectionColor() + */ + @Override + public Color getBarSelectionColor() { + return getAndDisposeColor(129, 108, 91); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getSelectorColor() + */ + @Override + public Color getSelectorColor() { + return getAndDisposeColor(148, 130, 113); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getSelectorColorBorder() + */ + @Override + public Color getSelectorColorBorder() { + return getAndDisposeColor(238, 234, 230); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getSelectorTextColor() + */ + @Override + public Color getSelectorTextColor() { + return getAndDisposeColor(255, 255, 204); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getArrowColor() + */ + @Override + public Color getArrowColor() { + return getAndDisposeColor(203, 192, 181); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getTextFont() + */ + @Override + public Font getTextFont() { + final FontData fontData = parentSlider.getFont().getFontData()[0]; + final Font newFont = new Font(parentSlider.getDisplay(), "Arial", Math.max(fontData.getHeight(), 14), SWT.ITALIC); + parentSlider.addDisposeListener(e -> { + if (!newFont.isDisposed()) { + newFont.dispose(); + } + }); + return newFont; + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getHorizontalMargin() + */ + @Override + public int getHorizontalMargin() { + // TODO Auto-generated method stub + return super.getHorizontalMargin(); + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getSelectorWidth() + */ + @Override + public int getSelectorWidth() { + return 100; + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getSelectorHeight() + */ + @Override + public int getSelectorHeight() { + return 40; + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getBarHeight() + */ + @Override + public int getBarHeight() { + return 18; + } + + /** + * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularSliderDefaultConfiguration#getArrowLineWidth() + */ + @Override + public int getArrowLineWidth() { + return 5; + } + +} diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderRenderer.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderRenderer.java deleted file mode 100644 index 4fdbd3e25..000000000 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaCustomSliderRenderer.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.eclipse.nebula.widgets.opal.nebulaslider.snippets; - -import org.eclipse.nebula.widgets.opal.nebulaslider.NebulaSlider; -import org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; - -public class NebulaCustomSliderRenderer extends NebularDefaultSliderRenderer { - - public NebulaCustomSliderRenderer(final NebulaSlider parentSlider) { - super(parentSlider); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getBarInsideColor() - */ - @Override - public Color getBarInsideColor() { - return getAndDisposeColor(231, 225, 219); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getBarBorderColor() - */ - @Override - public Color getBarBorderColor() { - return getAndDisposeColor(219, 211, 203); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getBarSelectionColor() - */ - @Override - public Color getBarSelectionColor() { - return getAndDisposeColor(129, 108, 91); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getSelectorColor() - */ - @Override - public Color getSelectorColor() { - return getAndDisposeColor(148, 130, 113); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getSelectorColorBorder() - */ - @Override - public Color getSelectorColorBorder() { - return getAndDisposeColor(238, 234, 230); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getSelectorTextColor() - */ - @Override - public Color getSelectorTextColor() { - return getAndDisposeColor(255, 255, 204); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getArrowColor() - */ - @Override - public Color getArrowColor() { - return getAndDisposeColor(203, 192, 181); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getTextFont() - */ - @Override - public Font getTextFont() { - final FontData fontData = parentSlider.getFont().getFontData()[0]; - final Font newFont = new Font(parentSlider.getDisplay(), "Arial", Math.max(fontData.getHeight(), 14), SWT.ITALIC); - parentSlider.addDisposeListener(e -> { - if (!newFont.isDisposed()) { - newFont.dispose(); - } - }); - return newFont; - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getHorizontalMargin() - */ - @Override - public int getHorizontalMargin() { - // TODO Auto-generated method stub - return super.getHorizontalMargin(); - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getSelectorWidth() - */ - @Override - public int getSelectorWidth() { - return 100; - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getSelectorHeight() - */ - @Override - public int getSelectorHeight() { - return 40; - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getBarHeight() - */ - @Override - public int getBarHeight() { - return 18; - } - - /** - * @see org.eclipse.nebula.widgets.opal.nebulaslider.NebularDefaultSliderRenderer#getArrowLineWidth() - */ - @Override - public int getArrowLineWidth() { - return 5; - } - -} diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java index c116558bc..f6f1ea59d 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Laurent CARON. + * Copyright (c) 2018-2024 Laurent CARON. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippetOtherRenderer.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippetOtherRenderer.java index 3e3d32336..859a1a36a 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippetOtherRenderer.java +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider.snippets/src/org/eclipse/nebula/widgets/opal/nebulaslider/snippets/NebulaSliderSnippetOtherRenderer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Laurent CARON. + * Copyright (c) 2024 Laurent CARON. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -49,7 +49,7 @@ public static void main(final String[] args) { slider.setMinimum(0); slider.setMaximum(1000); slider.setValue(632); - slider.setRenderer(new NebulaCustomSliderRenderer(slider)); + slider.setRenderer(new NebulaCustomSliderConfiguration(slider)); slider.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); slider.addListener(SWT.Selection, e -> { diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/pom.xml b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/pom.xml index dc0d95bf5..7a13fb6d6 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/pom.xml +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/pom.xml @@ -16,7 +16,7 @@ http://www.eclipse.org/legal/epl-v10.html org.eclipse.nebula nebulaslider - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT org.eclipse.nebula.widgets.nebulaslider diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java index d2bbe4415..acd2c922e 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSlider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Laurent CARON + * Copyright (c) 2018-2024 Laurent CARON * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -37,7 +37,7 @@ */ public class NebulaSlider extends Canvas { - private NebulaSliderRenderer renderer; + private NebulaSliderGraphicConfiguration renderer; private int minimum; private int maximum; @@ -80,7 +80,7 @@ public class NebulaSlider extends Canvas { public NebulaSlider(final Composite parent, final int style) { super(parent, checkStyle(style) | SWT.DOUBLE_BUFFERED); - renderer = new NebularDefaultSliderRenderer(this); + renderer = new NebularSliderDefaultConfiguration(this); minimum = Integer.MIN_VALUE; maximum = Integer.MAX_VALUE; @@ -428,7 +428,7 @@ public void setValue(final int value) { *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • * */ - public NebulaSliderRenderer getRenderer() { + public NebulaSliderGraphicConfiguration getRenderer() { checkWidget(); return renderer; } @@ -444,7 +444,7 @@ public NebulaSliderRenderer getRenderer() { *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • * */ - public void setRenderer(final NebulaSliderRenderer renderer) { + public void setRenderer(final NebulaSliderGraphicConfiguration renderer) { checkWidget(); this.renderer = renderer; redraw(); diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderGraphicConfiguration.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderGraphicConfiguration.java new file mode 100644 index 000000000..7ae5c31f5 --- /dev/null +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderGraphicConfiguration.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2024 Laurent CARON + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial + * implementation and API + *******************************************************************************/ +package org.eclipse.nebula.widgets.opal.nebulaslider; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; + +/** + * Interface that describe the graphical configuration of the NebulaSlider widget + */ +public interface NebulaSliderGraphicConfiguration { + + Color getBarInsideColor(); + + Color getBarBorderColor(); + + Color getBarSelectionColor(); + + Color getSelectorColor(); + + Color getSelectorColorBorder(); + + Color getSelectorTextColor(); + + Color getArrowColor(); + + int getArrowLineWidth(); + + Font getTextFont(); + + int getHorizontalMargin(); + + int getSelectorWidth(); + + int getSelectorHeight(); + + int getBarHeight(); +} diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderRenderer.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderRenderer.java deleted file mode 100644 index 8687d1c0e..000000000 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebulaSliderRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.eclipse.nebula.widgets.opal.nebulaslider; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; - -public interface NebulaSliderRenderer { - - Color getBarInsideColor(); - - Color getBarBorderColor(); - - Color getBarSelectionColor(); - - Color getSelectorColor(); - - Color getSelectorColorBorder(); - - Color getSelectorTextColor(); - - Color getArrowColor(); - - int getArrowLineWidth(); - - Font getTextFont(); - - int getHorizontalMargin(); - - int getSelectorWidth(); - - int getSelectorHeight(); - - int getBarHeight(); -} diff --git a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularDefaultSliderRenderer.java b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularSliderDefaultConfiguration.java similarity index 69% rename from widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularDefaultSliderRenderer.java rename to widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularSliderDefaultConfiguration.java index 6c09f6eb4..c092212e3 100644 --- a/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularDefaultSliderRenderer.java +++ b/widgets/nebulaslider/org.eclipse.nebula.widgets.nebulaslider/src/org/eclipse/nebula/widgets/opal/nebulaslider/NebularSliderDefaultConfiguration.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2024 Laurent CARON + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: Laurent CARON (laurent.caron at gmail dot com) - Initial + * implementation and API + *******************************************************************************/ package org.eclipse.nebula.widgets.opal.nebulaslider; import org.eclipse.swt.SWT; @@ -5,14 +17,17 @@ import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; -public class NebularDefaultSliderRenderer implements NebulaSliderRenderer { +/** + * Default graphic configuration for the NebularSlider widget + */ +public class NebularSliderDefaultConfiguration implements NebulaSliderGraphicConfiguration { private static final int H_MARGIN = 5; private static final int SELECTOR_WIDTH = 78; private static final int BAR_HEIGHT = 12; private static final int SELECTOR_HEIGHT = 32; protected final NebulaSlider parentSlider; - public NebularDefaultSliderRenderer(final NebulaSlider parentSlider) { + public NebularSliderDefaultConfiguration(final NebulaSlider parentSlider) { this.parentSlider = parentSlider; } diff --git a/widgets/nebulaslider/pom.xml b/widgets/nebulaslider/pom.xml index 313bb1bb3..0814ce38d 100644 --- a/widgets/nebulaslider/pom.xml +++ b/widgets/nebulaslider/pom.xml @@ -4,7 +4,7 @@ org.eclipse.nebula nebulaslider pom - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT