~ubuntu-branches/debian/sid/swt-gtk/sid

« back to all changes in this revision

Viewing changes to org/eclipse/swt/graphics/TextStyle.java

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Perez
  • Date: 2009-12-07 10:22:24 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20091207102224-70w2tax575mcks1w
Tags: 3.5.1-1
* New upstream release. Closes: #558663.
* debian/control: 
  - Add Vcs-* fields for Git repository.
  - Allow DM-Uploads.
  - Remove "Conflicts", package should live with eclipse.
* debian/rules: Fix default-java path around AWT_LIB_PATH.
* debian/copyright: Minor update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
         * @see SWT#UNDERLINE_DOUBLE 
82
82
         * @see SWT#UNDERLINE_ERROR
83
83
         * @see SWT#UNDERLINE_SQUIGGLE
 
84
         * @see SWT#UNDERLINE_LINK
84
85
         * 
85
86
         * @since 3.4
86
87
         */     
137
138
         * @since 3.2
138
139
         */     
139
140
        public int rise;
 
141
        
 
142
        
 
143
        /**
 
144
         * the data. An user data field. It can be used to hold the HREF when the range 
 
145
         * is used as a link or the embed object when the range is used with <code>GlyphMetrics</code>.
 
146
         * <p>
 
147
         * 
 
148
         * @since 3.5
 
149
         */
 
150
        public Object data;
 
151
 
140
152
 
141
153
/** 
142
154
 * Create an empty text style.
185
197
        borderColor = style.borderColor;
186
198
        metrics = style.metrics;
187
199
        rise = style.rise;
 
200
        data = style.data;
188
201
}
189
202
 
190
203
/**
227
240
        if (borderColor != null) {
228
241
                if (!borderColor.equals(style.borderColor)) return false;
229
242
        } else if (style.borderColor != null) return false;
 
243
        if (data != null) {
 
244
                if (!data.equals(style.data)) return false;
 
245
        } else if (style.data != null) return false;
230
246
        return true;
231
247
}
232
248
 
262
278
        if (borderStyle != style.borderStyle) return false;
263
279
        if (borderColor != null) {
264
280
                if (!borderColor.equals(style.borderColor)) return false;
265
 
        } else if (style.borderColor != null) return false;
 
281
        } else {
 
282
                if (style.borderColor != null) return false;
 
283
                if (foreground != null) {
 
284
                        if (!foreground.equals(style.foreground)) return false;
 
285
                } else if (style.foreground != null) return false;
 
286
        }
266
287
        return true;
267
288
}
268
289
 
273
294
        if (underlineStyle != style.underlineStyle) return false;
274
295
        if (underlineColor != null) {
275
296
                if (!underlineColor.equals(style.underlineColor)) return false;
276
 
        } else if (style.underlineColor != null) return false;
 
297
        } else {
 
298
                if (style.underlineColor != null) return false;
 
299
                if (foreground != null) {
 
300
                        if (!foreground.equals(style.foreground)) return false;
 
301
                } else if (style.foreground != null) return false;
 
302
        }
277
303
        return true;
278
304
}
279
305
 
283
309
        if (strikeout != style.strikeout) return false;
284
310
        if (strikeoutColor != null) {
285
311
                if (!strikeoutColor.equals(style.strikeoutColor)) return false;
286
 
        } else if (style.strikeoutColor != null) return false;
 
312
        } else {
 
313
                if (style.strikeoutColor != null) return false;
 
314
                if (foreground != null) {
 
315
                        if (!foreground.equals(style.foreground)) return false;
 
316
                } else if (style.foreground != null) return false;
 
317
        }
287
318
        return true;
288
319
}
289
320
 
294
325
 * @return a string representation of the <code>TextStyle</code>
295
326
 */
296
327
public String toString () {
297
 
        StringBuffer buffer = new StringBuffer("TextStyle {");
 
328
        StringBuffer buffer = new StringBuffer("TextStyle {"); //$NON-NLS-1$
298
329
        int startLength = buffer.length();
299
330
        if (font != null) {
300
 
                if (buffer.length() > startLength) buffer.append(", ");
301
 
                buffer.append("font=");
 
331
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
332
                buffer.append("font="); //$NON-NLS-1$
302
333
                buffer.append(font);
303
334
        }
304
335
        if (foreground != null) {
305
 
                if (buffer.length() > startLength) buffer.append(", ");
306
 
                buffer.append("foreground=");
 
336
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$ 
 
337
                buffer.append("foreground="); //$NON-NLS-1$
307
338
                buffer.append(foreground);
308
339
        }
309
340
        if (background != null) {
310
 
                if (buffer.length() > startLength) buffer.append(", ");
311
 
                buffer.append("background=");
 
341
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
342
                buffer.append("background="); //$NON-NLS-1$
312
343
                buffer.append(background);
313
344
        }
314
345
        if (underline) {
315
 
                if (buffer.length() > startLength) buffer.append(", ");
316
 
                buffer.append("underlined");
 
346
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
347
                buffer.append("underline="); //$NON-NLS-1$
 
348
                switch (underlineStyle) {
 
349
                        case SWT.UNDERLINE_SINGLE: buffer.append("single"); break; //$NON-NLS-1$ 
 
350
                        case SWT.UNDERLINE_DOUBLE: buffer.append("double"); break; //$NON-NLS-1$ 
 
351
                        case SWT.UNDERLINE_SQUIGGLE: buffer.append("squiggle"); break; //$NON-NLS-1$ 
 
352
                        case SWT.UNDERLINE_ERROR: buffer.append("error"); break; //$NON-NLS-1$ 
 
353
                        case SWT.UNDERLINE_LINK: buffer.append("link"); break; //$NON-NLS-1$ 
 
354
                }
 
355
                if (underlineColor != null) {
 
356
                        buffer.append(", underlineColor="); //$NON-NLS-1$
 
357
                        buffer.append(underlineColor);
 
358
                }
317
359
        }
318
360
        if (strikeout) {
319
 
                if (buffer.length() > startLength) buffer.append(", ");
320
 
                buffer.append("striked out");
 
361
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
362
                buffer.append("striked out"); //$NON-NLS-1$
 
363
                if (strikeoutColor != null) {
 
364
                        buffer.append(", strikeoutColor="); //$NON-NLS-1$
 
365
                        buffer.append(strikeoutColor);
 
366
                }
 
367
        }
 
368
        if (borderStyle != SWT.NONE) {
 
369
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
370
                buffer.append("border="); //$NON-NLS-1$
 
371
                switch (borderStyle) {
 
372
                        case SWT.BORDER_SOLID:  buffer.append("solid"); break; //$NON-NLS-1$
 
373
                        case SWT.BORDER_DOT:    buffer.append("dot"); break; //$NON-NLS-1$
 
374
                        case SWT.BORDER_DASH:   buffer.append("dash"); break; //$NON-NLS-1$
 
375
                }
 
376
                if (borderColor != null) {
 
377
                        buffer.append(", borderColor="); //$NON-NLS-1$
 
378
                        buffer.append(borderColor);
 
379
                }
321
380
        }
322
381
        if (rise != 0) {
323
 
                if (buffer.length() > startLength) buffer.append(", ");
324
 
                buffer.append("rise=");
 
382
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
383
                buffer.append("rise="); //$NON-NLS-1$
325
384
                buffer.append(rise);
326
385
        }
327
386
        if (metrics != null) {
328
 
                if (buffer.length() > startLength) buffer.append(", ");
329
 
                buffer.append("metrics=");
 
387
                if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
 
388
                buffer.append("metrics="); //$NON-NLS-1$
330
389
                buffer.append(metrics);
331
390
        }
332
 
        buffer.append("}");
 
391
        buffer.append("}"); //$NON-NLS-1$
333
392
        return buffer.toString();
334
393
}
335
394