1 19 package org.openharmonise.him.swing.resourcetree; 20 21 import org.openharmonise.vfs.*; 22 23 32 public abstract class AbstractResourceFilter { 33 34 37 private boolean m_bShowCollectionsOnly = false; 38 39 42 private boolean m_bShowLiveResourcesOnly = false; 43 44 47 public AbstractResourceFilter() { 48 super(); 49 } 50 51 56 public void setShowCollectionsOnly(boolean bShowCollectionsOnly) { 57 this.m_bShowCollectionsOnly = bShowCollectionsOnly; 58 } 59 60 65 public boolean isShowCollectionsOnly() { 66 return this.m_bShowCollectionsOnly; 67 } 68 69 74 public void setShowLiveResourcesOnly(boolean bShowLiveResourcesOnly) { 75 this.m_bShowLiveResourcesOnly = bShowLiveResourcesOnly; 76 } 77 78 83 public boolean isShowLiveResourcesOnly() { 84 return this.m_bShowLiveResourcesOnly; 85 } 86 87 93 public boolean showResource(VirtualFile vfFile) { 94 boolean bShowResource = true; 95 96 if(this.m_bShowCollectionsOnly && !vfFile.isDirectory()) { 97 bShowResource = false; 98 } 99 100 if(bShowResource 101 && this.m_bShowLiveResourcesOnly 102 && vfFile.isVersionable() 103 && !vfFile.getState().equals(VirtualFile.STATE_LIVE)) { 104 bShowResource = false; 105 } 106 107 if(bShowResource 108 && !this.checkResource(vfFile)) { 109 bShowResource = false; 110 } 111 112 return bShowResource; 113 } 114 115 121 protected abstract boolean checkResource(VirtualFile vfFile); 122 } 123 | Popular Tags |