X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fproject%2FAbstractEntry.java;h=6e0c9d4b5c1d61a5de3909351ef9afde4f2fb80e;hb=095c0cfc66f3c18285c618c278e3be8f22003018;hp=41449b08b2627c4d90725ef9463e6bbf1c6a650d;hpb=e858fb8e714fdb9f07c9172869caab47bfc7945e;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/project/AbstractEntry.java b/src/net/pterodactylus/jsite/project/AbstractEntry.java index 41449b0..6e0c9d4 100644 --- a/src/net/pterodactylus/jsite/project/AbstractEntry.java +++ b/src/net/pterodactylus/jsite/project/AbstractEntry.java @@ -51,6 +51,9 @@ public abstract class AbstractEntry extends AbstractBean implements Entry { /** Whether to insert the file. */ private boolean insert; + /** The default content type of this entry. */ + private String defaultContentType; + /** The content type of the file. */ private String contentType; @@ -76,7 +79,14 @@ public abstract class AbstractEntry extends AbstractBean implements Entry { * {@inheritDoc} */ public boolean isDefault() { - return (insert == defaultInsert) && (contentType == null); + return (insert == defaultInsert) && isDefaultContentType(); + } + + /** + * {@inheritDoc} + */ + public boolean isDefaultContentType() { + return ((defaultContentType != null) ? defaultContentType.equals(contentType) : (contentType == null)); } /** @@ -139,4 +149,15 @@ public abstract class AbstractEntry extends AbstractBean implements Entry { fireIfPropertyChanged(PROPERTY_CONTENT_TYPE, oldContentType, contentType); } + /** + * Sets the default content type of the entry. The default content type is + * derived from its extension. + * + * @param defaultContentType + * The default content type + */ + void setDefaultContentType(String defaultContentType) { + this.defaultContentType = defaultContentType; + } + }