01: /*
02: * WebSphinx web-crawling toolkit
03: *
04: * Copyright (c) 1998-2002 Carnegie Mellon University. All rights
05: * reserved.
06: *
07: * Redistribution and use in source and binary forms, with or without
08: * modification, are permitted provided that the following conditions
09: * are met:
10: *
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: *
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in
16: * the documentation and/or other materials provided with the
17: * distribution.
18: *
19: * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
20: * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
23: * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: *
31: */
32:
33: package websphinx.workbench;
34:
35: import websphinx.*;
36:
37: public class HighlightAction implements Action {
38: String color;
39: String scale;
40: String icon;
41:
42: public HighlightAction(String color, String scale, String icon) {
43: this .color = color;
44: this .scale = scale;
45: this .icon = icon;
46: }
47:
48: public boolean equals(Object object) {
49: if (!(object instanceof HighlightAction))
50: return false;
51: HighlightAction a = (HighlightAction) object;
52: return same(a.color, color) && same(a.scale, scale)
53: && same(a.icon, icon);
54: }
55:
56: private boolean same(String s1, String s2) {
57: if (s1 == null || s2 == null)
58: return s1 == s2;
59: else
60: return s1.equals(s2);
61: }
62:
63: public String getColor() {
64: return color;
65: }
66:
67: public String getScale() {
68: return scale;
69: }
70:
71: public String getIcon() {
72: return icon;
73: }
74:
75: public void connected(Crawler crawler) {
76: }
77:
78: public void disconnected(Crawler crawler) {
79: }
80:
81: public void visit(Page page) {
82: if (color != null)
83: page.setLabel("Workbench.color", color);
84: if (scale != null)
85: page.setLabel("Workbench.scale", color);
86: if (icon != null)
87: page.setLabel("Workbench.icon", color);
88: }
89: }
|