Skip to content

Commit f7f6c2b

Browse files
Merge branch 'develop'
2 parents 441d043 + c2128c9 commit f7f6c2b

36 files changed

+1179
-49
lines changed

wffweb/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.webfirmframework</groupId>
55
<artifactId>wffweb</artifactId>
6-
<version>2.1.6</version>
6+
<version>2.1.7</version>
77

88
<properties>
99
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2014-2017 Web Firm Framework
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
* @author WFF
16+
*/
17+
package com.webfirmframework.wffweb;
18+
19+
/**
20+
*
21+
* @author WFF
22+
* @since 2.1.7
23+
*/
24+
public class NotRenderedException extends WffRuntimeException {
25+
26+
/**
27+
*
28+
*/
29+
private static final long serialVersionUID = 1_0_0L;
30+
31+
public NotRenderedException() {
32+
super();
33+
}
34+
35+
public NotRenderedException(final String message, final Throwable cause,
36+
final boolean enableSuppression, final boolean writableStackTrace) {
37+
super(message, cause, enableSuppression, writableStackTrace);
38+
}
39+
40+
public NotRenderedException(final String message, final Throwable cause) {
41+
super(message, cause);
42+
}
43+
44+
public NotRenderedException(final String message) {
45+
super(message);
46+
}
47+
48+
public NotRenderedException(final Throwable cause) {
49+
super(cause);
50+
}
51+
52+
}

wffweb/src/main/java/com/webfirmframework/wffweb/server/page/BrowserPage.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.logging.Level;
3636
import java.util.logging.Logger;
3737

38+
import com.webfirmframework.wffweb.NotRenderedException;
3839
import com.webfirmframework.wffweb.NullValueException;
3940
import com.webfirmframework.wffweb.PushFailedException;
4041
import com.webfirmframework.wffweb.server.page.js.WffJsFile;
@@ -1063,4 +1064,39 @@ protected void removedFromContext() {
10631064
// To override and use this method
10641065
}
10651066

1067+
/**
1068+
* To check if the given tag exists in the UI. <br>
1069+
* NB:- This method is valid only if {@code browserPage#toHtmlString} or
1070+
* {@code browserPage#toOutputStream} is called at least once in the life
1071+
* time.
1072+
*
1073+
* @param tag
1074+
* @return true if the given tag contains in the BrowserPage i.e. UI. false
1075+
* if the given tag was removed or was not already added in the UI.
1076+
* @throws NullValueException
1077+
* throws this exception if the given tag is null.
1078+
* @throws NotRenderedException
1079+
* if the {@code BrowserPage} object is not rendered. i.e. if
1080+
* {@code browserPage#toHtmlString} or
1081+
* {@code browserPage#toOutputStream} was NOT called at least
1082+
* once in the life time.
1083+
* @since 2.1.7
1084+
* @author WFF
1085+
*/
1086+
public boolean contains(final AbstractHtml tag)
1087+
throws NullValueException, NotRenderedException {
1088+
if (tagByWffId != null && tag != null) {
1089+
final DataWffId dataWffId = tag.getDataWffId();
1090+
if (dataWffId == null) {
1091+
return false;
1092+
}
1093+
return tag.equals(tagByWffId.get(dataWffId.getValue()));
1094+
} else if (tagByWffId == null) {
1095+
throw new NotRenderedException(
1096+
"Could not check its existance. Make sure that you have called browserPage#toHtmlString method atleast once in the life time.");
1097+
}
1098+
throw new NullValueException(
1099+
"tag object in browserPage.contains(AbstractHtml tag) method cannot be null");
1100+
}
1101+
10661102
}

wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/TagNameConstants.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,22 @@ public class TagNameConstants {
257257

258258
public static final String PICTURE = "picture";
259259

260+
public static final String RECT = "rect";
261+
262+
public static final String CIRCLE = "circle";
263+
264+
public static final String ELLIPSE = "ellipse";
265+
266+
public static final String LINE = "line";
267+
268+
public static final String POLYGON = "polygon";
269+
270+
public static final String POLYLINE = "polyline";
271+
272+
public static final String PATH = "path";
273+
274+
public static final String TEXT = "text";
275+
260276
/**
261277
*
262278
* @author WFF

wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/attribute/Height.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.webfirmframework.wffweb.css.CssLengthUnit;
55
import com.webfirmframework.wffweb.css.core.LengthUnit;
66
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
7+
import com.webfirmframework.wffweb.tag.html.html5.identifier.RectAttributable;
78
import com.webfirmframework.wffweb.tag.html.identifier.InputAttributable;
89
import com.webfirmframework.wffweb.util.CssLengthUtil;
910

@@ -14,7 +15,7 @@
1415
* @since 1.0.0
1516
*
1617
*/
17-
public class Height extends AbstractAttribute implements InputAttributable {
18+
public class Height extends AbstractAttribute implements InputAttributable, RectAttributable {
1819

1920
private static final long serialVersionUID = 1_0_0L;
2021

wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/attribute/Width.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.webfirmframework.wffweb.css.CssLengthUnit;
55
import com.webfirmframework.wffweb.css.core.LengthUnit;
66
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
7+
import com.webfirmframework.wffweb.tag.html.html5.identifier.RectAttributable;
78
import com.webfirmframework.wffweb.tag.html.identifier.InputAttributable;
89
import com.webfirmframework.wffweb.util.CssLengthUtil;
910

@@ -14,7 +15,7 @@
1415
* @since 1.0.0
1516
*
1617
*/
17-
public class Width extends AbstractAttribute implements InputAttributable {
18+
public class Width extends AbstractAttribute implements InputAttributable, RectAttributable {
1819

1920
private static final long serialVersionUID = 1_0_0L;
2021

wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/core/TagRegistry.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,20 @@
7777
import com.webfirmframework.wffweb.tag.html.formsandinputs.Select;
7878
import com.webfirmframework.wffweb.tag.html.formsandinputs.TextArea;
7979
import com.webfirmframework.wffweb.tag.html.frames.IFrame;
80+
import com.webfirmframework.wffweb.tag.html.html5.Circle;
8081
import com.webfirmframework.wffweb.tag.html.html5.Data;
82+
import com.webfirmframework.wffweb.tag.html.html5.Ellipse;
8183
import com.webfirmframework.wffweb.tag.html.html5.HGroup;
84+
import com.webfirmframework.wffweb.tag.html.html5.Line;
8285
import com.webfirmframework.wffweb.tag.html.html5.MathTag;
86+
import com.webfirmframework.wffweb.tag.html.html5.Path;
87+
import com.webfirmframework.wffweb.tag.html.html5.Polygon;
88+
import com.webfirmframework.wffweb.tag.html.html5.Polyline;
89+
import com.webfirmframework.wffweb.tag.html.html5.Rect;
8390
import com.webfirmframework.wffweb.tag.html.html5.Source;
8491
import com.webfirmframework.wffweb.tag.html.html5.Svg;
8592
import com.webfirmframework.wffweb.tag.html.html5.Template;
93+
import com.webfirmframework.wffweb.tag.html.html5.Text;
8694
import com.webfirmframework.wffweb.tag.html.html5.Track;
8795
import com.webfirmframework.wffweb.tag.html.html5.Video;
8896
import com.webfirmframework.wffweb.tag.html.html5.audiovideo.Audio;
@@ -401,6 +409,22 @@ public class TagRegistry {
401409
H6.class.getSimpleName());
402410
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.PICTURE,
403411
Picture.class.getSimpleName());
412+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.RECT,
413+
Rect.class.getSimpleName());
414+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.CIRCLE,
415+
Circle.class.getSimpleName());
416+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.ELLIPSE,
417+
Ellipse.class.getSimpleName());
418+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.LINE,
419+
Line.class.getSimpleName());
420+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.POLYGON,
421+
Polygon.class.getSimpleName());
422+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.POLYLINE,
423+
Polyline.class.getSimpleName());
424+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.PATH,
425+
Path.class.getSimpleName());
426+
TAG_CLASS_NAME_BY_TAG_NAME.put(TagNameConstants.TEXT,
427+
Text.class.getSimpleName());
404428

405429
tagNames = new ArrayList<String>(initialCapacity);
406430
tagNamesSet = new HashSet<String>(initialCapacity);
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2014-2017 Web Firm Framework
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
* @author WFF
16+
*/
17+
package com.webfirmframework.wffweb.tag.html.html5;
18+
19+
import java.util.logging.Logger;
20+
21+
import com.webfirmframework.wffweb.settings.WffConfiguration;
22+
import com.webfirmframework.wffweb.tag.html.AbstractHtml;
23+
import com.webfirmframework.wffweb.tag.html.TagNameConstants;
24+
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
25+
import com.webfirmframework.wffweb.tag.html.html5.identifier.CircleAttributable;
26+
import com.webfirmframework.wffweb.tag.html.identifier.GlobalAttributable;
27+
28+
/**
29+
* @author WFF
30+
* @since 2.1.7
31+
* @version 1.0.0
32+
*
33+
*/
34+
public class Circle extends AbstractHtml {
35+
36+
private static final long serialVersionUID = 1_0_0L;
37+
38+
public static final Logger LOGGER = Logger
39+
.getLogger(Circle.class.getName());
40+
41+
{
42+
init();
43+
}
44+
45+
/**
46+
*
47+
* @param base
48+
* i.e. parent tag of this tag
49+
* @param attributes
50+
* An array of {@code AbstractAttribute}
51+
*
52+
*/
53+
public Circle(final AbstractHtml base,
54+
final AbstractAttribute... attributes) {
55+
super(TagNameConstants.CIRCLE, base, attributes);
56+
if (WffConfiguration.isDirectionWarningOn()) {
57+
warnForUnsupportedAttributes(attributes);
58+
}
59+
}
60+
61+
private static void warnForUnsupportedAttributes(
62+
final AbstractAttribute... attributes) {
63+
for (final AbstractAttribute abstractAttribute : attributes) {
64+
if (!(abstractAttribute != null
65+
&& (abstractAttribute instanceof CircleAttributable
66+
|| abstractAttribute instanceof GlobalAttributable))) {
67+
LOGGER.warning(abstractAttribute
68+
+ " is not an instance of CircleAttributable");
69+
}
70+
}
71+
}
72+
73+
/**
74+
* invokes only once per object
75+
*
76+
* @author WFF
77+
* @since 1.0.0
78+
*/
79+
protected void init() {
80+
// to override and use this method
81+
}
82+
83+
}

wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/html5/Data.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@ public class Data extends AbstractHtml {
4242
}
4343

4444
/**
45-
* Represents the root of an HTML or XHTML document. All other elements must
46-
* be descendants of this element.
4745
*
4846
* @param base
4947
* i.e. parent tag of this tag
5048
* @param attributes
5149
* An array of {@code AbstractAttribute}
5250
*
53-
* @since 1.0.0
5451
*/
5552
public Data(final AbstractHtml base,
5653
final AbstractAttribute... attributes) {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2014-2017 Web Firm Framework
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
* @author WFF
16+
*/
17+
package com.webfirmframework.wffweb.tag.html.html5;
18+
19+
import java.util.logging.Logger;
20+
21+
import com.webfirmframework.wffweb.settings.WffConfiguration;
22+
import com.webfirmframework.wffweb.tag.html.AbstractHtml;
23+
import com.webfirmframework.wffweb.tag.html.TagNameConstants;
24+
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute;
25+
import com.webfirmframework.wffweb.tag.html.html5.identifier.EllipseAttributable;
26+
import com.webfirmframework.wffweb.tag.html.identifier.GlobalAttributable;
27+
28+
/**
29+
* @author WFF
30+
* @since 2.1.7
31+
* @version 1.0.0
32+
*
33+
*/
34+
public class Ellipse extends AbstractHtml {
35+
36+
private static final long serialVersionUID = 1_0_0L;
37+
38+
public static final Logger LOGGER = Logger
39+
.getLogger(Ellipse.class.getName());
40+
41+
{
42+
init();
43+
}
44+
45+
/**
46+
*
47+
* @param base
48+
* i.e. parent tag of this tag
49+
* @param attributes
50+
* An array of {@code AbstractAttribute}
51+
*
52+
*/
53+
public Ellipse(final AbstractHtml base,
54+
final AbstractAttribute... attributes) {
55+
super(TagNameConstants.ELLIPSE, base, attributes);
56+
if (WffConfiguration.isDirectionWarningOn()) {
57+
warnForUnsupportedAttributes(attributes);
58+
}
59+
}
60+
61+
private static void warnForUnsupportedAttributes(
62+
final AbstractAttribute... attributes) {
63+
for (final AbstractAttribute abstractAttribute : attributes) {
64+
if (!(abstractAttribute != null
65+
&& (abstractAttribute instanceof EllipseAttributable
66+
|| abstractAttribute instanceof GlobalAttributable))) {
67+
LOGGER.warning(abstractAttribute
68+
+ " is not an instance of EllipseAttributable");
69+
}
70+
}
71+
}
72+
73+
/**
74+
* invokes only once per object
75+
*
76+
* @author WFF
77+
* @since 1.0.0
78+
*/
79+
protected void init() {
80+
// to override and use this method
81+
}
82+
83+
}

0 commit comments

Comments
 (0)