KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > htmlparser > ToRemoveMarkupSetting


1 package org.jahia.services.htmlparser;
2
3 import org.jahia.registries.ServicesRegistry;
4
5 /**
6  *
7  * <p>Title: Html Markup to be removed when parsing an html document</p>
8  * <p>Description: Html Markup to be removed when parsing an html document</p>
9  * <p>Copyright: Copyright (c) 2002</p>
10  * <p>Company: </p>
11  * @author Khue Nguyen
12  * @version 1.0
13  */

14 public class ToRemoveMarkupSetting extends MarkupSetting {
15
16     public static final String JavaDoc SETTING_TYPE = "TO_REMOVE_MARKUP_SETTING";
17
18     private MarkupDefinition markupDefinition = null;
19
20     public ToRemoveMarkupSetting(int markupDefId){
21         super(SETTING_TYPE,markupDefId);
22     }
23
24     public ToRemoveMarkupSetting(MarkupSetting setting){
25         super(SETTING_TYPE,setting.getMarkupDefId());
26         this.setSettingId(setting.getSettingId());
27         this.setApplyToAllSite(setting.applyToAllSite());
28         this.setProperties(setting.getProperties());
29         this.getSites().addAll(setting.getSites());
30         this.markupDefinition = ServicesRegistry.getInstance().getHtmlParserService()
31                   .getMarkupDefinition(this.getMarkupDefId());
32     }
33
34     public MarkupDefinition getMarkupDefinition(){
35         return this.markupDefinition;
36     }
37
38     public int compare(Object JavaDoc obj1, Object JavaDoc obj2){
39         ToRemoveMarkupSetting item1 = (ToRemoveMarkupSetting)obj1;
40         ToRemoveMarkupSetting item2 = (ToRemoveMarkupSetting)obj2;
41         if ( item1.getMarkupDefinition() != null
42              && item2.getMarkupDefinition() != null ){
43             return item1.getMarkupDefinition().getName()
44                     .compareTo(item2.getMarkupDefinition().getName());
45         }
46
47         Integer JavaDoc val1 = new Integer JavaDoc(item1.getSettingId());
48         Integer JavaDoc val2 = new Integer JavaDoc(item2.getSettingId());
49         return ( val1.compareTo(val2) );
50     }
51
52 }
53
54
Popular Tags