Bug 559838
Change-Id: I436756a2f0f80ed60d74283a6787405e49528773
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
index 16fb8ef..789ef56 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages.properties
@@ -31,6 +31,9 @@
BackgroundImage = (If background image is turned off, the contrast ratio might not be enough.)
FixedSizeFontWarning = Font size might be fixed. \uff08unsupported font-size definitions, etc. This message is also shown in the case where font-size is unspecified.\uff09
FixedSmallFontWarning = This text is too small and its font size might be fixed. \uff08unsupported font-size definitions, etc.\uff09
+FontAlphaWarning = Font color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
+BackgroundAlphaWarning = Background color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
+BothAlphaWarning = Font color and background color are defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
#
# lowvision.ScoreUtil
#
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
index 73445ef..6adbb76 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/messages_ja.properties
@@ -31,6 +31,9 @@
BackgroundImage = (\u3082\u3057\u80cc\u666f\u753b\u50cf\u304c\u975e\u8868\u793a\u306b\u3055\u308c\u305f\u5834\u5408\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u6bd4\u306b\u554f\u984c\u304c\u3042\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002)
FixedSizeFontWarning = \u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059 \uff08\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u6307\u5b9a\u3084\u3001\u672a\u6307\u5b9a\u306e\u5834\u5408\u3082\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09
FixedSmallFontWarning = \u3053\u306e\u6587\u5b57\u306f\u5c0f\u3055\u3059\u304e\u307e\u3059\u3002\u3055\u3089\u306b\u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059 \uff08\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u6307\u5b9a\u306e\u5834\u5408\u3082\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09
+FontAlphaWarning = \u6587\u5b57\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+BackgroundAlphaWarning = \u80cc\u666f\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+BothAlphaWarning = \u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
#
# lowvision.ScoreUtil
#
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
index a270658..70f2023 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/LowVisionProblemConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and Others
+ * Copyright (c) 2005, 2020 IBM Corporation 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
@@ -17,14 +17,15 @@
import org.eclipse.actf.visualization.eval.problem.ILowvisionProblemSubtype;
import org.eclipse.actf.visualization.eval.problem.IProblemItem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ColorProblem;
+import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ColorWarning;
+import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.LowVisionProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.LowVisionProblemGroup;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ProblemItemLV;
public class LowVisionProblemConverter {
- public static List<IProblemItem> convert(LowVisionProblemGroup[] target,
- String urlS, int frameId) {
+ public static List<IProblemItem> convert(LowVisionProblemGroup[] target, String urlS, int frameId) {
ArrayList<IProblemItem> result = new ArrayList<IProblemItem>();
@@ -32,15 +33,19 @@
int type = target[i].getLowVisionProblemType();
ProblemItemLV tmp;
ColorProblem cp;
- if (type == LowVisionProblem.LOWVISION_COLOR_PROBLEM) {
+ switch (type) {
+ case ILowVisionProblem.LOWVISION_COLOR_PROBLEM:
cp = (ColorProblem) target[i].getRepresentative();
- tmp = new ProblemItemLV(
- "L_" + target[i].getLowVisionProblemType() + "." + cp.getLevel()); //$NON-NLS-1$
+ tmp = new ProblemItemLV("L_" + target[i].getLowVisionProblemType() + "." + cp.getLevel()); //$NON-NLS-1$
tmp.setTargetNode(cp.getElement());
tmp.setTargetString(cp.getAdditionalDescription());
- } else {
- tmp = new ProblemItemLV(
- "L_" + target[i].getLowVisionProblemType()); //$NON-NLS-1$
+ break;
+ case ILowVisionProblem.LOWVISION_COLOR_WITH_ALPHA_WARNING:
+ ColorWarning cw = (ColorWarning) target[i].getRepresentative();
+ tmp = new ProblemItemLV("L_" + target[i].getLowVisionProblemType() + "." + cw.getWarningType()); //$NON-NLS-1$
+ break;
+ default:
+ tmp = new ProblemItemLV("L_" + target[i].getLowVisionProblemType()); //$NON-NLS-1$
}
tmp.setSubType(type);
try {
@@ -55,8 +60,7 @@
default:
tmp.setDescription(target[i].getDescription());
if (target[i].getRepresentative() != null)
- tmp.setTargetNode(target[i].getRepresentative()
- .getElement());
+ tmp.setTargetNode(target[i].getRepresentative().getElement());
}
} catch (Exception e) {
tmp.setDescription("unknown"); //$NON-NLS-1$
@@ -82,8 +86,7 @@
return (result);
}
- private static String getLVProblemColorString(
- LowVisionProblemGroup problem, boolean isFore) {
+ private static String getLVProblemColorString(LowVisionProblemGroup problem, boolean isFore) {
int probType;
int origAll;
int origR;
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
index d481095..b0ad518 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/Messages.java
@@ -45,6 +45,9 @@
public static String BackgroundImage;
public static String FixedSizeFontWarning;
public static String FixedSmallFontWarning;
+ public static String FontAlphaWarning;
+ public static String BackgroundAlphaWarning;
+ public static String BothAlphaWarning;
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
index bc13a1f..3268587 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/PageElement.java
@@ -18,6 +18,7 @@
import java.util.Vector;
import org.eclipse.actf.model.ui.editor.browser.ICurrentStyles;
+import org.eclipse.actf.util.logging.DebugPrintUtil;
import org.eclipse.actf.visualization.engines.lowvision.LowVisionException;
import org.eclipse.actf.visualization.engines.lowvision.LowVisionType;
import org.eclipse.actf.visualization.engines.lowvision.image.ImageException;
@@ -27,6 +28,7 @@
import org.eclipse.actf.visualization.internal.engines.lowvision.color.ColorException;
import org.eclipse.actf.visualization.internal.engines.lowvision.color.ColorIRGB;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ColorProblem;
+import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ColorWarning;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.FixedSizeFontProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem;
import org.eclipse.actf.visualization.internal.engines.lowvision.problem.LowVisionProblem;
@@ -90,17 +92,17 @@
// position in the image
private int x = UNSET_POSITION;
-
private int y = UNSET_POSITION;
-
private int width = UNSET_POSITION;
-
private int height = UNSET_POSITION;
private int foregroundColor = UNSET_COLOR;
-
private int backgroundColor = UNSET_COLOR;
+ private boolean bForegroundAlpha = false;
+ private boolean bBackgroundAlpha = false;
+ private boolean bOpacity = false;
+
public PageElement(String _key, ICurrentStyles _cs) throws ImageException {
id = _key;
style = _cs;
@@ -126,14 +128,36 @@
String fgStr = style.getComputedColor();
String bgStr = style.getComputedBackgroundColor();
+ String opacityStr = style.getOpacity();
+
+ try {
+ double opacity = Double.parseDouble(opacityStr);
+ if (opacity < 1) {
+ bOpacity = true;
+ }
+ } catch (NumberFormatException e1) {
+ DebugPrintUtil.devOrDebugPrintStackTrace(e1);
+ }
+
+ //System.out.println(style.getXPath() + ":\t" + fgStr + " / " + bgStr + " / " + opacityStr);
try {
foregroundColor = (new ColorCSS(fgStr)).toInt();
- backgroundColor = (new ColorCSS(bgStr)).toInt();
-
} catch (ColorException e) {
- e.printStackTrace();
- throw new ImageException("Could not interpret colors."); //$NON-NLS-1$
+ if (ColorException.ALPHA_EXISTS.equals(e.getMessage())) {
+ bForegroundAlpha = true;
+ } else {
+ throw new ImageException("Could not interpret colors."); //$NON-NLS-1$
+ }
+ }
+ try {
+ backgroundColor = (new ColorCSS(bgStr)).toInt();
+ } catch (ColorException e) {
+ if (ColorException.ALPHA_EXISTS.equals(e.getMessage())) {
+ bBackgroundAlpha = true;
+ } else {
+ throw new ImageException("Could not interpret colors."); //$NON-NLS-1$
+ }
}
}
@@ -174,15 +198,13 @@
return (new LowVisionProblem[0]);
}
- List<ColorProblem> cp = new ArrayList<ColorProblem>();
try {
- cp = checkColors(_lvType);
+ problemVec.addAll(checkColors(_lvType));
} catch (LowVisionException e) {
DebugUtil.errMsg(this, "Error occurred in checking colors: id = " //$NON-NLS-1$
+ this.id);
e.printStackTrace();
}
- problemVec.addAll(cp);
FixedSizeFontProblem fsfp = null;
try {
@@ -246,14 +268,14 @@
ProhibitedForegroundColorProblem pfcp = null;
ProhibitedBackgroundColorProblem pbcp = null;
- if (allowedFgColors != null && allowedFgColors.length > 0) {
+ if (allowedFgColors != null && allowedFgColors.length > 0 && !bForegroundAlpha) {
try {
pfcp = checkAllowedForegroundColors(_lvType, allowedFgColors);
} catch (LowVisionException lve) {
lve.printStackTrace();
}
}
- if (allowedBgColors != null && allowedBgColors.length > 0) {
+ if (allowedBgColors != null && allowedBgColors.length > 0 && !bBackgroundAlpha) {
try {
pbcp = checkAllowedBackgroundColors(_lvType, allowedBgColors);
} catch (LowVisionException lve) {
@@ -283,9 +305,9 @@
return (problemArray);
}
- private List<ColorProblem> checkColors(LowVisionType _lvType) throws LowVisionException {
+ private List<ILowVisionProblem> checkColors(LowVisionType _lvType) throws LowVisionException {
- List<ColorProblem> result = new ArrayList<ColorProblem>();
+ List<ILowVisionProblem> result = new ArrayList<ILowVisionProblem>();
if (!isTextTag()) {
return (result);
@@ -307,6 +329,27 @@
boolean hasBgImage = (style.getComputedBackgroundImage() != null
&& !style.getComputedBackgroundImage().equalsIgnoreCase("none"));
+ ColorWarning cw;
+ if (bOpacity) {
+ cw = new ColorWarning(ColorWarning.OPACITY, this, _lvType);
+ result.add(cw);
+ return (result);
+ } else if (bForegroundAlpha) {
+ if (bBackgroundAlpha) {
+ cw = new ColorWarning(ColorWarning.BOTH, this, _lvType);
+ } else {
+ cw = new ColorWarning(ColorWarning.FONT, this, _lvType);
+ }
+ cw.setElement(style.getElement());
+ result.add(cw);
+ return (result);
+ } else if (bBackgroundAlpha) {
+ cw = new ColorWarning(ColorWarning.BACKGROUND, this, _lvType);
+ cw.setElement(style.getElement());
+ result.add(cw);
+ return (result);
+ }
+
ColorIRGB fgOrg = new ColorIRGB(foregroundColor);
ColorIRGB bgOrg = new ColorIRGB(backgroundColor);
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorCSS.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorCSS.java
index bd9caef..25fd23d 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorCSS.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorCSS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2020 IBM Corporation 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
@@ -7,12 +7,15 @@
*
* Contributors:
* Junji MAEDA - initial API and implementation
+ * IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.actf.visualization.internal.engines.lowvision.color;
import java.util.StringTokenizer;
+import org.eclipse.actf.util.logging.DebugPrintUtil;
+
/*
* colors in CSS
* RGB(256)
@@ -23,49 +26,154 @@
* rgb(R,G,B)
* rgb(R%,G%,B%)
* pre-defined colors(16) (see ColorUtil.java)
+ *
+ * //2020-01
+ * hsl(h,s%,l%) *
+ * rgba/hsla -> try to calculate if a=1. if a!=1 then throws exception
*/
@SuppressWarnings("nls")
-public class ColorCSS extends ColorIRGB{
+public class ColorCSS extends ColorIRGB {
private static final String DELIM = "/";
// default values
static final int TRANSPARENT_R = 0xff; // "transparent"
static final int TRANSPARENT_G = 0xff; // "transparent"
static final int TRANSPARENT_B = 0xff; // "transparent"
- public static final int TRANSPARENT = ((TRANSPARENT_R&0xff)<<16) | ((TRANSPARENT_G&0xff)<<8) | (TRANSPARENT_B&0xff);
+ public static final int TRANSPARENT = ((TRANSPARENT_R & 0xff) << 16) | ((TRANSPARENT_G & 0xff) << 8)
+ | (TRANSPARENT_B & 0xff);
public static final int DEFAULT_BACKGROUND_COLOR_INT = TRANSPARENT;
public static final int DEFAULT_COLOR_INT = 0;
- String originalString = "";
+ private static ColorIRGB parseHSL(String hsl) {
+ // assume (h, s%, l%) format
+ String target = hsl.replaceAll("[^0-9\\.,]", "");
+ // System.out.println(hsl + ":\t" + target);
+ StringTokenizer st = new StringTokenizer(target, ",", false);
+ double h, s, l, max, min;
+ double r, g, b;
+ int ri, gi, bi;
+ if (st.countTokens() == 3) {
+ try {
+ h = Float.parseFloat(st.nextToken());
+ s = Float.parseFloat(st.nextToken());
+ l = Float.parseFloat(st.nextToken());
- public ColorCSS( String _s ) throws ColorException{
- this( _s, true );
+ // assume valid data
+ // TODO validation if needed
+
+ if (l >= 50) {
+ max = 2.55 * (l + (100 - l) * (s / 100));
+ min = 2.55 * (l - (100 - l) * (s / 100));
+ } else {
+ max = 2.55 * (l + l * (s / 100));
+ min = 2.55 * (l - l * (s / 100));
+ }
+
+ if (0 <= h && h < 60) {
+ r = max;
+ g = (h / 60) * (max - min) + min;
+ b = min;
+ } else if (60 <= h && h < 120) {
+ r = ((120 - h) / 60) * (max - min) + min;
+ g = max;
+ b = min;
+ } else if (120 <= h && h < 180) {
+ r = min;
+ g = max;
+ b = ((h - 120) / 60) * (max - min) + min;
+ } else if (180 <= h && h < 240) {
+ r = min;
+ g = ((240 - h) / 60) * (max - min) + min;
+ b = max;
+ } else if (240 <= h && h < 300) {
+ r = ((h - 240) / 60) * (max - min) + min;
+ g = min;
+ b = max;
+ } else if (300 <= h && h < 360) {
+ r = max;
+ g = min;
+ b = ((360 - h) / 60) * (max - min) + min;
+ } else {
+ // error
+ return null;
+ }
+
+ ri = (int) Math.round(r);
+ gi = (int) Math.round(g);
+ bi = (int) Math.round(b);
+
+ ColorIRGB ci = new ColorIRGB(ri, gi, bi);
+ return ci;
+ // System.out.println(target + ":\t" + ri + ", " + gi + ", " +
+ // bi);
+
+ } catch (Exception e) {
+ DebugPrintUtil.debugPrintStackTrace(e);
+ }
+ }
+ return null;
}
- public ColorCSS( String _s, boolean _check ) throws ColorException{
- if( !(_s.endsWith(DELIM)) ){
+ private String originalString = "";
+ private boolean hasAlpha = false;
+
+ public ColorCSS(String _s) throws ColorException {
+ this(_s, true);
+ }
+
+ public ColorCSS(String _s, boolean _check) throws ColorException {
+
+ _s = _s.replaceAll("\\p{Space}", "").toLowerCase();
+
+ if (!(_s.endsWith(DELIM))) {
originalString = _s;
- }else{
- originalString = _s.substring( 0, _s.length()-1 );
+ } else {
+ originalString = _s.substring(0, _s.length() - 1);
+ }
+
+ if (originalString.startsWith("rgba") || originalString.startsWith("hsla")) {
+ hasAlpha = true;
+
+ // if alpha = 1 then try to convert value into RGB
+ if (originalString.endsWith(",1)")) {
+ originalString = originalString.substring(0, 3)
+ + originalString.substring(4, originalString.length() - 3) + ")";
+ } else {
+ throw new ColorException(ColorException.ALPHA_EXISTS);
+ }
}
// foreground color
- if( originalString.indexOf(DELIM) == -1 ){
- ColorIRGB ci = new ColorIRGB( originalString );
- R = ci.getR();
- G = ci.getG();
- B = ci.getB();
- }
- else{ // background-color -> need to consider ancestor
+ if (originalString.indexOf(DELIM) == -1) {
+ if (originalString.startsWith("hsl")) {
+ ColorIRGB ci = parseHSL(originalString);
+ if (ci != null) {
+ R = ci.getR();
+ G = ci.getG();
+ B = ci.getB();
+ }
+ } else {
+ try {
+ ColorIRGB ci = new ColorIRGB(originalString);
+ R = ci.getR();
+ G = ci.getG();
+ B = ci.getB();
+ } catch (ColorException e) {
+ if (hasAlpha) {
+ throw new ColorException(ColorException.ALPHA_EXISTS);
+ }
+ }
+ }
+ } else { // background-color -> need to consider ancestor
- StringTokenizer st = new StringTokenizer( originalString.toLowerCase(), DELIM );
+ StringTokenizer st = new StringTokenizer(originalString.toLowerCase(), DELIM);
boolean success = false;
- while( st.hasMoreTokens() ){
+ while (st.hasMoreTokens()) {
String tmpStr = st.nextToken();
-
- if( !(tmpStr.equals( "transparent" )) ){
+
+ if (!(tmpStr.equals("transparent"))) {
// ColorIRGB ci = interpret( tmpStr );
- ColorIRGB ci = new ColorIRGB( tmpStr );
+ ColorIRGB ci = new ColorIRGB(tmpStr);
R = ci.getR();
G = ci.getG();
B = ci.getB();
@@ -73,51 +181,64 @@
break;
}
}
- if( !success ){
+ if (!success) {
R = TRANSPARENT_R;
G = TRANSPARENT_G;
B = TRANSPARENT_B;
}
}
- if( _check ){ rangeCheck(); }
- else{ rangeAdjust(); }
+ if (_check) {
+ rangeCheck();
+ } else {
+ rangeAdjust();
+ }
}
- public ColorCSS() throws ColorException{
- throw new ColorException( "Constructor in wrong format." );
- }
- public ColorCSS( int _i ) throws ColorException{
- throw new ColorException( "Constructor in wrong format." );
- }
- public ColorCSS( int _i1, int _i2, int _i3 ) throws ColorException{
- throw new ColorException( "Constructor in wrong format." );
- }
- public ColorCSS( int _i1, int _i2, int _i3, boolean _b ) throws ColorException{
- throw new ColorException( "Constructor in wrong format." );
+ public ColorCSS() throws ColorException {
+ throw new ColorException("Constructor in wrong format.");
}
- private void rangeCheck() throws ColorException{
- if( R<0 || R>255){
- throw new ColorException( "R is out of range: " + R + ", inputString = " + originalString );
+ public ColorCSS(int _i) throws ColorException {
+ throw new ColorException("Constructor in wrong format.");
+ }
+
+ public ColorCSS(int _i1, int _i2, int _i3) throws ColorException {
+ throw new ColorException("Constructor in wrong format.");
+ }
+
+ public ColorCSS(int _i1, int _i2, int _i3, boolean _b) throws ColorException {
+ throw new ColorException("Constructor in wrong format.");
+ }
+
+ private void rangeCheck() throws ColorException {
+ if (R < 0 || R > 255) {
+ throw new ColorException("R is out of range: " + R + ", inputString = " + originalString);
}
- if( G<0 || G>255){
- throw new ColorException( "G is out of range: " + G + ", inputString = " + originalString );
+ if (G < 0 || G > 255) {
+ throw new ColorException("G is out of range: " + G + ", inputString = " + originalString);
}
- if( B<0 || B>255){
- throw new ColorException( "B is out of range: " + B + ", inputString = " + originalString );
+ if (B < 0 || B > 255) {
+ throw new ColorException("B is out of range: " + B + ", inputString = " + originalString);
}
}
- private void rangeAdjust(){
- if( R<0 ) R = 0;
- else if( R>255 ) R = 255;
- if( G<0 ) G = 0;
- else if( G>255 ) G = 255;
- if( B<0 ) B = 0;
- else if( B>255 ) B = 255;
+
+ private void rangeAdjust() {
+ if (R < 0)
+ R = 0;
+ else if (R > 255)
+ R = 255;
+ if (G < 0)
+ G = 0;
+ else if (G > 255)
+ G = 255;
+ if (B < 0)
+ B = 0;
+ else if (B > 255)
+ B = 255;
}
-
- public String getOriginalString(){
- return( originalString );
+
+ public String getOriginalString() {
+ return (originalString);
}
}
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorException.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorException.java
index 904a4f7..d033215 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorException.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorException.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2020 IBM Corporation 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
@@ -7,10 +7,14 @@
*
* Contributors:
* Junji MAEDA - initial API and implementation
+ * IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.actf.visualization.internal.engines.lowvision.color;
public class ColorException extends Exception{
+
+ public static final String ALPHA_EXISTS = "Alpha value exists.";
+
/**
*
*/
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorIRGB.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorIRGB.java
index 287a434..531b953 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorIRGB.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorIRGB.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2020 IBM Corporation 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Junji MAEDA - initial API and implementation
+ * IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.actf.visualization.internal.engines.lowvision.color;
@@ -40,8 +41,7 @@
setB(_b);
}
- public ColorIRGB(int _r, int _g, int _b, boolean _check)
- throws ColorException {
+ public ColorIRGB(int _r, int _g, int _b, boolean _check) throws ColorException {
setR(_r, _check);
setG(_g, _check);
setB(_b, _check);
@@ -57,9 +57,7 @@
Pattern patRemoveSpace = Pattern.compile("^\\s*(\\S.+\\S)\\s*$");
Matcher matRemoveSpace = patRemoveSpace.matcher(_str.toLowerCase());
if (!(matRemoveSpace.find())) {
- throw new ColorException(
- "There no color spacifications. Input string is \"" + _str
- + "\"");
+ throw new ColorException("There no color spacifications. Input string is \"" + _str + "\"");
}
String spec = matRemoveSpace.group(1);
@@ -80,8 +78,7 @@
B = Integer.parseInt(bStr, 16);
} catch (NumberFormatException e) {
e.printStackTrace();
- throw new ColorException("Bad color specification(1): #"
- + spec);
+ throw new ColorException("Bad color specification(1): #" + spec);
}
} else if (spec.length() == 3) {
String rStr = spec.substring(0, 1);
@@ -93,8 +90,7 @@
B = Integer.parseInt(bStr + bStr, 16);
} catch (NumberFormatException e) {
e.printStackTrace();
- throw new ColorException("Bad color specification(2): #"
- + spec);
+ throw new ColorException("Bad color specification(2): #" + spec);
}
} else {
throw new ColorException("Bad color specification(3): #" + spec);
@@ -107,8 +103,7 @@
.compile("^\\s*([\\+\\-]?\\d+)\\s*\\,\\s*([\\+\\-]?\\d+)\\s*\\,\\s*([\\+\\-]?\\d+)\\s*$");
Matcher matRGB = patRGB.matcher(spec);
if (!(matRGB.find())) {
- throw new ColorException("Bad color specification(4): rgb("
- + spec + ")");
+ throw new ColorException("Bad color specification(4): rgb(" + spec + ")");
}
try {
setR(Integer.parseInt(matRGB.group(1)), false);
@@ -116,31 +111,22 @@
setB(Integer.parseInt(matRGB.group(3)), false);
} catch (NumberFormatException e) {
e.printStackTrace();
- throw new ColorException("Bad color specification(5): rgb("
- + spec + ")");
+ throw new ColorException("Bad color specification(5): rgb(" + spec + ")");
}
} else { // float value
- Pattern patRGB = Pattern
- .compile("^\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*\\,\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*\\,\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*$");
+ Pattern patRGB = Pattern.compile(
+ "^\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*\\,\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*\\,\\s*([\\+\\-]?\\d+(\\.\\d+)*)\\%\\s*$");
Matcher matRGB = patRGB.matcher(spec);
if (!(matRGB.find())) {
- throw new ColorException("Bad color specification(6): rgb("
- + spec + ")");
+ throw new ColorException("Bad color specification(6): rgb(" + spec + ")");
}
try {
- setR(
- (int) ((Float.parseFloat(matRGB.group(1))) / 100.0f * 255.0f),
- false);
- setG(
- (int) ((Float.parseFloat(matRGB.group(3))) / 100.0f * 255.0f),
- false);
- setB(
- (int) ((Float.parseFloat(matRGB.group(5))) / 100.0f * 255.0f),
- false);
+ setR((int) ((Float.parseFloat(matRGB.group(1))) / 100.0f * 255.0f), false);
+ setG((int) ((Float.parseFloat(matRGB.group(3))) / 100.0f * 255.0f), false);
+ setB((int) ((Float.parseFloat(matRGB.group(5))) / 100.0f * 255.0f), false);
} catch (Exception e) {
e.printStackTrace();
- throw new ColorException("Bad color specification(7): rgb("
- + spec + ")");
+ throw new ColorException("Bad color specification(7): rgb(" + spec + ")");
}
}
} else if (spec.equals("transparent")) {
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorUtil.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorUtil.java
index e3ef942..ce7c192 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorUtil.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/color/ColorUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and Others
+ * Copyright (c) 2003, 2020 IBM Corporation 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
@@ -7,86 +7,126 @@
*
* Contributors:
* Junji MAEDA - initial API and implementation
+ * IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.actf.visualization.internal.engines.lowvision.color;
import java.io.PrintStream;
import java.io.PrintWriter;
+import java.util.HashMap;
public class ColorUtil {
- // pre-defined 16 colors (HTML4.0, XHTML1.0, CSS2)
+ // pre-defined 16 colors (HTML4.0, XHTML1.0, CSS2) -> CSS3 extended
+ // colors(X11 colors)
+ /*
+ * @SuppressWarnings("nls")
+ *
+ * private static final String predefinedColors[] = { "black", "#000000",
+ * "silver", "#c0c0c0", "gray", "#808080", "grey", "#808080", "white",
+ * "#ffffff", "maroon", "#800000", "red", "#ff0000", "purple", "#800080",
+ * "fuchsia", "#ff00ff", "green", "#008000", "lime", "#00ff00", "olive",
+ * "#808000", "yellow", "#ffff00", "navy", "#000080", "blue", "#0000ff",
+ * "teal", "#008080", "aqua", "#00ffff" };
+ */
@SuppressWarnings("nls")
- private static final String predefinedColors[] = {
- "black", "#000000", "silver", "#c0c0c0",
- "gray", "#808080", "grey", "#808080", "white", "#ffffff",
- "maroon", "#800000", "red", "#ff0000",
- "purple", "#800080", "fuchsia", "#ff00ff",
- "green", "#008000", "lime", "#00ff00",
- "olive", "#808000", "yellow", "#ffff00",
- "navy", "#000080", "blue", "#0000ff",
- "teal", "#008080", "aqua", "#00ffff"
- };
- private static final int numPredefinedColors = predefinedColors.length/2;
+ private static final String predefinedColors[][] = { { "aliceblue", "#f0f8ff" }, { "antiquewhite", "#faebd7" },
+ { "aqua", "#00ffff" }, { "aquamarine", "#7fffd4" }, { "azure", "#f0ffff" }, { "beige", "#f5f5dc" },
+ { "bisque", "#ffe4c4" }, { "black", "#000000" }, { "blanchedalmond", "#ffebcd" }, { "blue", "#0000ff" },
+ { "blueviolet", "#8a2be2" }, { "brown", "#a52a2a" }, { "burlywood", "#deb887" }, { "cadetblue", "#5f9ea0" },
+ { "chartreuse", "#7fff00" }, { "chocolate", "#d2691e" }, { "coral", "#ff7f50" },
+ { "cornflowerblue", "#6495ed" }, { "cornsilk", "#fff8dc" }, { "crimson", "#dc143c" }, { "cyan", "#00ffff" },
+ { "darkblue", "#00008b" }, { "darkcyan", "#008b8b" }, { "darkgoldenrod", "#b8860b" },
+ { "darkgray", "#a9a9a9" }, { "darkgreen", "#006400" }, { "darkgrey", "#a9a9a9" },
+ { "darkkhaki", "#bdb76b" }, { "darkmagenta", "#8b008b" }, { "darkolivegreen", "#556b2f" },
+ { "darkorange", "#ff8c00" }, { "darkorchid", "#9932cc" }, { "darkred", "#8b0000" },
+ { "darksalmon", "#e9967a" }, { "darkseagreen", "#8fbc8f" }, { "darkslateblue", "#483d8b" },
+ { "darkslategray", "#2f4f4f" }, { "darkslategrey", "#2f4f4f" }, { "darkturquoise", "#00ced1" },
+ { "darkviolet", "#9400d3" }, { "deeppink", "#ff1493" }, { "deepskyblue", "#00bfff" },
+ { "dimgray", "#696969" }, { "dimgrey", "#696969" }, { "dodgerblue", "#1e90ff" }, { "firebrick", "#b22222" },
+ { "floralwhite", "#fffaf0" }, { "forestgreen", "#228b22" }, { "fuchsia", "#ff00ff" },
+ { "gainsboro", "#dcdcdc" }, { "ghostwhite", "#f8f8ff" }, { "gold", "#ffd700" }, { "goldenrod", "#daa520" },
+ { "gray", "#808080" }, { "green", "#008000" }, { "greenyellow", "#adff2f" }, { "grey", "#808080" },
+ { "honeydew", "#f0fff0" }, { "hotpink", "#ff69b4" }, { "indianred", "#cd5c5c" }, { "indigo", "#4b0082" },
+ { "ivory", "#fffff0" }, { "khaki", "#f0e68c" }, { "lavender", "#e6e6fa" }, { "lavenderblush", "#fff0f5" },
+ { "lawngreen", "#7cfc00" }, { "lemonchiffon", "#fffacd" }, { "lightblue", "#add8e6" },
+ { "lightcoral", "#f08080" }, { "lightcyan", "#e0ffff" }, { "lightgoldenrodyellow", "#fafad2" },
+ { "lightgray", "#d3d3d3" }, { "lightgreen", "#90ee90" }, { "lightgrey", "#d3d3d3" },
+ { "lightpink", "#ffb6c1" }, { "lightsalmon", "#ffa07a" }, { "lightseagreen", "#20b2aa" },
+ { "lightskyblue", "#87cefa" }, { "lightslategray", "#778899" }, { "lightslategrey", "#778899" },
+ { "lightsteelblue", "#b0c4de" }, { "lightyellow", "#ffffe0" }, { "lime", "#00ff00" },
+ { "limegreen", "#32cd32" }, { "linen", "#faf0e6" }, { "magenta", "#ff00ff" }, { "maroon", "#800000" },
+ { "mediumaquamarine", "#66cdaa" }, { "mediumblue", "#0000cd" }, { "mediumorchid", "#ba55d3" },
+ { "mediumpurple", "#9370db" }, { "mediumseagreen", "#3cb371" }, { "mediumslateblue", "#7b68ee" },
+ { "mediumspringgreen", "#00fa9a" }, { "mediumturquoise", "#48d1cc" }, { "mediumvioletred", "#c71585" },
+ { "midnightblue", "#191970" }, { "mintcream", "#f5fffa" }, { "mistyrose", "#ffe4e1" },
+ { "moccasin", "#ffe4b5" }, { "navajowhite", "#ffdead" }, { "navy", "#000080" }, { "oldlace", "#fdf5e6" },
+ { "olive", "#808000" }, { "olivedrab", "#6b8e23" }, { "orange", "#ffa500" }, { "orangered", "#ff4500" },
+ { "orchid", "#da70d6" }, { "palegoldenrod", "#eee8aa" }, { "palegreen", "#98fb98" },
+ { "paleturquoise", "#afeeee" }, { "palevioletred", "#db7093" }, { "papayawhip", "#ffefd5" },
+ { "peachpuff", "#ffdab9" }, { "peru", "#cd853f" }, { "pink", "#ffc0cb" }, { "plum", "#dda0dd" },
+ { "powderblue", "#b0e0e6" }, { "purple", "#800080" }, { "red", "#ff0000" }, { "rosybrown", "#bc8f8f" },
+ { "royalblue", "#4169e1" }, { "saddlebrown", "#8b4513" }, { "salmon", "#fa8072" },
+ { "sandybrown", "#f4a460" }, { "seagreen", "#2e8b57" }, { "seashell", "#fff5ee" }, { "sienna", "#a0522d" },
+ { "silver", "#c0c0c0" }, { "skyblue", "#87ceeb" }, { "slateblue", "#6a5acd" }, { "slategray", "#708090" },
+ { "slategrey", "#708090" }, { "snow", "#fffafa" }, { "springgreen", "#00ff7f" }, { "steelblue", "#4682b4" },
+ { "tan", "#d2b48c" }, { "teal", "#008080" }, { "thistle", "#d8bfd8" }, { "tomato", "#ff6347" },
+ { "turquoise", "#40e0d0" }, { "violet", "#ee82ee" }, { "wheat", "#f5deb3" }, { "white", "#ffffff" },
+ { "whitesmoke", "#f5f5f5" }, { "yellow", "#ffff00" }, { "yellowgreen", "#9acd32" } };
- public static boolean isPredefinedColor( String _s ){
- String s = _s.toLowerCase();
- for( int i=0; i<numPredefinedColors; i++ ){
- if( predefinedColors[i*2].equals(s) ){
- return( true );
- }
+ private static final HashMap<String, String> predefinedColorMap = new HashMap<String, String>();
+ static {
+ for (int i = 0; i < predefinedColors.length; i++) {
+ predefinedColorMap.put(predefinedColors[i][0], predefinedColors[i][1]);
}
- return( false );
}
- public static String predefinedColor2Pound( String _s ){
- String s = _s.toLowerCase();
- for( int i=0; i<numPredefinedColors; i++ ){
- if( predefinedColors[i*2].equals(s) ){
- return( predefinedColors[i*2+1] );
- }
- }
- return( null );
+ public static boolean isPredefinedColor(String _s) {
+ return predefinedColorMap.containsKey(_s.toLowerCase());
+ }
+
+ public static String predefinedColor2Pound(String _s) {
+ return predefinedColorMap.get(_s.toLowerCase());
}
// TYPE_INT_RGB <--> R,G,B
- public static int[] intToRGB( int _i ){
+ public static int[] intToRGB(int _i) {
int[] rgb = new int[3];
- rgb[0] = (_i>>16) & 0xff;
- rgb[1] = (_i>>8) & 0xff;
+ rgb[0] = (_i >> 16) & 0xff;
+ rgb[1] = (_i >> 8) & 0xff;
rgb[2] = _i & 0xff;
- return( rgb );
+ return (rgb);
}
- public static int RGBToInt( int _r, int _g, int _b ){
- return( (_r&0xff)<<16 | (_g&0xff)<<8 | (_b&0xff) );
+
+ public static int RGBToInt(int _r, int _g, int _b) {
+ return ((_r & 0xff) << 16 | (_g & 0xff) << 8 | (_b & 0xff));
}
-
- public static void dumpColor( PrintStream _ps, int _i ){
+
+ public static void dumpColor(PrintStream _ps, int _i) {
(new ColorIRGB(_i)).dump(_ps);
}
- public static void dumpColor( PrintWriter _pw, int _i ){
+ public static void dumpColor(PrintWriter _pw, int _i) {
(new ColorIRGB(_i)).dump(_pw);
}
-
+
/*
* assign distinguishable colors for sequential IDs
*
*/
- public static int distinguishableColor( int _id ){
+ public static int distinguishableColor(int _id) {
int r = 0;
int g = 0;
int b = 0;
- if( _id == 0 ){
- return( 0x00ffffff );
- }
- else{
- for( int l=0; l<8; l++ ){
- r += ((_id>>(l*3))&1)<<(7-l);
- g += ((_id>>(l*3+1))&1)<<(7-l);
- b += ((_id>>(l*3+2))&1)<<(7-l);
+ if (_id == 0) {
+ return (0x00ffffff);
+ } else {
+ for (int l = 0; l < 8; l++) {
+ r += ((_id >> (l * 3)) & 1) << (7 - l);
+ g += ((_id >> (l * 3 + 1)) & 1) << (7 - l);
+ b += ((_id >> (l * 3 + 2)) & 1) << (7 - l);
}
- return( (r<<16) | (g<<8) | b );
+ return ((r << 16) | (g << 8) | b);
}
}
}
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorWarning.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorWarning.java
new file mode 100644
index 0000000..e6cedbb
--- /dev/null
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ColorWarning.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2020 IBM Corporation 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:
+ * Junji MAEDA - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.actf.visualization.internal.engines.lowvision.problem;
+
+import org.eclipse.actf.visualization.engines.lowvision.LowVisionType;
+import org.eclipse.actf.visualization.internal.engines.lowvision.Messages;
+import org.eclipse.actf.visualization.internal.engines.lowvision.PageElement;
+import org.eclipse.actf.visualization.internal.engines.lowvision.image.PageComponent;
+
+public class ColorWarning extends LowVisionProblem {
+ public static final int FONT = 0;
+ public static final int BACKGROUND = 1;
+ public static final int BOTH = 2;
+ public static final int OPACITY = 3;
+
+ private static String getDescriptionFromType(int type) {
+ switch (type) {
+ case FONT:
+ return Messages.FontAlphaWarning;
+ case BACKGROUND:
+ return Messages.BackgroundAlphaWarning;
+ case BOTH:
+ return Messages.BothAlphaWarning;
+ case OPACITY:
+ return Messages.BothAlphaWarning + " (opacity)";
+ }
+ return "";
+ }
+
+ int warningType = BOTH;
+
+ public ColorWarning(int _warningType, PageComponent _pc, LowVisionType _lvType) throws LowVisionProblemException {
+ super(LOWVISION_COLOR_WITH_ALPHA_WARNING, _lvType, getDescriptionFromType(_warningType), _pc, 0);
+ warningType = _warningType;
+ setRecommendations();
+ }
+
+ public ColorWarning(int _warningType, PageElement _pe, LowVisionType _lvType) throws LowVisionProblemException {
+ super(LOWVISION_COLOR_WITH_ALPHA_WARNING, _lvType, getDescriptionFromType(_warningType), _pe, 0);
+ warningType = _warningType;
+ setRecommendations();
+ }
+
+ protected void setRecommendations() throws LowVisionProblemException {
+ recommendations = new LowVisionRecommendation[0];
+ }
+
+ public int getWarningType() {
+ if(warningType == OPACITY){
+ //use message/errorId for BothAlphaWarning
+ return BOTH;
+ }
+ return warningType;
+ }
+}
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ILowVisionProblem.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ILowVisionProblem.java
index 7065acb..8b90e74 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ILowVisionProblem.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/ILowVisionProblem.java
@@ -17,12 +17,13 @@
import org.eclipse.actf.visualization.engines.lowvision.LowVisionType;
import org.eclipse.actf.visualization.engines.lowvision.image.IPageImage;
+import org.eclipse.actf.visualization.eval.problem.ILowvisionProblemSubtype;
import org.eclipse.actf.visualization.internal.engines.lowvision.PageElement;
import org.eclipse.actf.visualization.internal.engines.lowvision.image.Int2D;
import org.eclipse.actf.visualization.internal.engines.lowvision.image.PageComponent;
import org.w3c.dom.Element;
-public interface ILowVisionProblem {
+public interface ILowVisionProblem extends ILowvisionProblemSubtype{
int UNSET_POSITION = -1;
int DEFAULT_PRIORITY = 0;
diff --git a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/LowVisionProblem.java b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/LowVisionProblem.java
index 7c652a7..a1865e1 100644
--- a/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/LowVisionProblem.java
+++ b/plugins/org.eclipse.actf.visualization.engines.lowvision/src/org/eclipse/actf/visualization/internal/engines/lowvision/problem/LowVisionProblem.java
@@ -17,40 +17,39 @@
import org.eclipse.actf.visualization.engines.lowvision.LowVisionType;
import org.eclipse.actf.visualization.engines.lowvision.image.IPageImage;
-import org.eclipse.actf.visualization.eval.problem.ILowvisionProblemSubtype;
import org.eclipse.actf.visualization.internal.engines.lowvision.PageElement;
import org.eclipse.actf.visualization.internal.engines.lowvision.image.ConnectedComponent;
import org.eclipse.actf.visualization.internal.engines.lowvision.image.Int2D;
import org.eclipse.actf.visualization.internal.engines.lowvision.image.PageComponent;
import org.w3c.dom.Element;
-
-public abstract class LowVisionProblem implements ILowvisionProblemSubtype, ILowVisionProblem{
- IPageImage pageImage = null;
+public abstract class LowVisionProblem implements ILowVisionProblem {
+ IPageImage pageImage = null;
LowVisionType lowVisionType = null;
- int problemType;
- short componentType = PageComponent.UNDEFINED_TYPE;
- PageComponent pageComponent = null;
- PageElement pageElement = null;
- String description;
+ int problemType;
+ short componentType = PageComponent.UNDEFINED_TYPE;
+ PageComponent pageComponent = null;
+ PageElement pageElement = null;
+ String description;
int left = UNSET_POSITION;
int top = UNSET_POSITION;
int width = 0;
int height = 0;
- int priority;
+ int priority;
- double probability = 0.0; //
+ double probability = 0.0; //
double characterScore = 0.0; //
- //int numRecommendations = 0; // recommendations.length;
+ // int numRecommendations = 0; // recommendations.length;
LowVisionRecommendation[] recommendations = null;
boolean isGroupFlag = false; // is LowVisionProblemGroup?
-
+
Element element;
-
- protected LowVisionProblem(){
+
+ protected LowVisionProblem() {
}
-
- public LowVisionProblem( int _type, LowVisionType _lvType, String _description, PageComponent _com, double _proba ) throws LowVisionProblemException{
+
+ public LowVisionProblem(int _type, LowVisionType _lvType, String _description, PageComponent _com, double _proba)
+ throws LowVisionProblemException {
problemType = _type;
lowVisionType = _lvType;
description = _description;
@@ -58,7 +57,7 @@
componentType = pageComponent.getType();
pageImage = pageComponent.getPageImage();
ConnectedComponent cc = pageComponent.getConnectedComponent();
- if( cc != null ){
+ if (cc != null) {
left = cc.getLeft();
top = cc.getTop();
width = cc.getWidth();
@@ -66,15 +65,15 @@
}
setPriority();
probability = _proba;
- characterScore = probability * width * height;
+ characterScore = probability * width * height;
}
- public LowVisionProblem( int _type, LowVisionType _lvType, String _description, PageElement _pe, double _proba ){
+ public LowVisionProblem(int _type, LowVisionType _lvType, String _description, PageElement _pe, double _proba) {
problemType = _type;
lowVisionType = _lvType;
description = _description;
pageElement = _pe;
- if( pageElement != null ){
+ if (pageElement != null) {
left = pageElement.getX();
top = pageElement.getY();
width = pageElement.getWidth();
@@ -83,281 +82,355 @@
setPriority();
probability = _proba;
}
-
- private void setPriority(){
- if( left == UNSET_POSITION || top == UNSET_POSITION ){
+
+ private void setPriority() {
+ if (left == UNSET_POSITION || top == UNSET_POSITION) {
priority = DEFAULT_PRIORITY;
- }else{
+ } else {
priority = 0x7fffffff - top * 0xffff - left;
}
/*
- PageImage pi = component.getPageImage();
- if( pi != null ){
- int pageWidth = pi.getWidth();
- int pageHeight = pi.getHeight();
- priority = pageWidth*pageHeight - top*pageWidth - left;
- }
- else{
- priority = DEFAULT_PRIORITY;
- }
- */
+ * PageImage pi = component.getPageImage(); if( pi != null ){ int
+ * pageWidth = pi.getWidth(); int pageHeight = pi.getHeight(); priority
+ * = pageWidth*pageHeight - top*pageWidth - left; } else{ priority =
+ * DEFAULT_PRIORITY; }
+ */
}
protected abstract void setRecommendations() throws LowVisionProblemException;
-
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getType()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getType()
*/
@Override
public short getType() {
- return( LOWVISION_PROBLEM );
+ return (LOWVISION_PROBLEM);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getLowVisionType()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getLowVisionType()
*/
@Override
- public LowVisionType getLowVisionType(){
- return( lowVisionType );
+ public LowVisionType getLowVisionType() {
+ return (lowVisionType);
}
// LowVision Error type (Color, Blur, etc.)
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getLowVisionProblemType()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getLowVisionProblemType()
*/
@Override
- public int getLowVisionProblemType(){
- return( problemType );
+ public int getLowVisionProblemType() {
+ return (problemType);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getDescription()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getDescription()
*/
@Override
- public String getDescription() throws LowVisionProblemException{
- return( description );
+ public String getDescription() throws LowVisionProblemException {
+ return (description);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getPageImage()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getPageImage()
*/
@Override
- public IPageImage getPageImage(){
- return( pageImage );
+ public IPageImage getPageImage() {
+ return (pageImage);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getX()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getX()
*/
@Override
- public int getX(){
- return( left );
+ public int getX() {
+ return (left);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getY()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getY()
*/
@Override
- public int getY(){
- return( top );
+ public int getY() {
+ return (top);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getWidth()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getWidth()
*/
@Override
- public int getWidth(){
- return( width );
+ public int getWidth() {
+ return (width);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getHeight()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getHeight()
*/
@Override
- public int getHeight(){
- return( height );
+ public int getHeight() {
+ return (height);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getPriority()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getPriority()
*/
@Override
- public int getPriority(){
- return( priority );
+ public int getPriority() {
+ return (priority);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getProbability()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getProbability()
*/
@Override
- public double getProbability(){
- return( probability );
+ public double getProbability() {
+ return (probability);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getIntProbability()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getIntProbability()
*/
@Override
- public int getIntProbability(){
- return( (int)(Math.rint(probability*100.0)) );
+ public int getIntProbability() {
+ return ((int) (Math.rint(probability * 100.0)));
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getCharacterScore()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getCharacterScore()
*/
@Override
- public double getCharacterScore(){
- return( characterScore );
+ public double getCharacterScore() {
+ return (characterScore);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getRecommendations()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getRecommendations()
*/
@Override
- public LowVisionRecommendation[] getRecommendations(){
- return( recommendations );
+ public LowVisionRecommendation[] getRecommendations() {
+ return (recommendations);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#isGroup()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#isGroup()
*/
@Override
- public boolean isGroup(){
- return( isGroupFlag );
+ public boolean isGroup() {
+ return (isGroupFlag);
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getComponentType()
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getComponentType()
*/
@Override
- public short getComponentType() throws LowVisionProblemException{
- if( !isGroupFlag ){
- return( componentType );
- }
- else{
- throw new LowVisionProblemException( "componentType cannot be gotten from a ProblemGroup." ); //$NON-NLS-1$
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getPageComponent()
- */
- @Override
- public PageComponent getPageComponent() throws LowVisionProblemException{
- if( !isGroupFlag ){
- return( pageComponent );
- }
- else{
- throw new LowVisionProblemException( "component cannot be gotten from a ProblemGroup." ); //$NON-NLS-1$
+ public short getComponentType() throws LowVisionProblemException {
+ if (!isGroupFlag) {
+ return (componentType);
+ } else {
+ throw new LowVisionProblemException("componentType cannot be gotten from a ProblemGroup."); //$NON-NLS-1$
}
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getPageElement()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getPageComponent()
*/
@Override
- public PageElement getPageElement(){
- return( pageElement );
+ public PageComponent getPageComponent() throws LowVisionProblemException {
+ if (!isGroupFlag) {
+ return (pageComponent);
+ } else {
+ throw new LowVisionProblemException("component cannot be gotten from a ProblemGroup."); //$NON-NLS-1$
+ }
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#toString()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getPageElement()
+ */
+ @Override
+ public PageElement getPageElement() {
+ return (pageElement);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#toString()
*/
@Override
@SuppressWarnings("nls")
- public String toString(){
+ public String toString() {
String compTypeString = null;
- if( componentType == PageComponent.SS_CHARACTER_TYPE ){
+ if (componentType == PageComponent.SS_CHARACTER_TYPE) {
compTypeString = "(SS)";
- }
- else if( componentType == PageComponent.MS_CHARACTER_TYPE ){
+ } else if (componentType == PageComponent.MS_CHARACTER_TYPE) {
compTypeString = "(MS)";
- }
- else if( componentType == PageComponent.SM_CHARACTER_TYPE ){
+ } else if (componentType == PageComponent.SM_CHARACTER_TYPE) {
compTypeString = "(SM)";
- }
- else{
- compTypeString = ""+componentType;
+ } else {
+ compTypeString = "" + componentType;
}
StringBuffer sb = new StringBuffer();
- sb.append( "Description=" + description );
- sb.append( compTypeString );
- sb.append( ", " );
- sb.append( "(x,y)=(" + left + "," + top + ")" );
- sb.append( ", " );
- sb.append( "[WIDTH x HEIGHT]=[" + width + " x " + height + "]" );
- sb.append( ", " );
- sb.append( "Probability=" + (int)(Math.rint(probability*100.0)) );
- sb.append( ", " );
- sb.append( "#Recommendations=" + recommendations.length );
- return( sb.toString() );
+ sb.append("Description=" + description);
+ sb.append(compTypeString);
+ sb.append(", ");
+ sb.append("(x,y)=(" + left + "," + top + ")");
+ sb.append(", ");
+ sb.append("[WIDTH x HEIGHT]=[" + width + " x " + height + "]");
+ sb.append(", ");
+ sb.append("Probability=" + (int) (Math.rint(probability * 100.0)));
+ sb.append(", ");
+ sb.append("#Recommendations=" + recommendations.length);
+ return (sb.toString());
}
-
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#dump(java.io.PrintStream, boolean)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#dump(java.io.PrintStream, boolean)
*/
@Override
- public void dump( PrintStream _ps, boolean _doRecommendations ) throws LowVisionProblemException{
- PrintWriter pw = new PrintWriter( _ps, true );
- dump( pw, _doRecommendations );
+ public void dump(PrintStream _ps, boolean _doRecommendations) throws LowVisionProblemException {
+ PrintWriter pw = new PrintWriter(_ps, true);
+ dump(pw, _doRecommendations);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#dump(java.io.PrintWriter, boolean)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#dump(java.io.PrintWriter, boolean)
*/
@Override
@SuppressWarnings("nls")
- public void dump( PrintWriter _pw, boolean _doRecommendations ) throws LowVisionProblemException{
- _pw.println( "----------" );
- _pw.println( "dumping a problem");
- _pw.println( "problemType = " + problemType );
- _pw.println( "componentType = " + componentType );
- _pw.println( "description = " + getDescription() );
- _pw.println( "(x,y) = ( " + getX() + ", " + getY() + ")" );
- _pw.println( "width, height = " + getWidth() + ", " + getHeight() );
- _pw.println( "priority = " + getPriority() );
+ public void dump(PrintWriter _pw, boolean _doRecommendations) throws LowVisionProblemException {
+ _pw.println("----------");
+ _pw.println("dumping a problem");
+ _pw.println("problemType = " + problemType);
+ _pw.println("componentType = " + componentType);
+ _pw.println("description = " + getDescription());
+ _pw.println("(x,y) = ( " + getX() + ", " + getY() + ")");
+ _pw.println("width, height = " + getWidth() + ", " + getHeight());
+ _pw.println("priority = " + getPriority());
LowVisionRecommendation[] recs = getRecommendations();
- if( recs != null ){
- _pw.println( "# of Recommendations = " + recs.length );
+ if (recs != null) {
+ _pw.println("# of Recommendations = " + recs.length);
+ } else {
+ _pw.println("Recommendations are null.");
}
- else{
- _pw.println( "Recommendations are null." );
- }
- if( _doRecommendations && recs != null ){
- for( int i=0; i<recs.length; i++ ){
- _pw.println( "Recommendation #" + i );
+ if (_doRecommendations && recs != null) {
+ for (int i = 0; i < recs.length; i++) {
+ _pw.println("Recommendation #" + i);
recs[i].dump(_pw);
}
}
- _pw.println( "----------" );
+ _pw.println("----------");
}
- private static final int[] PROBLEM_COLORS = {
- 0x00ffffff, 0x00ff0000, 0x0000ff00
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#drawSurroundingBox(org.eclipse.actf.visualization.internal.engines.lowvision.image.Int2D)
+ private static final int[] PROBLEM_COLORS = { 0x00ffffff, 0x00ff0000, 0x0000ff00 };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#drawSurroundingBox(org.eclipse.actf.visualization.
+ * internal.engines.lowvision.image.Int2D)
*/
@Override
- public void drawSurroundingBox( Int2D _img ){
+ public void drawSurroundingBox(Int2D _img) {
int x0 = getX();
int y0 = getY();
- int x1 = x0+getWidth();
- int y1 = y0+getHeight();
+ int x1 = x0 + getWidth();
+ int y1 = y0 + getHeight();
int color = PROBLEM_COLORS[problemType];
- for( int i=x0; i<x1; i++ ){
+ for (int i = x0; i < x1; i++) {
_img.getData()[y0][i] = color;
- _img.getData()[y1-1][i] = color;
+ _img.getData()[y1 - 1][i] = color;
}
- for( int j=y0; j<y1; j++ ){
+ for (int j = y0; j < y1; j++) {
_img.getData()[j][x0] = color;
- _img.getData()[j][x1-1] = color;
- }
- }
-
- public static void drawAllSurroundingBoxes( ILowVisionProblem[] _problems, Int2D _img ){
- for( int k=0; k<_problems.length; k++ ){
- _problems[k].drawSurroundingBox( _img );
+ _img.getData()[j][x1 - 1] = color;
}
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#getElement()
+ public static void drawAllSurroundingBoxes(ILowVisionProblem[] _problems, Int2D _img) {
+ for (int k = 0; k < _problems.length; k++) {
+ _problems[k].drawSurroundingBox(_img);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#getElement()
*/
@Override
public Element getElement() {
return element;
}
- /* (non-Javadoc)
- * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.ILowVisionProblem#setElement(org.w3c.dom.Element)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.actf.visualization.internal.engines.lowvision.problem.
+ * ILowVisionProblem#setElement(org.w3c.dom.Element)
*/
@Override
public void setElement(Element element) {
diff --git a/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml b/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml
index b3c39ad..1178d46 100644
--- a/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml
+++ b/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml
@@ -755,6 +755,51 @@
<desc>This text is too small and its font size might be fixed. (unsupported font-size definitions, etc.)</desc>
</description>
</checkitem>
+ <checkitem type="user" id="L_13.0">
+ <guideline>
+ <gItem id="2.2" name="WCAG"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="JIS"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="JIS"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="WCAG 2.0"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="WCAG 2.0"/>
+ </guideline>
+ <metrics>
+ <mItem name="Perceivable"/>
+ </metrics>
+ <description>
+ <desc>Font color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.</desc>
+ </description>
+ </checkitem>
+ <checkitem type="user" id="L_13.1">
+ <guideline>
+ <gItem id="2.2" name="WCAG"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="JIS"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="JIS"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="WCAG 2.0"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="WCAG 2.0"/>
+ </guideline>
+ <metrics>
+ <mItem name="Perceivable"/>
+ </metrics>
+ <description>
+ <desc>Background color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.</desc>
+ </description>
+ </checkitem>
+ <checkitem type="user" id="L_13.2">
+ <guideline>
+ <gItem id="2.2" name="WCAG"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="JIS"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="JIS"/>
+ <gItem techniques="G18,G145" id="1.4.3" name="WCAG 2.0"/>
+ <gItem techniques="G17,G18" id="1.4.6" name="WCAG 2.0"/>
+ </guideline>
+ <metrics>
+ <mItem name="Perceivable"/>
+ </metrics>
+ <description>
+ <desc>Font color and background color are defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.</desc>
+ </description>
+ </checkitem>
<checkitem type="error" id="B_38">
<guideline>
<gItem id="1.1" name="WCAG"/>
diff --git a/plugins/org.eclipse.actf.visualization.eval/resources/description.properties b/plugins/org.eclipse.actf.visualization.eval/resources/description.properties
index 9d20b4f..d3df3f5 100644
--- a/plugins/org.eclipse.actf.visualization.eval/resources/description.properties
+++ b/plugins/org.eclipse.actf.visualization.eval/resources/description.properties
@@ -62,4 +62,7 @@
L_6 = This text is too small and its font size is fixed.
L_10 = This area has background image. Please confirm the contrast between text and background, and confirm important information is not provided only by background image. .{0}
L_11 = Font size might be fixed. \uff08unsupported font-size definitions, etc. This message is also shown in the case where font-size is unspecified.\uff09
-L_12 = This text is too small and its font size might be fixed. \uff08unsupported font-size definitions, etc.\uff09
\ No newline at end of file
+L_12 = This text is too small and its font size might be fixed. \uff08unsupported font-size definitions, etc.\uff09
+L_13.0 = Font color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
+L_13.1 = Background color is defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
+L_13.2 = Font color and background color are defined by using alpha (opacity). Please confirm color combination by using color check tool, etc.
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties b/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties
index 3ffb69f..f67e871 100644
--- a/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties
+++ b/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties
@@ -62,4 +62,7 @@
L_6 = \u3053\u306e\u6587\u5b57\u306f\u5c0f\u3055\u3059\u304e\u307e\u3059\u3002\u3055\u3089\u306b\u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002
L_10 = \u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3067\u80cc\u666f\u753b\u50cf\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u9593\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u6bd4\u304c\u5341\u5206\u304b\u3001\u80cc\u666f\u753b\u50cf\u306e\u307f\u306b\u3088\u3063\u3066\u91cd\u8981\u306a\u60c5\u5831\u3092\u4f1d\u3048\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002{0}
L_11 = \u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059 \uff08\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u6307\u5b9a\u3084\u3001\u672a\u6307\u5b9a\u306e\u5834\u5408\u3082\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09
-L_12 = \u3053\u306e\u6587\u5b57\u306f\u5c0f\u3055\u3059\u304e\u307e\u3059\u3002\u3055\u3089\u306b\u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059 \uff08\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u6307\u5b9a\u306e\u5834\u5408\u3082\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09
\ No newline at end of file
+L_12 = \u3053\u306e\u6587\u5b57\u306f\u5c0f\u3055\u3059\u304e\u307e\u3059\u3002\u3055\u3089\u306b\u56fa\u5b9a\u30b5\u30a4\u30ba\u306e\u30d5\u30a9\u30f3\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059 \uff08\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u6307\u5b9a\u306e\u5834\u5408\u3082\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09
+L_13.0 = \u6587\u5b57\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+L_13.1 = \u80cc\u666f\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+L_13.2 = \u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u304c alpha (\u900f\u660e\u5ea6)\u3092\u7528\u3044\u3066\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ab\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3092\u7528\u3044\u3066\u3001\u6587\u5b57\u8272\u3068\u80cc\u666f\u8272\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u554f\u984c\u304c\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
\ No newline at end of file
diff --git a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/problem/ILowvisionProblemSubtype.java b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/problem/ILowvisionProblemSubtype.java
index ae3b3e1..ac623d0 100644
--- a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/problem/ILowvisionProblemSubtype.java
+++ b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/problem/ILowvisionProblemSubtype.java
@@ -27,4 +27,5 @@
public static final int LOWVISION_BACKGROUND_IMAGE_WARNING = 10;
public static final int LOWVISION_FIXED_SIZE_FONT_WARNING = 11; //for pt
public static final int LOWVISION_FIXED_SMALL_FONT_WARNIG =12; //for pt
+ public static final int LOWVISION_COLOR_WITH_ALPHA_WARNING = 13;
}
diff --git a/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java b/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
index 53936f2..fb7c2a2 100644
--- a/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
+++ b/plugins/org.eclipse.actf.visualization.lowvision/src/org/eclipse/actf/visualization/lowvision/eval/SummaryEvaluationLV.java
@@ -72,8 +72,8 @@
public String getOverview() {
StringBuffer tmpSB = new StringBuffer(512);
- int problemCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- int severeCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int problemCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int severeCount[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
for (int i = 0; i < _problems.length; i++) {
IProblemItemImage curProblem = _problems[i];