public clean method, and broke out add log messages method
This commit is contained in:
parent
08ba0b83dc
commit
681b40c3c1
|
@ -437,21 +437,7 @@ public class LogListener extends VisPlugin {
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
public void newLogOutput(LogOutputEvent ev) {
|
public void newLogOutput(LogOutputEvent ev) {
|
||||||
/* Display new log output */
|
registerNewLogOutput(ev);
|
||||||
if (!hasHours && ev.getTime() > TIME_HOUR) {
|
|
||||||
hasHours = true;
|
|
||||||
repaintTimeColumn();
|
|
||||||
}
|
|
||||||
LogData data = new LogData(ev);
|
|
||||||
logUpdateAggregator.add(data);
|
|
||||||
if (appendToFile) {
|
|
||||||
appendToFile(appendStreamFile,
|
|
||||||
data.getTime() + "\t" +
|
|
||||||
data.getID() + "\t" +
|
|
||||||
data.ev.getMessage() + "\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void removedLogOutput(LogOutputEvent ev) {
|
public void removedLogOutput(LogOutputEvent ev) {
|
||||||
}
|
}
|
||||||
|
@ -500,6 +486,28 @@ public class LogListener extends VisPlugin {
|
||||||
setLocation(0, gui.getDesktopPane().getHeight() - 300);
|
setLocation(0, gui.getDesktopPane().getHeight() - 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerNewLogOutput(Mote mote, long time, String msg) {
|
||||||
|
LogOutputEvent ev = new LogOutputEvent(mote, time, msg);
|
||||||
|
registerNewLogOutput(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerNewLogOutput(LogOutputEvent ev) {
|
||||||
|
/* Display new log output */
|
||||||
|
if (!hasHours && ev.getTime() > TIME_HOUR) {
|
||||||
|
hasHours = true;
|
||||||
|
repaintTimeColumn();
|
||||||
|
}
|
||||||
|
LogData data = new LogData(ev);
|
||||||
|
logUpdateAggregator.add(data);
|
||||||
|
if (appendToFile) {
|
||||||
|
appendToFile(appendStreamFile,
|
||||||
|
data.getTime() + "\t" +
|
||||||
|
data.getID() + "\t" +
|
||||||
|
data.ev.getMessage() + "\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void repaintTimeColumn() {
|
private void repaintTimeColumn() {
|
||||||
logTable.getColumnModel().getColumn(COLUMN_TIME).setHeaderValue(
|
logTable.getColumnModel().getColumn(COLUMN_TIME).setHeaderValue(
|
||||||
logTable.getModel().getColumnName(COLUMN_TIME));
|
logTable.getModel().getColumnName(COLUMN_TIME));
|
||||||
|
@ -872,14 +880,18 @@ public class LogListener extends VisPlugin {
|
||||||
private static final long serialVersionUID = -2115620313183440224L;
|
private static final long serialVersionUID = -2115620313183440224L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
int size = logs.size();
|
clear();
|
||||||
if (size > 0) {
|
|
||||||
logs.clear();
|
|
||||||
model.fireTableRowsDeleted(0, size - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
int size = logs.size();
|
||||||
|
if (size > 0) {
|
||||||
|
logs.clear();
|
||||||
|
model.fireTableRowsDeleted(0, size - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Action copyAction = new AbstractAction("Selected") {
|
private Action copyAction = new AbstractAction("Selected") {
|
||||||
private static final long serialVersionUID = -8433490108577001803L;
|
private static final long serialVersionUID = -8433490108577001803L;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue