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

Convert all abaille forms to intellij gui editor #3799

Merged
merged 39 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
39c74b2
convert AddResourceDialog to intellij
thelsing Dec 28, 2022
377c49e
I18N
thelsing Dec 28, 2022
bf26c1d
replaced AdjustBoardControlPanel with intellij form
thelsing Dec 28, 2022
c59354d
I18N
thelsing Dec 28, 2022
52073d3
Merge branch 'develop' into features-intellijui
thelsing Dec 28, 2022
186eb69
fix bug where zone was not redrawn after board changed.
thelsing Dec 28, 2022
f2ecd55
add AdjustBoardControlPanelView
thelsing Dec 28, 2022
9f9ee3b
convert AdjustGridControlPanelView to intellij grid and fix grid move…
thelsing Dec 28, 2022
6c7ffb4
add CampainExportDialogView
thelsing Dec 28, 2022
a306bc4
finish CampaignExportDialog
thelsing Dec 28, 2022
f356d44
convert exportDialog to intellij
thelsing Dec 28, 2022
d50f8af
converted CampaignItemListView
thelsing Dec 28, 2022
c8172d0
add CampaignPropertiesDialogView
thelsing Dec 28, 2022
e8e98ab
add TokenPropertiesManagementView
thelsing Dec 29, 2022
5b201c9
add ColorPanelView
thelsing Dec 29, 2022
822e23d
add ConnectionInfoDialogView
thelsing Dec 29, 2022
19645d1
add ConnectToServerDialogView
thelsing Dec 29, 2022
36a85b0
add EditLabelDialogView
thelsing Dec 29, 2022
c957916
add EditLookupTablePanelView
thelsing Dec 29, 2022
025955e
add LayerSelectionDialogView
thelsing Dec 29, 2022
e26b29f
add LookupTablePaneView
thelsing Dec 29, 2022
23de8f1
add MacroButtonDialogView
thelsing Dec 29, 2022
3941251
add TransferProgressDialogView
thelsing Dec 29, 2022
fe34c4c
structure token ui files a bit more
thelsing Dec 29, 2022
44604a1
add NewTokenDialogView
thelsing Dec 29, 2022
c7fe216
add UpdateRepoDialogView
thelsing Dec 29, 2022
b712869
add MapPropertiesDialogView
thelsing Dec 29, 2022
ae32cea
add StartServerDialogView
thelsing Dec 29, 2022
79b01d6
add PreferencesDialogView
thelsing Dec 29, 2022
0125aac
actually use TransferProgressDialogView
thelsing Dec 29, 2022
80b9bf4
move translation to compontends to AbeillePanel and remove FormPanelI…
thelsing Dec 29, 2022
0dc742d
remove component from AbeillePanel all forms are now localised in the…
thelsing Dec 30, 2022
121eb48
disable spotless for generated code
thelsing Dec 30, 2022
3807806
replace ImageComponent with JLabel
thelsing Dec 31, 2022
3b6ea68
get rid of JETAColorWell (replace with PaintedPanel but rename Paint…
thelsing Dec 31, 2022
8c1bd05
move overlays back and get rid of some FormsPanel usages
thelsing Dec 31, 2022
b342e28
get completely rid of FormLayout and abaille reference
thelsing Dec 31, 2022
3d1dbe9
update miglayout
thelsing Dec 31, 2022
20cf393
Merge branch 'develop' into features-intellijui
Phergus Jan 1, 2023
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
12 changes: 5 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ spotless {
exclude '**/JTextAreaAppender.java'
}
licenseHeaderFile 'spotless.license.java'
toggleOffOn()

// Now using the Google Java style guide
googleJavaFormat()
Expand Down Expand Up @@ -344,11 +345,6 @@ dependencies {
implementation 'net.sf.ezmorph:ezmorph:1.0.6'
implementation 'net.sf.json-lib:json-lib:2.4:jdk15'

// This is just the standard abeille-formsrt but need to rename it so jpackage puts it at the
// end of the classpath list becuase it contains an old version of batik which is causing
// SVG rendering to fail.
implementation 'net.java.abeille:zz-abeille-formsrt:2.0'

implementation 'org.hibernate:antlr:2.7.5H3'
implementation 'org.reflections:reflections:0.9.11'
implementation 'org.mozilla:rhino:1.7.12'
Expand Down Expand Up @@ -441,13 +437,15 @@ dependencies {

// HTML Parsing
implementation 'org.jsoup:jsoup:1.14.3'

// eventbus
implementation 'com.google.guava:guava:31.0.1-jre'

// message compression
implementation 'org.apache.commons:commons-compress:1.22'
implementation 'org.tukaani:xz:1.9'
// intellij forms runtime
implementation 'com.jetbrains.intellij.java:java-gui-forms-rt:223.7571.182'
// layout for forms created in code
implementation 'com.miglayout:miglayout-swing:11.0'
}


Expand Down
26 changes: 13 additions & 13 deletions src/main/java/net/rptools/maptool/client/AppActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,41 @@
import javax.swing.text.BadLocationException;
import net.rptools.lib.FileUtil;
import net.rptools.lib.MD5Key;
import net.rptools.maptool.client.tool.BoardTool;
import net.rptools.maptool.client.tool.GridTool;
import net.rptools.maptool.client.ui.AddResourceDialog;
import net.rptools.maptool.client.tool.boardtool.BoardTool;
import net.rptools.maptool.client.tool.gridtool.GridTool;
import net.rptools.maptool.client.ui.AppMenuBar;
import net.rptools.maptool.client.ui.CampaignExportDialog;
import net.rptools.maptool.client.ui.ConnectToServerDialog;
import net.rptools.maptool.client.ui.ConnectToServerDialogPreferences;
import net.rptools.maptool.client.ui.ConnectionInfoDialog;
import net.rptools.maptool.client.ui.ConnectionStatusPanel;
import net.rptools.maptool.client.ui.ExportDialog;
import net.rptools.maptool.client.ui.MapPropertiesDialog;
import net.rptools.maptool.client.ui.MapToolFrame;
import net.rptools.maptool.client.ui.MapToolFrame.MTFrame;
import net.rptools.maptool.client.ui.PreferencesDialog;
import net.rptools.maptool.client.ui.PreviewPanelFileChooser;
import net.rptools.maptool.client.ui.StartServerDialog;
import net.rptools.maptool.client.ui.StartServerDialogPreferences;
import net.rptools.maptool.client.ui.StaticMessageDialog;
import net.rptools.maptool.client.ui.SysInfoDialog;
import net.rptools.maptool.client.ui.addon.AddOnLibrariesDialog;
import net.rptools.maptool.client.ui.addresource.AddResourceDialog;
import net.rptools.maptool.client.ui.assetpanel.AssetPanel;
import net.rptools.maptool.client.ui.assetpanel.Directory;
import net.rptools.maptool.client.ui.campaignexportdialog.CampaignExportDialog;
import net.rptools.maptool.client.ui.campaignproperties.CampaignPropertiesDialog;
import net.rptools.maptool.client.ui.connectioninfodialog.ConnectionInfoDialog;
import net.rptools.maptool.client.ui.connections.ClientConnectionPanel;
import net.rptools.maptool.client.ui.connecttoserverdialog.ConnectToServerDialog;
import net.rptools.maptool.client.ui.connecttoserverdialog.ConnectToServerDialogPreferences;
import net.rptools.maptool.client.ui.exportdialog.ExportDialog;
import net.rptools.maptool.client.ui.htmlframe.HTMLOverlayManager;
import net.rptools.maptool.client.ui.io.FTPClient;
import net.rptools.maptool.client.ui.io.FTPTransferObject;
import net.rptools.maptool.client.ui.io.FTPTransferObject.Direction;
import net.rptools.maptool.client.ui.io.LoadSaveImpl;
import net.rptools.maptool.client.ui.io.ProgressBarList;
import net.rptools.maptool.client.ui.io.UpdateRepoDialog;
import net.rptools.maptool.client.ui.mappropertiesdialog.MapPropertiesDialog;
import net.rptools.maptool.client.ui.players.PlayerDatabaseDialog;
import net.rptools.maptool.client.ui.preferencesdialog.PreferencesDialog;
import net.rptools.maptool.client.ui.startserverdialog.StartServerDialog;
import net.rptools.maptool.client.ui.startserverdialog.StartServerDialogPreferences;
import net.rptools.maptool.client.ui.theme.Icons;
import net.rptools.maptool.client.ui.theme.RessourceManager;
import net.rptools.maptool.client.ui.token.TransferProgressDialog;
import net.rptools.maptool.client.ui.transferprogressdialog.TransferProgressDialog;
import net.rptools.maptool.client.ui.zone.FogUtil;
import net.rptools.maptool.client.ui.zone.ZoneRenderer;
import net.rptools.maptool.client.utilities.DungeonDraftImporter;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/rptools/maptool/client/MapTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
import net.rptools.maptool.client.ui.ConnectionStatusPanel;
import net.rptools.maptool.client.ui.MapToolFrame;
import net.rptools.maptool.client.ui.OSXAdapter;
import net.rptools.maptool.client.ui.StartServerDialogPreferences;
import net.rptools.maptool.client.ui.logger.LogConsoleFrame;
import net.rptools.maptool.client.ui.startserverdialog.StartServerDialogPreferences;
import net.rptools.maptool.client.ui.theme.Icons;
import net.rptools.maptool.client.ui.theme.RessourceManager;
import net.rptools.maptool.client.ui.theme.ThemeSupport;
Expand Down
112 changes: 71 additions & 41 deletions src/main/java/net/rptools/maptool/client/swing/AbeillePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
package net.rptools.maptool.client.swing;

import com.intellij.uiDesigner.core.GridLayoutManager;
import com.jeta.forms.components.panel.FormPanel;
import com.jgoodies.forms.layout.FormLayout;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import yasb.Binder;
Expand All @@ -35,7 +35,7 @@
import yasb.swing.BindingResolver;

/**
* This class acts as a "field binding front-end" for the {@link FormPanel} class.
* This class acts as a "field binding front-end" and accessor for the different view classes.
*
* <p>After instantiating an object and passing it the name of the Abeille form, call the {@link
* #bind(Object)} method and pass the data model instance as a parameter. This class will then copy
Expand Down Expand Up @@ -81,19 +81,9 @@ public void storeBindingInfo(Component view, BindingInfo info) {}
});
}

public AbeillePanel(String panelForm) {
panel = new FormPanel(panelForm);
init();
}

public AbeillePanel(JComponent mainPanel) {
panel = mainPanel;
init();
}

private void init() {
setLayout(new BorderLayout());
FormPanelI18N.translateComponent(panel);
add(panel, "Center");
}

Expand All @@ -114,31 +104,24 @@ protected void panelInit() {
}
}

protected void replaceComponent(String panelName, String name, Component replacement) {
if (panel instanceof FormPanel formPanel) {
formPanel.getFormAccessor(panelName).replaceBean(name, replacement);
formPanel.reset();
public void replaceComponent(String panelName, String name, Component replacement) {
var placeHolder = getComponent(name);
var container = (JPanel) getComponent(panelName);
Object constraints = null;
var layout = container.getLayout();
if (layout instanceof GridLayoutManager gridLayoutManager) {
constraints = gridLayoutManager.getConstraintsForComponent(placeHolder);
} else {
var placeHolder = getComponent(name);
var container = (JPanel) getComponent(panelName);
Object constraints = null;
var layout = container.getLayout();
if (layout instanceof FormLayout formLayout) {
constraints = formLayout.getConstraints(placeHolder);
} else if (layout instanceof GridLayoutManager gridLayoutManager) {
constraints = gridLayoutManager.getConstraintsForComponent(placeHolder);
} else {
throw new RuntimeException(
"Replacement of components not implemented for layout: " + layout.getClass().getName());
}

container.remove(placeHolder);
container.add(replacement, constraints);
container.revalidate();
container.repaint();
componentMap.remove(name);
collectComponents(replacement);
throw new RuntimeException(
"Replacement of components not implemented for layout: " + layout.getClass().getName());
}

container.remove(placeHolder);
container.add(replacement, constraints);
container.revalidate();
container.repaint();
componentMap.remove(name);
collectComponents(replacement);
}

private void createComponentMap() {
Expand All @@ -160,11 +143,7 @@ private void collectComponents(Component component) {
}
}

protected Component getComponent(String name) {
if (panel instanceof FormPanel formPanel) {
return formPanel.getComponentByName(name);
}

public Component getComponent(String name) {
if (componentMap == null) {
createComponentMap();
}
Expand Down Expand Up @@ -226,6 +205,57 @@ public void unbind() {
model = null;
}

public AbstractButton getButton(String name) {
return (AbstractButton) getComponent(name);
}

public JRadioButton getRadioButton(String name) {
return (JRadioButton) getComponent(name);
}

public JComboBox getComboBox(String name) {
return (JComboBox) getComponent(name);
}

public JLabel getLabel(String name) {
return (JLabel) getComponent(name);
}

public JTabbedPane getTabbedPane(String name) {
return (JTabbedPane) getComponent(name);
}

public JTextField getTextField(String name) {
return (JTextField) getComponent(name);
}

public Collection<Component> getAllCompoments() {
if (componentMap == null) {
createComponentMap();
}
return componentMap.values();
}

public JTree getTree(String name) {
return (JTree) getComponent(name);
}

public JSpinner getSpinner(String name) {
return (JSpinner) getComponent(name);
}

public JList getList(String name) {
return (JList) getComponent(name);
}

public JCheckBox getCheckBox(String name) {
return (JCheckBox) getComponent(name);
}

public JTextComponent getTextComponent(String name) {
return (JTextComponent) getComponent(name);
}

public static class RadioButtonAdapter extends AbstractComponentAdapter implements ItemListener {
private JRadioButton button;
private Enum selected;
Expand Down
Loading