Package com.tagtraum.beatunes.inspection
Class InspectorCategory
- java.lang.Object
-
- com.tagtraum.beatunes.inspection.Inspector
-
- com.tagtraum.beatunes.inspection.InspectorCategory
-
- All Implemented Interfaces:
DetailView
,View
,ApplicationComponent<BeaTunes>
public class InspectorCategory extends Inspector
Aggregates multipleInspector
s in order to expose them together through the Inspector (class) interface. This makes InspectorCategory usable byInspectorView
.- Author:
- Hendrik Schreiber
-
-
Field Summary
-
Fields inherited from class com.tagtraum.beatunes.inspection.Inspector
propertyChangeSupport
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addIssue(Issue issue)
To be used by subclasses to add a single issue.protected void
addIssues(Collection<Issue<?>> issues)
To be used by subclasses to add multiple issues.void
cancel()
Called by the UI.protected void
clearIssues()
To be used by subclasses.protected Icon
createDisabledIcon()
protected Icon
createIcon()
String
getCategory()
Indicates the inspection's category or grouping.String
getDescription()
Inspector description.List<Inspector>
getInspectors()
static InspectorCategory
getInstance(Inspector inspector)
static List<InspectorCategory>
getInstances(BeaTunes application)
ListModel<Issue<?>>
getIssueModel()
List<Issue<?>>
getIssues()
List<Issue<?>>
getIssues(Long songId)
String
getName()
Inspector name.String
getPropertyName()
Indicates which property is inspected by this inspector.Solution
getSolution(String solutionId)
void
inspect(InspectionProgressListener inspectionProgressListener)
Inspects the given songs for problems of a specific kind.boolean
isAvailable()
Indicates whether this Inspector is available at all.boolean
isBeforeFirstInspection()
Indicates whether this this inspector has been used before.boolean
isCancelled()
Lets the Inspector check whether an ongoing inspection was cancelled by the user.boolean
isEnabled()
Is this inspector enabled?boolean
isPartiallyEnabled()
Indicates that someInspector
s are enabled while others aren't.int
issueCount()
Number of issues.void
removeIssue(Issue issue)
void
removeIssues(Collection<Issue<?>> issues)
void
setAvailable(boolean available)
Sets availability.void
setEnabled(boolean enabled)
Enables/disables this inspector.-
Methods inherited from class com.tagtraum.beatunes.inspection.Inspector
addPropertyChangeListener, checkInterruption, getApplication, getComponent, getFocusRoot, getIcon, getId, getInspection, getInspectionProgress, getInspectorCategory, getInspectorView, getStatusLabel, init, isIndeterminateProgress, isInspecting, performInspection, performInspection, refreshLocations, removePropertyChangeListener, setApplication, setInspectionProgress, shutdown, toString
-
-
-
-
Method Detail
-
createIcon
protected Icon createIcon()
- Overrides:
createIcon
in classInspector
-
createDisabledIcon
protected Icon createDisabledIcon()
- Overrides:
createDisabledIcon
in classInspector
-
getInstance
public static InspectorCategory getInstance(Inspector inspector)
-
getInstances
public static List<InspectorCategory> getInstances(BeaTunes application)
-
isBeforeFirstInspection
public boolean isBeforeFirstInspection()
Description copied from class:Inspector
Indicates whether this this inspector has been used before.- Overrides:
isBeforeFirstInspection
in classInspector
- Returns:
- true or false
-
getCategory
public String getCategory()
Description copied from class:Inspector
Indicates the inspection's category or grouping. By default this returnsGENERAL
.- Overrides:
getCategory
in classInspector
- Returns:
- category, by default General
-
getDescription
public String getDescription()
Description copied from class:Inspector
Inspector description.- Specified by:
getDescription
in classInspector
- Returns:
- long description about this inspector meant for the UI
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from class:Inspector
Enables/disables this inspector.- Overrides:
setEnabled
in classInspector
- Parameters:
enabled
- true or false
-
isEnabled
public boolean isEnabled()
Description copied from class:Inspector
Is this inspector enabled?
-
isPartiallyEnabled
public boolean isPartiallyEnabled()
Description copied from class:Inspector
Indicates that someInspector
s are enabled while others aren't. Only meaningful forInspectorCategory
. Default returnsfalse
.- Overrides:
isPartiallyEnabled
in classInspector
- Returns:
- true or false
-
setAvailable
public void setAvailable(boolean available)
Description copied from class:Inspector
Sets availability.- Overrides:
setAvailable
in classInspector
- Parameters:
available
- true or false- See Also:
Inspector.isAvailable()
-
isAvailable
public boolean isAvailable()
Description copied from class:Inspector
Indicates whether this Inspector is available at all. E.g. an Inspector could be unavailable for libraries specified byFileSystemLibraryDescriptor
, but available for iTunes specific libraries (ITunesLibraryDescriptor
). Or available for macOS, but not for Windows....- Overrides:
isAvailable
in classInspector
- Returns:
- true or false
-
inspect
public void inspect(InspectionProgressListener inspectionProgressListener)
Description copied from class:Inspector
Inspects the given songs for problems of a specific kind. Found issues are accessible through the issues property. Implementations need to add issues usingInspector.addIssue(Issue)
. If this is a long running inspection, you might want to checkInspector.isCancelled()
every now and then and abort the inspection should the method returntrue
. Note that this method is called in a separate thread, i.e. not the event dispatch thread. You can report progress throughInspectionProgressListener.progress(Inspector, String, float)
.- Specified by:
inspect
in classInspector
- Parameters:
inspectionProgressListener
- progress listener- See Also:
Inspector.getIssues()
,Inspector.addIssue(Issue)
,Inspector.isCancelled()
-
getPropertyName
public String getPropertyName()
Description copied from class:Inspector
Indicates which property is inspected by this inspector. This will be used when highlighting said property in views of a song that has issues.- Specified by:
getPropertyName
in classInspector
- Returns:
- property name
-
issueCount
public int issueCount()
Description copied from class:Inspector
Number of issues. This property can be followed by adding a property change listener.- Overrides:
issueCount
in classInspector
- Returns:
- number of current issues
-
addIssue
protected void addIssue(Issue issue)
Description copied from class:Inspector
To be used by subclasses to add a single issue. Issues may be ignore, ifInspection.ignore(Issue)
returns true.- Overrides:
addIssue
in classInspector
- Parameters:
issue
- issue- See Also:
Inspector.addIssues(java.util.Collection)
-
addIssues
protected void addIssues(Collection<Issue<?>> issues)
Description copied from class:Inspector
To be used by subclasses to add multiple issues. This method is a lot more efficient thanInspector.addIssue(Issue)
when adding a lot of issues, because the UI is only updated once and not for every single issue individually. Issues may be ignore, ifInspection.ignore(Issue)
returns true.
-
removeIssue
public void removeIssue(Issue issue)
- Overrides:
removeIssue
in classInspector
-
removeIssues
public void removeIssues(Collection<Issue<?>> issues)
- Overrides:
removeIssues
in classInspector
-
clearIssues
protected void clearIssues()
Description copied from class:Inspector
To be used by subclasses. Should be called before rebuilding the issue list. This also resets the cancel flag tofalse
.- Overrides:
clearIssues
in classInspector
- See Also:
Inspector.isCancelled()
-
cancel
public void cancel()
Description copied from class:Inspector
Called by the UI. Do not call this yourself.
-
isCancelled
public boolean isCancelled()
Description copied from class:Inspector
Lets the Inspector check whether an ongoing inspection was cancelled by the user.- Overrides:
isCancelled
in classInspector
- Returns:
- true, of the user cancelled the inspection
- See Also:
Inspector.clearIssues()
-
getIssueModel
public ListModel<Issue<?>> getIssueModel()
- Overrides:
getIssueModel
in classInspector
-
getSolution
public Solution getSolution(String solutionId)
- Overrides:
getSolution
in classInspector
-
-