add action bar to mac os as a separate component

This commit is contained in:
bancika
2020-12-01 15:40:42 +01:00
parent 9294c24684
commit b96b694e87
4 changed files with 43 additions and 12 deletions
@@ -3241,5 +3241,21 @@
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>
<org.diylc.appframework.update.Version>
<versionNumber>
<major>4</major>
<minor>11</minor>
<build>0</build>
</versionNumber>
<releaseDate>2020-11-19 00:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>macOS: added quick action toolbar that was already available for other platforms</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
</a> </a>
</java.util.Arrays_-ArrayList> </java.util.Arrays_-ArrayList>
+1 -1
View File
@@ -10,7 +10,7 @@
<property name="jar.dir" value="${build.dir}/jar" /> <property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/junitreport" /> <property name="report.dir" value="${build.dir}/junitreport" />
<property name="main.class" value="org.diylc.DIYLCStarter" /> <property name="main.class" value="org.diylc.DIYLCStarter" />
<property name="diylc.version" value="4.10.0" /> <property name="diylc.version" value="4.11.0" />
<property name="osx.jre8.path" value="jre\osx\jdk8u275-b01-jre\Contents\Home\" /> <property name="osx.jre8.path" value="jre\osx\jdk8u275-b01-jre\Contents\Home\" />
@@ -249,25 +249,26 @@ public class MainFrame extends JFrame implements ISwingUI {
Container c = new Container(); Container c = new Container();
c.setLayout(new BorderLayout()); c.setLayout(new BorderLayout());
centerPanel = new JPanel(new BorderLayout()); centerPanel = new JPanel();
centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
c.add(centerPanel, BorderLayout.CENTER); c.add(centerPanel, BorderLayout.CENTER);
topPanel = new JPanel();
topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
c.add(topPanel, BorderLayout.NORTH);
leftPanel = new JPanel(); leftPanel = new JPanel();
leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.X_AXIS)); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.X_AXIS));
c.add(leftPanel, BorderLayout.WEST); c.add(leftPanel, BorderLayout.WEST);
rightPanel = new JPanel();
rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.X_AXIS));
c.add(rightPanel, BorderLayout.EAST);
topPanel = new JPanel();
topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
c.add(topPanel, BorderLayout.NORTH);
bottomPanel = new JPanel(); bottomPanel = new JPanel();
bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS)); bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
c.add(bottomPanel, BorderLayout.SOUTH); c.add(bottomPanel, BorderLayout.SOUTH);
rightPanel = new JPanel();
rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.X_AXIS));
c.add(rightPanel, BorderLayout.EAST);
setContentPane(c); setContentPane(c);
} }
@@ -32,9 +32,12 @@ import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.Utils; import org.diylc.appframework.miscutils.Utils;
import org.diylc.common.BadPositionException;
import org.diylc.common.EventType; import org.diylc.common.EventType;
import org.diylc.common.IComponentTransformer; import org.diylc.common.IComponentTransformer;
import org.diylc.common.IPlugIn; import org.diylc.common.IPlugIn;
@@ -43,6 +46,7 @@ import org.diylc.swing.images.IconLoader;
import org.diylc.lang.LangUtil; import org.diylc.lang.LangUtil;
import org.diylc.swing.ActionFactory; import org.diylc.swing.ActionFactory;
import org.diylc.swing.ISwingUI; import org.diylc.swing.ISwingUI;
import org.diylc.swing.plugins.canvas.CanvasPlugin;
import org.diylc.swing.plugins.help.HelpMenuPlugin; import org.diylc.swing.plugins.help.HelpMenuPlugin;
/** /**
@@ -51,6 +55,8 @@ import org.diylc.swing.plugins.help.HelpMenuPlugin;
* @author Branislav Stojkovic * @author Branislav Stojkovic
*/ */
public class ActionBarPlugin implements IPlugIn { public class ActionBarPlugin implements IPlugIn {
private static final Logger LOG = Logger.getLogger(ActionBarPlugin.class);
private IPlugInPort plugInPort; private IPlugInPort plugInPort;
private ISwingUI swingUI; private ISwingUI swingUI;
@@ -176,7 +182,15 @@ public class ActionBarPlugin implements IPlugIn {
@Override @Override
public void connect(IPlugInPort plugInPort) { public void connect(IPlugInPort plugInPort) {
this.plugInPort = plugInPort; this.plugInPort = plugInPort;
swingUI.injectMenuComponent(getActionPanel()); if (Utils.isMac()) {
try {
swingUI.injectGUIComponent(getActionPanel(), SwingConstants.CENTER, false);
} catch (BadPositionException e) {
LOG.error("Could not inject action bar plugin", e);
}
}
else
swingUI.injectMenuComponent(getActionPanel());
} }
@Override @Override