Skip to content

Commit 692a61d

Browse files
committed
javadoc fixes, source cleanup
1 parent 0441de4 commit 692a61d

16 files changed

+256
-199
lines changed

src/main/java/com/gargoylesoftware/css/dom/CSSCharsetRuleImpl.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public class CSSCharsetRuleImpl extends AbstractCSSRuleImpl {
3333

3434
private String encoding_;
3535

36+
/**
37+
* Ctor.
38+
*
39+
* @param parentStyleSheet the parent style sheet
40+
* @param parentRule the parent rule
41+
* @param encoding the encoding
42+
*/
3643
public CSSCharsetRuleImpl(
3744
final CSSStyleSheetImpl parentStyleSheet,
3845
final AbstractCSSRuleImpl parentRule,
@@ -47,13 +54,6 @@ public CSSCharsetRuleImpl(
4754
* @throws DOMException in case of error
4855
*/
4956
public void setCssText(final String cssText) throws DOMException {
50-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
51-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
52-
throw new DOMExceptionImpl(
53-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
54-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
55-
}
56-
5757
try {
5858
final InputSource is = new InputSource(new StringReader(cssText));
5959
final CSSOMParser parser = new CSSOMParser();
@@ -83,14 +83,13 @@ public void setCssText(final String cssText) throws DOMException {
8383
}
8484
}
8585

86+
/**
87+
* @return the encoding
88+
*/
8689
public String getEncoding() {
8790
return encoding_;
8891
}
8992

90-
public void setEncoding(final String encoding) throws DOMException {
91-
encoding_ = encoding;
92-
}
93-
9493
@Override
9594
public boolean equals(final Object obj) {
9695
if (this == obj) {
@@ -116,6 +115,9 @@ public String toString() {
116115
return getCssText();
117116
}
118117

118+
/**
119+
* @return the current css text
120+
*/
119121
public String getCssText() {
120122
final StringBuilder sb = new StringBuilder();
121123

src/main/java/com/gargoylesoftware/css/dom/CSSFontFaceRuleImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ public String getCssText() {
6363
* @throws DOMException in case of error
6464
*/
6565
public void setCssText(final String cssText) throws DOMException {
66-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
67-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
68-
throw new DOMExceptionImpl(
69-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
70-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
71-
}
72-
7366
try {
7467
final InputSource is = new InputSource(new StringReader(cssText));
7568
final CSSOMParser parser = new CSSOMParser();

src/main/java/com/gargoylesoftware/css/dom/CSSImportRuleImpl.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public class CSSImportRuleImpl extends AbstractCSSRuleImpl {
3434
private String href_;
3535
private MediaListImpl media_;
3636

37-
public void setHref(final String href) {
38-
href_ = href;
39-
}
40-
41-
public void setMedia(final MediaListImpl media) {
42-
media_ = media;
43-
}
44-
37+
/**
38+
* Ctor.
39+
*
40+
* @param parentStyleSheet the parent style sheet
41+
* @param parentRule the parent rule
42+
* @param href the href
43+
* @param media the media
44+
*/
4545
public CSSImportRuleImpl(
4646
final CSSStyleSheetImpl parentStyleSheet,
4747
final AbstractCSSRuleImpl parentRule,
@@ -78,13 +78,6 @@ public String getCssText() {
7878
* @throws DOMException in case of error
7979
*/
8080
public void setCssText(final String cssText) throws DOMException {
81-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
82-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
83-
throw new DOMExceptionImpl(
84-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
85-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
86-
}
87-
8881
try {
8982
final InputSource is = new InputSource(new StringReader(cssText));
9083
final CSSOMParser parser = new CSSOMParser();
@@ -115,14 +108,23 @@ public void setCssText(final String cssText) throws DOMException {
115108
}
116109
}
117110

111+
/**
112+
* @return the href
113+
*/
118114
public String getHref() {
119115
return href_;
120116
}
121117

118+
/**
119+
* @return the media lsit
120+
*/
122121
public MediaListImpl getMedia() {
123122
return media_;
124123
}
125124

125+
/**
126+
* @return the parent style sheet
127+
*/
126128
public CSSStyleSheetImpl getStyleSheet() {
127129
return getParentStyleSheet();
128130
}

src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ public String getCssText() {
7373
* @throws DOMException in case of error
7474
*/
7575
public void setCssText(final String cssText) throws DOMException {
76-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
77-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
78-
throw new DOMExceptionImpl(
79-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
80-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
81-
}
82-
8376
try {
8477
final InputSource is = new InputSource(new StringReader(cssText));
8578
final CSSOMParser parser = new CSSOMParser();
@@ -135,11 +128,6 @@ public CSSRuleListImpl getCssRules() {
135128
*/
136129
public void insertRule(final String rule, final int index) throws DOMException {
137130
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
138-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
139-
throw new DOMExceptionImpl(
140-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
141-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
142-
}
143131

144132
try {
145133
final InputSource is = new InputSource(new StringReader(rule));
@@ -178,12 +166,6 @@ public void insertRule(final String rule, final int index) throws DOMException {
178166
* @throws DOMException in case of error
179167
*/
180168
public void deleteRule(final int index) throws DOMException {
181-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
182-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
183-
throw new DOMExceptionImpl(
184-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
185-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
186-
}
187169
try {
188170
getCssRules().delete(index);
189171
}

src/main/java/com/gargoylesoftware/css/dom/CSSPageRuleImpl.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ public class CSSPageRuleImpl extends AbstractCSSRuleImpl {
3434
private String pseudoPage_;
3535
private CSSStyleDeclarationImpl style_;
3636

37+
/**
38+
* Ctor.
39+
*
40+
* @param parentStyleSheet the parent style sheet
41+
* @param parentRule the parent rule
42+
* @param pseudoPage the pseudo page
43+
*/
3744
public CSSPageRuleImpl(
3845
final CSSStyleSheetImpl parentStyleSheet,
3946
final AbstractCSSRuleImpl parentRule,
@@ -70,13 +77,6 @@ public String getCssText() {
7077
* @throws DOMException in case of error
7178
*/
7279
public void setCssText(final String cssText) throws DOMException {
73-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
74-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
75-
throw new DOMExceptionImpl(
76-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
77-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
78-
}
79-
8080
try {
8181
final InputSource is = new InputSource(new StringReader(cssText));
8282
final CSSOMParser parser = new CSSOMParser();
@@ -107,21 +107,27 @@ public void setCssText(final String cssText) throws DOMException {
107107
}
108108
}
109109

110+
/**
111+
* @return the selector text
112+
*/
110113
public String getSelectorText() {
111114
if (null == pseudoPage_) {
112115
return "";
113116
}
114117
return pseudoPage_;
115118
}
116119

120+
/**
121+
* @return the style
122+
*/
117123
public CSSStyleDeclarationImpl getStyle() {
118124
return style_;
119125
}
120126

121-
public void setPseudoPage(final String pseudoPage) {
122-
pseudoPage_ = pseudoPage;
123-
}
124-
127+
/**
128+
* Changes the style.
129+
* @param style the new style
130+
*/
125131
public void setStyle(final CSSStyleDeclarationImpl style) {
126132
style_ = style;
127133
}

src/main/java/com/gargoylesoftware/css/dom/CSSStyleDeclarationImpl.java

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ public class CSSStyleDeclarationImpl implements Serializable {
3737
private AbstractCSSRuleImpl parentRule_;
3838
private List<Property> properties_ = new ArrayList<Property>();
3939

40-
public void setParentRule(final AbstractCSSRuleImpl parentRule) {
40+
/**
41+
* Ctor.
42+
*
43+
* @param parentRule the parent role
44+
*/
45+
public CSSStyleDeclarationImpl(final AbstractCSSRuleImpl parentRule) {
4146
parentRule_ = parentRule;
4247
}
4348

49+
/**
50+
* @return the properties
51+
*/
4452
public List<Property> getProperties() {
4553
return properties_;
4654
}
4755

48-
public void setProperties(final List<Property> properties) {
49-
properties_ = properties;
50-
}
51-
52-
public CSSStyleDeclarationImpl(final AbstractCSSRuleImpl parentRule) {
53-
parentRule_ = parentRule;
54-
}
55-
5656
/**
5757
* {@inheritDoc}
5858
*/
@@ -91,6 +91,10 @@ public void setCssText(final String cssText) throws DOMException {
9191
}
9292
}
9393

94+
/**
95+
* @param propertyName the property name
96+
* @return the property value
97+
*/
9498
public String getPropertyValue(final String propertyName) {
9599
final Property p = getPropertyDeclaration(propertyName);
96100
if (p == null || p.getValue() == null) {
@@ -99,11 +103,22 @@ public String getPropertyValue(final String propertyName) {
99103
return p.getValue().toString();
100104
}
101105

106+
/**
107+
* @param propertyName the property name
108+
* @return the property value
109+
*/
102110
public CSSValueImpl getPropertyCSSValue(final String propertyName) {
103111
final Property p = getPropertyDeclaration(propertyName);
104112
return (p == null) ? null : p.getValue();
105113
}
106114

115+
/**
116+
* Remove a property.
117+
*
118+
* @param propertyName the property name
119+
* @return the removed property
120+
* @throws DOMException in case of error
121+
*/
107122
public String removeProperty(final String propertyName) throws DOMException {
108123
if (null == propertyName) {
109124
return "";
@@ -121,6 +136,10 @@ public String removeProperty(final String propertyName) throws DOMException {
121136
return "";
122137
}
123138

139+
/**
140+
* @param propertyName the name of the property
141+
* @return the priority
142+
*/
124143
public String getPropertyPriority(final String propertyName) {
125144
final Property p = getPropertyDeclaration(propertyName);
126145
if (p == null) {
@@ -129,6 +148,13 @@ public String getPropertyPriority(final String propertyName) {
129148
return p.isImportant() ? PRIORITY_IMPORTANT : "";
130149
}
131150

151+
/**
152+
* Set a property.
153+
* @param propertyName the name of the property
154+
* @param value the new value
155+
* @param priority the priority
156+
* @throws DOMException in case of error
157+
*/
132158
public void setProperty(
133159
final String propertyName,
134160
final String value,
@@ -159,21 +185,35 @@ public void setProperty(
159185
}
160186
}
161187

188+
/**
189+
* @return the properties count
190+
*/
162191
public int getLength() {
163192
return properties_.size();
164193
}
165194

195+
/**
196+
* @return the parent rule
197+
*/
166198
public AbstractCSSRuleImpl getParentRule() {
167199
return parentRule_;
168200
}
169201

202+
/**
203+
* Add a property.
204+
* @param p the property to add
205+
*/
170206
public void addProperty(final Property p) {
171207
if (null == p) {
172208
return;
173209
}
174210
properties_.add(p);
175211
}
176212

213+
/**
214+
* @param propertyName the name of the propery
215+
* @return the property
216+
*/
177217
public Property getPropertyDeclaration(final String propertyName) {
178218
if (null == propertyName) {
179219
return null;

src/main/java/com/gargoylesoftware/css/dom/CSSStyleRuleImpl.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@ public String getCssText() {
8787
* @throws DOMException in case of error
8888
*/
8989
public void setCssText(final String cssText) throws DOMException {
90-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
91-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
92-
throw new DOMExceptionImpl(
93-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
94-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
95-
}
96-
9790
try {
9891
final InputSource is = new InputSource(new StringReader(cssText));
9992
final CSSOMParser parser = new CSSOMParser();
@@ -137,13 +130,6 @@ public String getSelectorText() {
137130
* @throws DOMException in clase of error
138131
*/
139132
public void setSelectorText(final String selectorText) throws DOMException {
140-
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
141-
if (parentStyleSheet != null && parentStyleSheet.isReadOnly()) {
142-
throw new DOMExceptionImpl(
143-
DOMException.NO_MODIFICATION_ALLOWED_ERR,
144-
DOMExceptionImpl.READ_ONLY_STYLE_SHEET);
145-
}
146-
147133
try {
148134
final InputSource is = new InputSource(new StringReader(selectorText));
149135
final CSSOMParser parser = new CSSOMParser();

0 commit comments

Comments
 (0)