package svgdevicestest.maps.SVG;
|
|
import java.awt.BorderLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.io.File;
|
import java.nio.file.Files;
|
import javax.swing.JFrame;
|
import javax.swing.Timer;
|
|
|
|
public class WindowMapSchema extends JFrame
|
{
|
private PanelMapSchema panelMapSchema = null;
|
private Timer timer = null;
|
private long timestamp = 0;
|
|
public WindowMapSchema()
|
{
|
try
|
{
|
ModelFile modelfile = new ModelFile();
|
modelfile.folder = "c:/temp7";
|
modelfile.name = "Corridor";
|
modelfile.dataJAVA = Files.readAllBytes(new File("c:/temp7/Corridor.java").toPath());
|
modelfile.dataSVG = Files.readAllBytes(new File("c:/temp7/Corridor.svg").toPath());
|
timestamp = new File("c:/temp7/Corridor.java").lastModified();
|
timestamp = Math.max(timestamp, new File("c:/temp7/Corridor.svg").lastModified());
|
|
panelMapSchema = new PanelMapSchema();
|
panelMapSchema.MapSchemaWindowPanel(modelfile);
|
this.getContentPane().setLayout(new BorderLayout());
|
this.getContentPane().add(panelMapSchema, BorderLayout.CENTER);
|
this.setSize(1920, 1080);
|
this.setLocation(1920, 0);
|
this.setVisible(true);
|
|
timer = new Timer(1000, new ActionListener()
|
{
|
public void actionPerformed(ActionEvent evt)
|
{
|
try
|
{
|
long newtimestamp = new File("c:/temp7/Corridor.java").lastModified();
|
newtimestamp = Math.max(newtimestamp, new File("c:/temp7/Corridor.svg").lastModified());
|
|
if (newtimestamp > timestamp)
|
{
|
WindowMapSchema.this.getContentPane().remove(panelMapSchema);
|
|
ModelFile modelfile = new ModelFile();
|
modelfile.folder = "c:/temp7";
|
modelfile.name = "Corridor";
|
modelfile.dataJAVA = Files.readAllBytes(new File("c:/temp7/Corridor.java").toPath());
|
modelfile.dataSVG = Files.readAllBytes(new File("c:/temp7/Corridor.svg").toPath());
|
panelMapSchema = new PanelMapSchema();
|
panelMapSchema.MapSchemaWindowPanel(modelfile);
|
WindowMapSchema.this.getContentPane().add(panelMapSchema, BorderLayout.CENTER);
|
WindowMapSchema.this.revalidate();
|
WindowMapSchema.this.repaint();
|
timestamp = newtimestamp;
|
}
|
}
|
catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
|
panelMapSchema.timer();
|
}
|
});
|
|
timer.start();
|
|
|
}
|
catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
}
|
}
|