Gridarta Editor
ErrorViewCollector.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.errorview;
21 
22 import java.io.File;
23 import java.net.URL;
24 import org.jetbrains.annotations.NotNull;
25 
31 public class ErrorViewCollector {
32 
36  @NotNull
37  private final ErrorView errorView;
38 
42  @NotNull
43  private final String file;
44 
50  public ErrorViewCollector(@NotNull final ErrorView errorView, @NotNull final File file) {
51  this.errorView = errorView;
52  this.file = file.getPath();
53  }
54 
60  public ErrorViewCollector(@NotNull final ErrorView errorView, @NotNull final URL url) {
61  this(errorView, new File(url.toString()));
62  }
63 
68  public void addWarning(@NotNull final ErrorViewCategory category) {
69  errorView.addWarning(category, file);
70  }
71 
77  public void addWarning(@NotNull final ErrorViewCategory category, @NotNull final String message) {
78  errorView.addWarning(category, file + ": " + message);
79  }
80 
87  public void addWarning(@NotNull final ErrorViewCategory category, final int lineNo, @NotNull final String message) {
88  errorView.addWarning(category, lineNo, file + ": " + message);
89  }
90 
95  public void addError(@NotNull final ErrorViewCategory category) {
96  errorView.addError(category, file);
97  }
98 
104  public void addError(@NotNull final ErrorViewCategory category, @NotNull final String message) {
105  errorView.addError(category, file + ": " + message);
106  }
107 
114  public void addError(@NotNull final ErrorViewCategory category, final int lineNo, @NotNull final String message) {
115  errorView.addError(category, lineNo, file + ": " + message);
116  }
117 
118 }
net.sf.gridarta.model.errorview.ErrorViewCollector.addWarning
void addWarning(@NotNull final ErrorViewCategory category)
Adds a warning message.
Definition: ErrorViewCollector.java:68
net.sf.gridarta.model.errorview.ErrorViewCollector.addError
void addError(@NotNull final ErrorViewCategory category, final int lineNo, @NotNull final String message)
Adds an error message.
Definition: ErrorViewCollector.java:114
net.sf.gridarta.model.errorview.ErrorViewCollector.errorView
final ErrorView errorView
The ErrorView to add to.
Definition: ErrorViewCollector.java:37
net.sf.gridarta.model.errorview.ErrorView.addWarning
void addWarning(@NotNull ErrorViewCategory categoryName, @NotNull String message)
Adds a warning message.
net.sf.gridarta.model.errorview.ErrorView
Interface for classes displaying error messages.
Definition: ErrorView.java:28
net.sf.gridarta.model.errorview.ErrorViewCollector.ErrorViewCollector
ErrorViewCollector(@NotNull final ErrorView errorView, @NotNull final URL url)
Creates a new instance.
Definition: ErrorViewCollector.java:60
net.sf.gridarta.model.errorview.ErrorViewCollector.addWarning
void addWarning(@NotNull final ErrorViewCategory category, final int lineNo, @NotNull final String message)
Adds a warning message.
Definition: ErrorViewCollector.java:87
net.sf.gridarta.model.errorview.ErrorViewCollector.addError
void addError(@NotNull final ErrorViewCategory category, @NotNull final String message)
Adds an error message.
Definition: ErrorViewCollector.java:104
net.sf.gridarta.model.errorview.ErrorViewCollector
Convenience class for adding messages to a ErrorView instance using a fixed category name.
Definition: ErrorViewCollector.java:31
net.sf.gridarta.model.errorview.ErrorViewCollector.ErrorViewCollector
ErrorViewCollector(@NotNull final ErrorView errorView, @NotNull final File file)
Creates a new instance.
Definition: ErrorViewCollector.java:50
net.sf.gridarta.model.errorview.ErrorView.addError
void addError(@NotNull ErrorViewCategory categoryName, @NotNull String message)
Adds an error message.
net.sf.gridarta.model.errorview.ErrorViewCategory
Defines possible error categories for ErrorView instances.
Definition: ErrorViewCategory.java:28
net.sf.gridarta.model.errorview.ErrorViewCollector.addWarning
void addWarning(@NotNull final ErrorViewCategory category, @NotNull final String message)
Adds a warning message.
Definition: ErrorViewCollector.java:77
net.sf.gridarta.model.errorview.ErrorViewCollector.addError
void addError(@NotNull final ErrorViewCategory category)
Adds an error message.
Definition: ErrorViewCollector.java:95
net.sf.gridarta.model.errorview.ErrorViewCollector.file
final String file
The file being read.
Definition: ErrorViewCollector.java:43