server.desktop.DesktopServer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-desktop Show documentation
Show all versions of server-desktop Show documentation
Framework for delivering desktop application updates
The newest version!
package server.desktop;
import server.core.AppLogger;
import server.embedded.*;
import javax.swing.*;
import java.io.File;
import java.util.List;
public final class DesktopServer {
private final EmbeddedHttpContainer container;
public DesktopServer(AppLogger mainLogger, EmbeddedServer server) {
this.container = new EmbeddedHttpContainer(mainLogger, server);
}
public DesktopServer(EmbeddedServer server) {
this(new EmbeddedLogger(), server);
}
public void showError(String message) {
container.error(message);
ServerFrame.showError(message);
}
public void showError(Throwable ex) {
container.error(ex);
ServerFrame.showError(ex.toString());
}
public void runServer(String[] args, AppLogin login, List comps) {
FrameBuilder builder = new FrameBuilder(container);
builder.build(args, login, comps);
showFrame(builder);
}
public void runServer(Integer port, String context, File rootDir, AppLogin login, List comps) {
FrameBuilder builder = new FrameBuilder(container);
builder.build(port, context, rootDir, login, comps);
showFrame(builder);
}
private void showFrame(FrameBuilder builder) {
SwingUtilities.invokeLater(() -> new ServerFrame(container, builder.tab));
}
}