summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2010-08-19 05:46:01 (EDT)
committerSteffen Kriese2010-08-19 05:46:01 (EDT)
commitaccdd68411ba9bae54b359dde64461015c26a692 (patch)
tree7fbdff6f64a51c6cff946628413e0a3e17addc4c
parent51db977b44a8d5ad959afdfe49ad74317af48ce9 (diff)
downloadorg.eclipse.riena-accdd68411ba9bae54b359dde64461015c26a692.zip
org.eclipse.riena-accdd68411ba9bae54b359dde64461015c26a692.tar.gz
org.eclipse.riena-accdd68411ba9bae54b359dde64461015c26a692.tar.bz2
Applying Patch #323002 StatusMeterRidget
-rw-r--r--org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/StatusMeterRidget.java206
-rw-r--r--org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/uibinding/SwtControlRidgetMapper.java3
2 files changed, 209 insertions, 0 deletions
diff --git a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/StatusMeterRidget.java b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/StatusMeterRidget.java
new file mode 100644
index 0000000..f286aa8
--- /dev/null
+++ b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/internal/ui/ridgets/swt/StatusMeterRidget.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.ui.ridgets.swt;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
+
+import org.eclipse.riena.ui.ridgets.IStatusMeterRidget;
+import org.eclipse.riena.ui.ridgets.swt.AbstractSWTRidget;
+import org.eclipse.riena.ui.swt.StatusMeterWidget;
+
+/**
+ * Ridget for {@link StatusMeterWidget} widget.
+ */
+public class StatusMeterRidget extends AbstractTraverseRidget implements IStatusMeterRidget {
+
+ private static final String COLOR_WARNING = "Parameter color is not an instance of 'org.eclipse.swt.graphics.Color'";
+ private boolean initialized;
+ private boolean maxInitialized;
+ private boolean minInitialized;
+ private Color borderColor;
+ private Color backgroundColor;
+ private Color gradientStartColor;
+ private Color gradientEndColor;
+
+ @Override
+ public StatusMeterWidget getUIControl() {
+ return (StatusMeterWidget) super.getUIControl();
+ }
+
+ @Override
+ public void checkUIControl(final Object uiControl) {
+ AbstractSWTRidget.assertType(uiControl, StatusMeterWidget.class);
+ }
+
+ @Override
+ protected int getValue(final Control control) {
+ return getUIControl() != null ? getUIControl().getValue() : 0;
+ }
+
+ @Override
+ protected void initFromUIControl() {
+ final StatusMeterWidget meter = getUIControl();
+ if (meter != null && !initialized) {
+ if (!maxInitialized) {
+ setMaximum(meter.getMaximum());
+ }
+ if (!minInitialized) {
+ setMinimum(meter.getMinimum());
+ }
+ setValue(meter.getValue());
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void updateUIMaximum() {
+ final StatusMeterWidget control = getUIControl();
+ if (control != null) {
+ control.setMaximum(getMaximum());
+ }
+
+ }
+
+ @Override
+ protected void updateUIMinimum() {
+ final StatusMeterWidget control = getUIControl();
+ if (control != null) {
+ control.setMinimum(getMinimum());
+ }
+
+ }
+
+ @Override
+ protected void updateUIValue() {
+ final StatusMeterWidget control = getUIControl();
+ if (control != null) {
+ control.setValue(getValue());
+ }
+
+ }
+
+ @Override
+ public void setMaximum(final int maximum) {
+ super.setMaximum(maximum);
+ maxInitialized = true;
+ }
+
+ @Override
+ public void setMinimum(final int minimum) {
+ super.setMinimum(minimum);
+ minInitialized = true;
+ }
+
+ @Override
+ protected void updateUIControl() {
+ super.updateUIControl();
+ final StatusMeterWidget control = getUIControl();
+
+ // set the custom colors, when the uiControl is available
+ if (control == null) {
+ return;
+ }
+
+ if (borderColor != null) {
+ control.setBorderColor(borderColor);
+ }
+
+ if (backgroundColor != null) {
+ control.setBackgroundColor(backgroundColor);
+ }
+
+ if (gradientStartColor != null) {
+ control.setGradientStartColor(gradientStartColor);
+ }
+
+ if (gradientEndColor != null) {
+ control.setGradientEndColor(gradientEndColor);
+ }
+ }
+
+ public void setBorderColor(final Object color) {
+ Assert.isTrue(color instanceof Color, COLOR_WARNING);
+ borderColor = (Color) color;
+ }
+
+ public void setBackgroundColor(final Object color) {
+ Assert.isTrue(color instanceof Color, COLOR_WARNING);
+ backgroundColor = (Color) color;
+ }
+
+ public void setGradientStartColor(final Object color) {
+ Assert.isTrue(color instanceof Color, COLOR_WARNING);
+ gradientStartColor = (Color) color;
+ }
+
+ public void setGradientEndColor(final Object color) {
+ Assert.isTrue(color instanceof Color, COLOR_WARNING);
+ gradientEndColor = (Color) color;
+ }
+
+ @Override
+ protected void addSelectionListener(final Control control, final SelectionListener listener) {
+ // not needed here
+ }
+
+ @Override
+ protected void removeSelectionListener(final Control control, final SelectionListener listener) {
+ // not needed here
+ }
+
+ @Override
+ protected int getUIControlIncrement() {
+ // not needed here
+ return 0;
+ }
+
+ @Override
+ protected int getUIControlMaximum() {
+ // not needed here
+ return 0;
+ }
+
+ @Override
+ protected int getUIControlMinimum() {
+ // not needed here
+ return 0;
+ }
+
+ @Override
+ protected int getUIControlPageIncrement() {
+ // not needed here
+ return 0;
+ }
+
+ @Override
+ protected int getUIControlSelection() {
+ // not needed here
+ return 0;
+ }
+
+ @Override
+ protected void initAdditionalsFromUIControl() {
+ // not needed here
+ }
+
+ @Override
+ protected void updateUIIncrement() {
+ // not needed here
+ }
+
+ @Override
+ protected void updateUIPageIncrement() {
+ // not needed here
+ }
+}
diff --git a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/uibinding/SwtControlRidgetMapper.java b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/uibinding/SwtControlRidgetMapper.java
index 14f5665..d661cf2 100644
--- a/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/uibinding/SwtControlRidgetMapper.java
+++ b/org.eclipse.riena.ui.ridgets.swt/src/org/eclipse/riena/ui/ridgets/swt/uibinding/SwtControlRidgetMapper.java
@@ -59,6 +59,7 @@ import org.eclipse.riena.internal.ui.ridgets.swt.MessageBoxRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.ModuleTitleBarRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.MultipleChoiceRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget;
+import org.eclipse.riena.internal.ui.ridgets.swt.StatusMeterRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.ProgressBarRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.ScaleRidget;
import org.eclipse.riena.internal.ui.ridgets.swt.ShellRidget;
@@ -87,6 +88,7 @@ import org.eclipse.riena.ui.swt.InfoFlyout;
import org.eclipse.riena.ui.swt.MasterDetailsComposite;
import org.eclipse.riena.ui.swt.MessageBox;
import org.eclipse.riena.ui.swt.ModuleTitleBar;
+import org.eclipse.riena.ui.swt.StatusMeterWidget;
import org.eclipse.riena.ui.swt.Statusline;
import org.eclipse.riena.ui.swt.StatuslineNumber;
import org.eclipse.riena.ui.swt.utils.UIControlsFactory;
@@ -164,6 +166,7 @@ public final class SwtControlRidgetMapper implements IControlRidgetMapper<Object
addMapping(Slider.class, SliderRidget.class);
addMapping(ProgressBar.class, ProgressBarRidget.class);
addMapping(InfoFlyout.class, InfoFlyoutRidget.class);
+ addMapping(StatusMeterWidget.class, StatusMeterRidget.class);
}
public void addMapping(final Class<? extends Object> controlClazz, final Class<? extends IRidget> ridgetClazz) {