Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New GUI Look and Feel #149

Merged
merged 106 commits into from
Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
c4c04f5
initial commit for new laf
clausnagel Nov 13, 2020
a75734f
merged File and Project menu entries
clausnagel Nov 13, 2020
900d14e
swingx components now also support the laf
clausnagel Nov 14, 2020
7a4c9b0
adapted DatePicker
clausnagel Nov 14, 2020
e073225
defaultFont is FlatLaf specific
clausnagel Nov 14, 2020
851e7b8
adapted console for new laf
clausnagel Nov 14, 2020
dc488b0
use less borders in main layout
clausnagel Nov 14, 2020
e91b6fb
first changes to preferences tab
clausnagel Nov 14, 2020
e0a40d1
use iconTextGap from laf
clausnagel Nov 15, 2020
4ebd89c
first rework of import tab
clausnagel Nov 15, 2020
0a85ffe
minor change to DatePicker
clausnagel Nov 15, 2020
df0c5fa
updated checkbox tree to work with new laf
clausnagel Nov 15, 2020
1eac069
updated FlatLaf
clausnagel Nov 16, 2020
29f9f18
minimize feature class tree if not needed
clausnagel Nov 16, 2020
4073177
RSyntaxTextArea now supports laf
clausnagel Nov 16, 2020
ba306fa
minor change
clausnagel Nov 16, 2020
80a4d4f
first rework of export tab
clausnagel Nov 16, 2020
9ed501e
Merge branch 'cli-rework' into gui-new-laf
clausnagel Nov 16, 2020
132b234
Merge branch 'cli-rework' into gui-new-laf
clausnagel Nov 16, 2020
93db2ae
more changes to export tab
clausnagel Nov 16, 2020
5b0b2f4
fixed status separator and splash screen
clausnagel Nov 17, 2020
20c44a8
minor change
clausnagel Nov 17, 2020
d0f173d
minor change to export tab and TitledPanel component
clausnagel Nov 17, 2020
c8e1952
first changes to database tab
clausnagel Nov 17, 2020
2a602b3
more changes to database tab
clausnagel Nov 17, 2020
22b7a53
minor change
clausnagel Nov 17, 2020
94ab5c5
Merge branch 'cli-rework' into gui-new-laf
clausnagel Nov 18, 2020
a9e41ed
Merge branch 'cli-rework' into gui-new-laf
clausnagel Nov 18, 2020
6cb65ea
first rework of KML export tab
clausnagel Nov 18, 2020
462f1c1
minor fix
clausnagel Nov 18, 2020
f79fbc6
adapted general preferences layout
clausnagel Nov 18, 2020
5345b4c
minor change
clausnagel Nov 18, 2020
0b70bc4
first version of adapted import preferences
clausnagel Nov 19, 2020
91f7166
minor fix
clausnagel Nov 19, 2020
5fc8afa
first version of adapted export preferences
clausnagel Nov 19, 2020
db6c299
adapted database preferences
clausnagel Nov 19, 2020
517091f
first version of adapted general preferences
clausnagel Nov 20, 2020
87d4dd5
removed JSONP from KML export options
clausnagel Nov 20, 2020
3ccc69c
deprecated option to export one object per tile for KML exports
clausnagel Nov 20, 2020
88f2c23
simplifying KML preferences
clausnagel Nov 20, 2020
5df75e5
more simplification
clausnagel Nov 20, 2020
486690f
more simplification
clausnagel Nov 20, 2020
ed758fe
more simplification - intermediate step
clausnagel Nov 20, 2020
43e649f
more simplification - intermediate step
clausnagel Nov 20, 2020
423a066
intermediate commit
clausnagel Nov 20, 2020
7ad3747
collada options are now global and not on a per-feature-basis anymore
clausnagel Nov 20, 2020
571067e
removed collada options from styling preferences
clausnagel Nov 20, 2020
adecb5a
more simplification
clausnagel Nov 20, 2020
b5ba383
DisplayForm is not managed in lists anymore
clausnagel Nov 21, 2020
71f724d
separated DisplayForm from styles
clausnagel Nov 21, 2020
54b5974
minor change
clausnagel Nov 21, 2020
eca2c78
first rework of KML style preferences
clausnagel Nov 22, 2020
b75ae62
added ColorPicker
clausnagel Nov 22, 2020
85e489e
minor change
clausnagel Nov 22, 2020
bbea757
first rework of general preferences dialog for KML exports
clausnagel Nov 23, 2020
1a8aabe
minor fix
clausnagel Nov 23, 2020
00307e0
fixed SurfaceStylingPanel to correctly display settings loaded at run…
clausnagel Nov 23, 2020
cd1b013
removed ADE-specific point and curve sytles panel
clausnagel Nov 23, 2020
887db98
first rework of point and curve styling panel
clausnagel Nov 23, 2020
0db17fe
deleted AlphaButton component
clausnagel Nov 23, 2020
9714c49
minor change
clausnagel Nov 23, 2020
ed3bfde
reworked KML balloon preferences
clausnagel Nov 24, 2020
a521264
first rework of KML elevation preferences
clausnagel Nov 24, 2020
32f7835
first rework of info dialog
clausnagel Nov 25, 2020
c2335d8
minor change
clausnagel Nov 25, 2020
ca57088
reworked readme dialog
clausnagel Nov 25, 2020
41c814d
minor fix
clausnagel Nov 25, 2020
0b67d5e
first rework of map window
clausnagel Nov 25, 2020
8b36353
minor change
clausnagel Nov 25, 2020
77af9ca
first rework of status dialogs
clausnagel Nov 26, 2020
781e2a1
minor change
clausnagel Nov 26, 2020
fb88b83
minor change
clausnagel Nov 26, 2020
b622c7c
minor changes
clausnagel Nov 26, 2020
311d820
first step to laf menu switcher
clausnagel Nov 26, 2020
b1ec704
propagate laf change to popup menus
clausnagel Nov 26, 2020
0988f9b
propagate laf change to preference entries
clausnagel Nov 26, 2020
96954d9
propagate laf change to database operations
clausnagel Nov 26, 2020
ae5a7ec
propagate laf change to export filter views
clausnagel Nov 26, 2020
c6f7e02
minor fix
clausnagel Nov 27, 2020
ee3fdf3
update laf-dependent UI components
clausnagel Nov 27, 2020
9bdceb0
laf theme is now stored in GUI config
clausnagel Nov 27, 2020
85aec1c
reworked icons and map dialogs
clausnagel Nov 29, 2020
ff4f602
Merge branch 'cli-rework' into gui-new-laf
clausnagel Nov 29, 2020
ec4bf5e
minor change
clausnagel Nov 29, 2020
e232357
updated swingx dependencies
clausnagel Nov 29, 2020
e200f38
minor change
clausnagel Nov 30, 2020
c799d5e
Update splash image
Son-HNguyen Nov 30, 2020
3e1f5fa
Resize splash for installer
Son-HNguyen Nov 30, 2020
74fd1d7
Merge branch 'master' into gui-new-laf
clausnagel Nov 30, 2020
f003d83
Update splash
Son-HNguyen Nov 30, 2020
4754049
minor change
clausnagel Nov 30, 2020
466d0b5
readded options to put objects in their own KML region
clausnagel Dec 2, 2020
77f5a91
minor fix
clausnagel Dec 2, 2020
b5c1cb8
minor change
clausnagel Dec 2, 2020
78c8647
minor change
clausnagel Dec 2, 2020
c3e9d53
moved automatic tile size field to KML/COLLADA/glTF tab
clausnagel Dec 2, 2020
f0dfac5
minor change to bbox components
clausnagel Dec 3, 2020
cb45339
Merge branch 'master' into gui-new-laf
clausnagel Dec 3, 2020
1a3c7a2
fixed resizing of preferences split pane
clausnagel Dec 3, 2020
51e8d9c
fixed setEnabledGltfComponents in GeneralPanel
clausnagel Dec 3, 2020
e24c89b
use preferred window size when restoring to GUI defaults
clausnagel Dec 3, 2020
24ef896
minor change
clausnagel Dec 3, 2020
d5c74a5
more changes to GeneralPanel
clausnagel Dec 3, 2020
c0c156f
reverted last commit
clausnagel Dec 3, 2020
300d6f6
Merge branch 'master' into gui-new-laf
clausnagel Dec 5, 2020
5846e15
minor change
clausnagel Dec 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions impexp-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ dependencies {
api project(':impexp-core')
api project(':impexp-client-common')
api project(':impexp-kml-collada-plugin')
api 'com.formdev:flatlaf:0.44'
api 'com.formdev:flatlaf-extras:0.44'
api 'com.formdev:flatlaf-swingx:0.44'
api 'com.fifesoft:rsyntaxtextarea:3.1.1'
api ('org.citydb:swingx-ws:1.1.3') {
api ('org.citydb:swingx-ws:1.1.4') {
transitive = false
}
api ('org.citydb:swingx-all:1.6.7') {
api ('org.citydb:swingx-all:1.6.8') {
transitive = false
}

Expand Down
Binary file modified impexp-client/resources/izpack/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 2 additions & 21 deletions impexp-client/src/main/java/org/citydb/cli/ExportVisCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
import org.citydb.cli.options.vis.QueryOption;
import org.citydb.config.Config;
import org.citydb.config.project.database.DatabaseConnection;
import org.citydb.config.project.kmlExporter.ADEPreference;
import org.citydb.config.project.kmlExporter.ADEPreferences;
import org.citydb.config.project.kmlExporter.KmlExportConfig;
import org.citydb.database.DatabaseController;
import org.citydb.log.Logger;
import org.citydb.modules.kml.controller.KmlExportException;
import org.citydb.modules.kml.controller.KmlExporter;
import org.citydb.log.Logger;
import org.citydb.plugin.CliCommand;
import org.citydb.plugin.cli.DatabaseOption;
import org.citydb.plugin.cli.ThreadPoolOption;
Expand Down Expand Up @@ -144,24 +142,7 @@ private void setDisplayOptions(KmlExportConfig kmlExportConfig) {
if (displayOption != null) {
kmlExportConfig.setLodToExportFrom(displayOption.getLod());
kmlExportConfig.setAppearanceTheme(displayOption.getAppearanceTheme());

displayOption.toDisplayForms(kmlExportConfig.getBuildingDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getWaterBodyDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getLandUseDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getVegetationDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getTransportationDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getReliefDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getCityFurnitureDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getGenericCityObjectDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getCityObjectGroupDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getBridgeDisplayForms());
displayOption.toDisplayForms(kmlExportConfig.getTunnelDisplayForms());

for (ADEPreferences preferences : kmlExportConfig.getADEPreferences().values()) {
for (ADEPreference preference : preferences.getPreferences().values()) {
displayOption.toDisplayForms(preference.getDisplayForms());
}
}
kmlExportConfig.setDisplayForms(displayOption.toDisplayForms());
}
}

Expand Down
54 changes: 39 additions & 15 deletions impexp-client/src/main/java/org/citydb/cli/GuiCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@

package org.citydb.cli;

import com.formdev.flatlaf.FlatLightLaf;
import org.citydb.ImpExpException;
import org.citydb.config.Config;
import org.citydb.config.ConfigUtil;
import org.citydb.config.gui.GuiConfig;
import org.citydb.config.gui.style.Theme;
import org.citydb.database.DatabaseController;
import org.citydb.gui.ImpExpGui;
import org.citydb.gui.components.SplashScreen;
Expand All @@ -40,7 +42,9 @@
import org.citydb.gui.modules.importer.CityGMLImportPlugin;
import org.citydb.gui.modules.kml.KMLExportPlugin;
import org.citydb.gui.modules.preferences.PreferencesPlugin;
import org.citydb.gui.util.GuiUtil;
import org.citydb.gui.util.OSXAdapter;
import org.citydb.log.Logger;
import org.citydb.plugin.CliCommand;
import org.citydb.plugin.InternalPlugin;
import org.citydb.plugin.Plugin;
Expand Down Expand Up @@ -74,15 +78,18 @@ public class GuiCommand extends CliCommand implements StartupProgressListener {
private ImpExpCli parent;

private final PluginManager pluginManager = PluginManager.getInstance();
private final Logger log = Logger.getInstance();

private GuiConfig guiConfig;
private int processSteps;
private SplashScreen splashScreen;

@Override
public Integer call() throws Exception {
Config config = ObjectRegistry.getInstance().getConfig();

// load GUI configuration
loadGuiConfig(config);
// set GUI configuration
config.setGuiConfig(guiConfig);

// initialize predefined GUI components
ImpExpGui impExpGui = new ImpExpGui(parent.getConfigFile());
Expand All @@ -102,19 +109,19 @@ public Integer call() throws Exception {
return 0;
}

private void loadGuiConfig(Config config) {
private GuiConfig loadGuiConfig() {
Path guiConfigFile = CoreConstants.IMPEXP_DATA_DIR
.resolve(ClientConstants.CONFIG_DIR)
.resolve(ClientConstants.GUI_SETTINGS_FILE);

Object object = null;
try {
Object object = ConfigUtil.getInstance().unmarshal(guiConfigFile.toFile());
if (object instanceof GuiConfig) {
config.setGuiConfig((GuiConfig) object);
}
object = ConfigUtil.getInstance().unmarshal(guiConfigFile.toFile());
} catch (JAXBException | IOException e) {
//
}

return object instanceof GuiConfig ? (GuiConfig) object : new GuiConfig();
}

private void initializeViewComponents(ImpExpGui impExpGui, Config config) {
Expand Down Expand Up @@ -148,23 +155,40 @@ public void preprocess(CommandLine commandLine) throws Exception {
parent.useDefaultConfiguration(true)
.failOnADEExceptions(false);

// set look & feel
// load GUI configuration
guiConfig = loadGuiConfig();
String laf = GuiUtil.getLaf(guiConfig.getAppearance().getTheme());

try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
if (OSXAdapter.IS_MAC_OS_X) {
OSXAdapter.setDockIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/citydb/gui/images/common/logo_small.png")));
// set look and feel
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
log.error("Failed to install look and feel theme '" + laf + "'.", e);
guiConfig.getAppearance().setTheme(Theme.LIGHT);
FlatLightLaf.install();
}

if (OSXAdapter.IS_MAC_OS) {
OSXAdapter.setDockIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/citydb/gui/logos/logo_small.png")));
if (System.getProperty("apple.laf.useScreenMenuBar") == null) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
}
} catch (Exception e) {
throw new ImpExpException("Failed to initialize user interface.", e);
}

// enable window decorations
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);

// set UI defaults
UIManager.put("CheckBox.iconTextGap", 6);
UIManager.put("RadioButton.iconTextGap", 6);

// splash screen
if (!hideSplash) {
splashScreen = new SplashScreen(3, 477, Color.BLACK);
splashScreen = new SplashScreen(5, 485, Color.BLACK);
splashScreen.setMessage("Version \"" + getClass().getPackage().getImplementationVersion() + "\"");
parent.withStartupProgressListener(this);
SwingUtilities.invokeLater(() -> splashScreen.setVisible(true));
splashScreen.setVisible(true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
package org.citydb.cli.options.vis;

import org.citydb.config.project.kmlExporter.DisplayForm;
import org.citydb.config.project.kmlExporter.DisplayFormType;
import org.citydb.config.project.kmlExporter.DisplayForms;
import org.citydb.config.project.kmlExporter.KmlExportConfig;
import org.citydb.plugin.cli.CliOption;
import picocli.CommandLine;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class DisplayOption implements CliOption {
@CommandLine.Option(names = {"-D", "--display-mode"}, split = ",", paramLabel = "<mode>", required = true,
Expand Down Expand Up @@ -71,43 +71,38 @@ public String getAppearanceTheme() {
return "none".equalsIgnoreCase(theme) ? KmlExportConfig.THEME_NULL : theme;
}

public void toDisplayForms(List<DisplayForm> displayForms) {
Map<Integer, DisplayForm> candidates = displayForms.stream()
.collect(Collectors.toMap(DisplayForm::getForm, d -> d));
public DisplayForms toDisplayForms() {
DisplayForms displayForms = new DisplayForms();

int visibleTo = -1;
for (Mode mode : Mode.values()) {
DisplayForm displayForm = candidates.computeIfAbsent(mode.type, v -> new DisplayForm(mode.type, -1, -1));
displayForm.setActive(modes.contains(mode) && lod.ordinal() >= mode.minimumLod);
DisplayForm displayForm = DisplayForm.of(mode.type);
displayForm.setActive(modes.contains(mode) && mode.type.isAchievableFromLoD(lod.ordinal()));
if (displayForm.isActive()) {
int visibleFrom = this.visibleFrom != null ? this.visibleFrom.getOrDefault(mode, 0) : 0;
displayForm.setVisibleFrom(visibleFrom);
displayForm.setVisibleUpTo(visibleTo);
displayForm.setVisibleTo(visibleTo);
visibleTo = visibleFrom;
}

displayForms.add(displayForm);
}

candidates.values().forEach(displayForm -> {
if (!displayForms.contains(displayForm)) {
displayForms.add(displayForm);
}
});
return displayForms;
}

public enum Mode {
collada("collada", DisplayForm.COLLADA, 1),
geometry("geometry", DisplayForm.GEOMETRY, 1),
extruded("extruded", DisplayForm.EXTRUDED, 1),
footprint("footprint", DisplayForm.FOOTPRINT, 0);
collada("collada", DisplayFormType.COLLADA),
geometry("geometry", DisplayFormType.GEOMETRY),
extruded("extruded", DisplayFormType.EXTRUDED),
footprint("footprint", DisplayFormType.FOOTPRINT);

private final String value;
private final int type;
private final int minimumLod;
private final DisplayFormType type;

Mode(String value, int type, int minimumLod) {
Mode(String value, DisplayFormType type) {
this.value = value;
this.type = type;
this.minimumLod = minimumLod;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public SimpleKmlQuery toSimpleKmlQuery() {
query.setMode(resourceIdOption != null ? SimpleKmlQueryMode.SINGLE : SimpleKmlQueryMode.BBOX);

if (typeNamesOption != null) {
query.setUseTypeNames(true);
query.setFeatureTypeFilter(typeNamesOption.toFeatureTypeFilter());
}

Expand Down
Loading