diff options
author | Simon Scholz | 2018-06-13 10:24:41 +0000 |
---|---|---|
committer | Simon Scholz | 2018-06-13 10:24:41 +0000 |
commit | 40142dc99f9eaa9f715565be100198b7a8b94466 (patch) | |
tree | e5a16b7abd711aaebc6a1cc5983c59bf2c5b8e44 | |
parent | ac3c0d8e42eef65ad99d581924a66e2d86700a9e (diff) | |
download | eclipse.platform.ua-40142dc99f9eaa9f715565be100198b7a8b94466.tar.gz eclipse.platform.ua-40142dc99f9eaa9f715565be100198b7a8b94466.tar.xz eclipse.platform.ua-40142dc99f9eaa9f715565be100198b7a8b94466.zip |
Bug 535852 - [Tip of the day] Provide a DefaultHtmlTip
Change-Id: I02378e2298333af20cf284491c2a9903543d0ac2
Signed-off-by: Simon Scholz <simon.scholz@vogella.com>
-rw-r--r-- | org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java b/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java new file mode 100644 index 000000000..76946363c --- /dev/null +++ b/org.eclipse.tips.core/src/org/eclipse/tips/core/DefaultHtmlTip.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2018 vogella GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * simon.scholz@vogella.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.tips.core; + +import java.util.Date; + +/** + * Default implementation of a {@link Tip}, which implements {@link IHtmlTip}. + * <p> + * All return values of the overridden methods can be passed as constructor + * arguments. + * </p> + * + * @see Tip + * @see IHtmlTip + */ +public class DefaultHtmlTip extends Tip implements IHtmlTip { + + private final Date creationDate; + private final String subject; + private final String html; + private final TipImage tipImage; + + /** + * Constructor, which leaves out the {@link TipImage}. + * + * @param providerId id of the {@link TipProvider}, where this tip is added + * @param creationDate creation date of this tip + * @param subject subject of this tip + * @param html HTML content of this tip + */ + public DefaultHtmlTip(String providerId, Date creationDate, String subject, String html) { + this(providerId, creationDate, subject, html, null); + } + + /** + * Constructor, which leaves out the html content and just shows the + * {@link TipImage}. + * + * @param providerId id of the {@link TipProvider}, where this tip is added + * @param creationDate creation date of this tip + * @param subject subject of this tip + * @param tipImage {@link TipImage} of this tip, which will be shown as + * content + */ + public DefaultHtmlTip(String providerId, Date creationDate, String subject, TipImage tipImage) { + this(providerId, creationDate, subject, null, tipImage); + } + + /** + * Constructor, which includes HTML content and tipImage + * + * @param providerId id of the {@link TipProvider}, where this tip is added + * @param creationDate creation date of this tip + * @param subject subject of this tip + * @param html HTML content of this tip + * @param tipImage {@link TipImage} of this tip, which will be shown as + * content + */ + public DefaultHtmlTip(String providerId, Date creationDate, String subject, String html, TipImage tipImage) { + super(providerId); + this.creationDate = creationDate; + this.subject = subject; + this.html = html; + this.tipImage = tipImage; + } + + @Override + public Date getCreationDate() { + return creationDate; + } + + @Override + public String getSubject() { + return subject; + } + + @Override + public String getHTML() { + return html; + } + + @Override + public TipImage getImage() { + return tipImage; + } +} |