mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Refactor/maven (#889)
* mavenize * mavenization * mavenization * mavenization * mavenization * mavenization * mavenization * mavenization * mavenization * fix * app framework update * fix lib * lib * fix mavenized * fix mavenized * fix mavenized * fix mavenized * fix mavenized * fix mavenized * fix mavenized * fix mavenized * building for win and linux * Create run.bat * fixes for netlist * cleanup * unit tests * unit tests * configurable high dpi * performance upgrade * performance upgrade * rotate bug * Omit boards, wires, traces, terminals, etc from Spice netlist output * splash version update * optimize libs * optimize libs * updates * mac build maven * ruler optimization, moved images * cleanup * notarization * test workflow * build * Update pom.xml * Update pom.xml * Create README.md * Create test.yml * maven * build
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ import java.awt.geom.AffineTransform;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
/**
|
||||
* Custom splash screen with animated components. Does not use standard SplashScreen because of issues with OS X and Java 8.
|
||||
+10
-17
@@ -19,6 +19,7 @@ package org.diylc;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
@@ -31,6 +32,9 @@ import org.apache.log4j.PropertyConfigurator;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.PropertyInjector;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
import org.diylc.swingframework.fonts.FontOptimizer;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.lang.LangUtil;
|
||||
@@ -39,10 +43,6 @@ import org.diylc.serialization.ProjectFileManager;
|
||||
import org.diylc.swing.gui.MainFrame;
|
||||
import org.diylc.swing.gui.TemplateDialog;
|
||||
import org.diylc.swing.plugins.file.ProjectDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
import org.diylc.swingframework.fonts.FontOptimizer;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import ca.cgjennings.jvm.JarLoader;
|
||||
|
||||
/**
|
||||
* Main class that runs DIYLC.
|
||||
@@ -60,7 +60,6 @@ public class DIYLCStarter {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @throws InvalidActivityException
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
@@ -88,10 +87,9 @@ public class DIYLCStarter {
|
||||
}
|
||||
}
|
||||
|
||||
URL url = DIYLCStarter.class.getResource("log4j.properties");
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(url.openStream());
|
||||
try (InputStream inputStream = DIYLCStarter.class.getResourceAsStream("/log4j.properties")) {
|
||||
properties.load(inputStream);
|
||||
PropertyConfigurator.configure(properties);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not initialize log4j configuration", e);
|
||||
@@ -106,8 +104,6 @@ public class DIYLCStarter {
|
||||
// disable HIGHLIGHT_CONTINUITY_AREA config, keep it transient
|
||||
ConfigurationManager.getInstance().writeValue(IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false);
|
||||
|
||||
LOG.info("JarLoader strategy: " + JarLoader.getStrategy());
|
||||
|
||||
LOG.info("Loading languages...");
|
||||
|
||||
LangUtil.configure();
|
||||
@@ -116,6 +112,7 @@ public class DIYLCStarter {
|
||||
+ System.getProperty("java.vm.vendor"));
|
||||
LOG.debug("Java home: " + System.getProperty("java.home"));
|
||||
LOG.debug("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
||||
// LOG.debug("Classpath: " + System.getProperty("java.class.path"));
|
||||
|
||||
// set OS name as HTTP agent, java will append java version
|
||||
Properties props = System.getProperties();
|
||||
@@ -221,13 +218,9 @@ public class DIYLCStarter {
|
||||
}
|
||||
|
||||
properties = new Properties();
|
||||
try {
|
||||
LOG.info("Injecting default properties.");
|
||||
URL resource = Presenter.class.getResource("config.properties");
|
||||
if (resource != null) {
|
||||
properties.load(resource.openStream());
|
||||
PropertyInjector.injectProperties(properties);
|
||||
}
|
||||
try (InputStream inputStream = Presenter.class.getResourceAsStream("/config.properties")) {
|
||||
properties.load(inputStream);
|
||||
PropertyInjector.injectProperties(properties);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not read config.properties file", e);
|
||||
}
|
||||
+1
@@ -6,6 +6,7 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
public class OpenDIYFilesHandler implements OpenFilesHandler {
|
||||
+2
-1
@@ -21,6 +21,8 @@ import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import javax.swing.Icon;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
|
||||
import org.diylc.common.INetlistAnalyzer;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
@@ -69,7 +71,6 @@ import org.diylc.swing.actions.file.OpenAction;
|
||||
import org.diylc.swing.actions.file.PrintAction;
|
||||
import org.diylc.swing.actions.file.SaveAction;
|
||||
import org.diylc.swing.actions.file.SaveAsAction;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
|
||||
public class ActionFactory {
|
||||
|
||||
+23
-22
@@ -1,27 +1,28 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.diylc.common.ITask;
|
||||
|
||||
/**
|
||||
+35
-33
@@ -1,36 +1,38 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPopupMenu.Separator;
|
||||
import javax.swing.SwingConstants;
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.ITask;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPopupMenu.Separator;
|
||||
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
* Interface for plugin access to the swing front end.
|
||||
*
|
||||
@@ -52,8 +54,8 @@ public interface ISwingUI extends IView {
|
||||
* Center position is reserved for the main canvas panel and cannot be used.
|
||||
*
|
||||
* @param component
|
||||
* @param position
|
||||
* @param collapsible
|
||||
* @param position
|
||||
* @param collapsible
|
||||
* @param visibilityConfigKey in case of a collapsible view, this config key is used to persist the state
|
||||
* @throws BadPositionException in case invalid position is specified
|
||||
*/
|
||||
@@ -67,8 +69,8 @@ public interface ISwingUI extends IView {
|
||||
* @param action {@link Action} to inser
|
||||
* @param menuName name of the menu to insert into
|
||||
*/
|
||||
void injectMenuAction(Action action, String menuName);
|
||||
|
||||
void injectMenuAction(Action action, String menuName);
|
||||
|
||||
void injectMenuComponent(JComponent component);
|
||||
|
||||
/**
|
||||
+4
-2
@@ -5,6 +5,9 @@ import java.awt.geom.Area;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
@@ -16,8 +19,7 @@ import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class CheckProximityAction extends AbstractAction implements Cloneable {
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ package org.diylc.swing.actions;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.plugins.config.ConfigPlugin;
|
||||
+1
@@ -4,6 +4,7 @@ import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
+2
-1
@@ -4,12 +4,13 @@ import java.awt.Graphics2D;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class ExportGerberAction extends AbstractAction {
|
||||
+5
-3
@@ -3,15 +3,17 @@ package org.diylc.swing.actions;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
public class ExportPNGAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -4,11 +4,12 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.edit.FindDialog;
|
||||
|
||||
public class FindAction extends AbstractAction {
|
||||
+4
-2
@@ -2,10 +2,12 @@ package org.diylc.swing.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
import org.diylc.editor.FlexibleLeadsEditor;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class FlexibleLeadsAction extends AbstractAction {
|
||||
|
||||
+4
-2
@@ -5,14 +5,16 @@ import java.awt.event.ActionEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import org.diylc.swingframework.TextDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.netlist.Group;
|
||||
import org.diylc.netlist.Netlist;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.TextDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class GenerateNetlistAction extends AbstractAction {
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ package org.diylc.swing.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
|
||||
+4
-2
@@ -4,14 +4,16 @@ import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.swingframework.TextDialog;
|
||||
|
||||
import org.diylc.common.INetlistAnalyzer;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.netlist.Netlist;
|
||||
import org.diylc.netlist.Summary;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.TextDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SummarizeNetlistAction extends AbstractAction {
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ package org.diylc.swing.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.core.Theme;
|
||||
+1
@@ -5,6 +5,7 @@ import javax.swing.AbstractAction;
|
||||
import javax.swing.Icon;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class BringToFrontAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -7,10 +7,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferableFactory;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class CopyAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -7,10 +7,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferableFactory;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class CutAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -5,9 +5,10 @@ import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class DeleteSelectionAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -5,9 +5,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class DuplicateAction extends AbstractAction {
|
||||
|
||||
+4
-2
@@ -3,14 +3,16 @@ package org.diylc.swing.actions.edit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class EditProjectAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -6,10 +6,11 @@ import java.awt.event.KeyEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class EditSelectionAction extends AbstractAction {
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ package org.diylc.swing.actions.edit;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
+2
-1
@@ -5,9 +5,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class GroupAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -4,10 +4,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class MirrorSelectionAction extends AbstractAction {
|
||||
|
||||
+3
-2
@@ -7,6 +7,8 @@ import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.measures.Nudge;
|
||||
@@ -16,8 +18,7 @@ import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class NudgeAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -7,11 +7,12 @@ import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class PasteAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class RotateSelectionAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -3,9 +3,10 @@ package org.diylc.swing.actions.edit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SaveAsBlockAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -3,9 +3,10 @@ package org.diylc.swing.actions.edit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SaveAsTemplateAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -5,9 +5,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SelectAllAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SendToBackAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -5,9 +5,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class UngroupAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -4,10 +4,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.BomDialog;
|
||||
import org.diylc.utils.BomEntry;
|
||||
|
||||
+2
-1
@@ -2,9 +2,10 @@ package org.diylc.swing.actions.file;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class ExitAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -12,6 +12,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.swingframework.CheckBoxListDialog;
|
||||
|
||||
import org.diylc.common.BuildingBlockPackage;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
@@ -22,7 +24,6 @@ import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.CheckBoxListDialog;
|
||||
|
||||
public class ExportBlocksAction extends AbstractAction {
|
||||
|
||||
+5
-3
@@ -3,15 +3,17 @@ package org.diylc.swing.actions.file;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
public class ExportPDFAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -14,6 +14,8 @@ import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.swingframework.CheckBoxListDialog;
|
||||
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
@@ -25,7 +27,6 @@ import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.CheckBoxListDialog;
|
||||
|
||||
public class ExportVariantsAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import javax.swing.AbstractAction;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferableFactory;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
@@ -19,7 +20,7 @@ import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class ImportAction extends AbstractAction {
|
||||
+1
@@ -3,6 +3,7 @@ package org.diylc.swing.actions.file;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
+4
-2
@@ -8,6 +8,9 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
@@ -19,9 +22,8 @@ import org.diylc.netlist.ParsedNetlistEntry;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.NetlistImportDialog;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
public class ImportNetlistAction extends AbstractAction {
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ package org.diylc.swing.actions.file;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
+4
-2
@@ -6,14 +6,16 @@ import java.awt.event.KeyEvent;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class NewAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -6,12 +6,13 @@ import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class OpenAction extends AbstractAction {
|
||||
+5
-3
@@ -6,12 +6,14 @@ import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class PrintAction extends AbstractAction {
|
||||
|
||||
+2
-1
@@ -6,12 +6,13 @@ import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class SaveAction extends AbstractAction {
|
||||
+2
-1
@@ -7,12 +7,13 @@ import java.io.File;
|
||||
import java.util.Optional;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class SaveAsAction extends AbstractAction {
|
||||
+2
-1
@@ -37,6 +37,7 @@ import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
@@ -62,7 +63,7 @@ import org.diylc.swing.actions.edit.SaveAsBlockAction;
|
||||
import org.diylc.swing.actions.edit.SaveAsTemplateAction;
|
||||
import org.diylc.swing.actions.edit.SendToBackAction;
|
||||
import org.diylc.swing.actions.edit.UngroupAction;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.toolbox.ComponentButtonFactory;
|
||||
|
||||
public class ComponentPopupMenu extends JPopupMenu implements ClipboardOwner {
|
||||
+4
-3
@@ -25,6 +25,10 @@ import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.swingframework.AboutDialog;
|
||||
import org.diylc.swingframework.IFileChooserAccessory;
|
||||
import org.diylc.swingframework.ProgressDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.netlist.ParsedNetlistEntry;
|
||||
@@ -38,9 +42,6 @@ import org.diylc.swing.plugins.cloud.view.UserEditDialog;
|
||||
import org.diylc.swing.plugins.edit.FindDialog;
|
||||
import org.diylc.swing.plugins.file.BomDialog;
|
||||
import org.diylc.swing.plugins.file.NetlistImportDialog;
|
||||
import org.diylc.swingframework.AboutDialog;
|
||||
import org.diylc.swingframework.IFileChooserAccessory;
|
||||
import org.diylc.swingframework.ProgressDialog;
|
||||
import org.diylc.utils.BomEntry;
|
||||
|
||||
public class DialogFactory {
|
||||
+25
-24
@@ -19,36 +19,37 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.IView;
|
||||
|
||||
public class DummyView implements IView {
|
||||
|
||||
@Override
|
||||
public int showConfirmDialog(String message, String title, int optionType, int messageType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String message, String title, int messageType) {}
|
||||
|
||||
@Override
|
||||
public File promptFileSave() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title) {
|
||||
return false;
|
||||
import org.diylc.core.IView;
|
||||
|
||||
public class DummyView implements IView {
|
||||
|
||||
@Override
|
||||
public int showConfirmDialog(String message, String title, int optionType, int messageType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String message, String title, int messageType) {}
|
||||
|
||||
@Override
|
||||
public File promptFileSave() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showInputDialog(String message, String title) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -25,10 +25,11 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class InfoDialog extends ButtonDialog {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
+181
-180
@@ -1,93 +1,94 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.event.MenuEvent;
|
||||
import javax.swing.event.MenuListener;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.core.images.IconLoader;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.IDynamicSubmenuHandler;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.actionbar.ActionBarPlugin;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.plugins.autosave.AutoSavePlugin;
|
||||
import org.diylc.swing.plugins.canvas.CanvasPlugin;
|
||||
import org.diylc.swing.plugins.cloud.CloudPlugIn;
|
||||
import org.diylc.swing.plugins.config.ConfigPlugin;
|
||||
import org.diylc.swing.plugins.edit.EditMenuPlugin;
|
||||
import org.diylc.swing.plugins.explorer.ExplorerPlugin;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swing.plugins.file.FileMenuPlugin;
|
||||
import org.diylc.swing.plugins.help.HelpMenuPlugin;
|
||||
import org.diylc.swing.plugins.layers.LayersMenuPlugin;
|
||||
import org.diylc.swing.plugins.statusbar.StatusBar;
|
||||
import org.diylc.swing.plugins.test.TestMenuPlugin;
|
||||
import org.diylc.swing.plugins.toolbox.ToolBox;
|
||||
import org.diylc.swing.plugins.tree.ComponentTree;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.event.MenuEvent;
|
||||
import javax.swing.event.MenuListener;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.swing.IDynamicSubmenuHandler;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.core.images.IconLoader;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.actionbar.ActionBarPlugin;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.plugins.autosave.AutoSavePlugin;
|
||||
import org.diylc.swing.plugins.canvas.CanvasPlugin;
|
||||
import org.diylc.swing.plugins.cloud.CloudPlugIn;
|
||||
import org.diylc.swing.plugins.config.ConfigPlugin;
|
||||
import org.diylc.swing.plugins.edit.EditMenuPlugin;
|
||||
import org.diylc.swing.plugins.explorer.ExplorerPlugin;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swing.plugins.file.FileMenuPlugin;
|
||||
import org.diylc.swing.plugins.help.HelpMenuPlugin;
|
||||
import org.diylc.swing.plugins.layers.LayersMenuPlugin;
|
||||
import org.diylc.swing.plugins.statusbar.StatusBar;
|
||||
import org.diylc.swing.plugins.test.TestMenuPlugin;
|
||||
import org.diylc.swing.plugins.toolbox.ToolBox;
|
||||
import org.diylc.swing.plugins.tree.ComponentTree;
|
||||
|
||||
public class MainFrame extends JFrame implements ISwingUI {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(MainFrame.class);
|
||||
@@ -110,15 +111,15 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
|
||||
public MainFrame() {
|
||||
super("DIYLC 4");
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
setPreferredSize(new Dimension(1024, 700));
|
||||
createBasePanels();
|
||||
menuMap = new HashMap<String, JMenu>();
|
||||
buttonGroupMap = new HashMap<String, ButtonGroup>();
|
||||
setIconImages(Arrays.asList(IconLoader.IconSmall.getImage(), IconLoader.IconMedium.getImage(),
|
||||
IconLoader.IconLarge.getImage()));
|
||||
DialogFactory.getInstance().initialize(this);
|
||||
|
||||
DialogFactory.getInstance().initialize(this);
|
||||
|
||||
IConfigurationManager<?> configManager = ConfigurationManager.getInstance();
|
||||
|
||||
this.presenter = new Presenter(this, configManager, true);
|
||||
@@ -128,18 +129,18 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
presenter.installPlugin(() -> new EditMenuPlugin(this));
|
||||
presenter.installPlugin(() -> new ConfigPlugin(this));
|
||||
presenter.installPlugin(() -> new LayersMenuPlugin(this));
|
||||
presenter.installPlugin(() -> new CloudPlugIn(this));
|
||||
if ("true".equalsIgnoreCase(System.getProperty("org.diylc.enableTests")))
|
||||
presenter.installPlugin(() -> new CloudPlugIn(this));
|
||||
if ("true".equalsIgnoreCase(System.getProperty("org.diylc.enableTests")))
|
||||
presenter.installPlugin(() -> new TestMenuPlugin(this));
|
||||
presenter.installPlugin(() -> new HelpMenuPlugin(this));
|
||||
presenter.installPlugin(() -> new HelpMenuPlugin(this));
|
||||
presenter.installPlugin(() -> new ActionBarPlugin(this));
|
||||
|
||||
presenter.installPlugin(() -> new StatusBar(this));
|
||||
|
||||
presenter.installPlugin(() -> new StatusBar(this));
|
||||
|
||||
canvasPlugin = new CanvasPlugin(this, configManager);
|
||||
presenter.installPlugin(() -> canvasPlugin);
|
||||
presenter.installPlugin(() -> new ComponentTree(this, canvasPlugin.getCanvasPanel()));
|
||||
presenter.installPlugin(() -> new ExplorerPlugin(this, canvasPlugin.getCanvasPanel()));
|
||||
presenter.installPlugin(() -> new ComponentTree(this, canvasPlugin.getCanvasPanel()));
|
||||
presenter.installPlugin(() -> new ExplorerPlugin(this, canvasPlugin.getCanvasPanel()));
|
||||
|
||||
presenter.installPlugin(() -> new FramePlugin());
|
||||
|
||||
@@ -150,70 +151,70 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
addWindowListener(new WindowAdapter() {
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
if (getGlassPane().isVisible()) {
|
||||
LOG.info("Prevented the app from closing because a running task is detected");
|
||||
return;
|
||||
public void windowClosed(WindowEvent e) {
|
||||
if (getGlassPane().isVisible()) {
|
||||
LOG.info("Prevented the app from closing because a running task is detected");
|
||||
return;
|
||||
}
|
||||
if (presenter.allowFileAction()) {
|
||||
//ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false);
|
||||
dispose();
|
||||
presenter.dispose();
|
||||
presenter.dispose();
|
||||
LOG.info("Closing the app");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if (getGlassPane().isVisible()) {
|
||||
LOG.info("Prevented the app from closing because a running task is detected");
|
||||
return;
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if (getGlassPane().isVisible()) {
|
||||
LOG.info("Prevented the app from closing because a running task is detected");
|
||||
return;
|
||||
}
|
||||
if (presenter.allowFileAction()) {
|
||||
//ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false);
|
||||
dispose();
|
||||
presenter.dispose();
|
||||
presenter.dispose();
|
||||
LOG.info("Closing the app");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
setGlassPane(new CustomGlassPane());
|
||||
// getGlassPane().setVisible(true);
|
||||
|
||||
// maximize the screen
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
|
||||
}
|
||||
});
|
||||
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// wait some time for size to update
|
||||
// TODO: find a better solution
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Important! Notify the canvas to center the scrolls and show the content
|
||||
canvasPlugin.scrollToCenterAndShowContents();
|
||||
}
|
||||
});
|
||||
}
|
||||
// getGlassPane().setVisible(true);
|
||||
|
||||
// maximize the screen
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
|
||||
}
|
||||
});
|
||||
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// wait some time for size to update
|
||||
// TODO: find a better solution
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Important! Notify the canvas to center the scrolls and show the content
|
||||
canvasPlugin.scrollToCenterAndShowContents();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
public Presenter getPresenter() {
|
||||
return presenter;
|
||||
@@ -248,20 +249,20 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
Container c = new Container();
|
||||
c.setLayout(new BorderLayout());
|
||||
|
||||
centerPanel = new JPanel();
|
||||
centerPanel = new JPanel();
|
||||
centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
|
||||
c.add(centerPanel, BorderLayout.CENTER);
|
||||
|
||||
leftPanel = new JPanel();
|
||||
leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.X_AXIS));
|
||||
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(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();
|
||||
@@ -289,11 +290,11 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
@Override
|
||||
public int showConfirmDialog(String message, String title, int optionType, int messageType) {
|
||||
return JOptionPane.showConfirmDialog(this, message, title, optionType, messageType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showInputDialog(String message, String title) {
|
||||
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showInputDialog(String message, String title) {
|
||||
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,11 +320,11 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
|
||||
@Override
|
||||
public void injectGUIComponent(JComponent component, int position, boolean collapsible, String visibilityConfigKey) throws BadPositionException {
|
||||
LOG.info(String.format("injectGUIComponent(%s, %s, %s, %s)", component.getClass().getName(), position, collapsible, visibilityConfigKey));
|
||||
if (collapsible) {
|
||||
CollapsiblePanel panel = new CollapsiblePanel(position, visibilityConfigKey);
|
||||
panel.add(component);
|
||||
component = panel;
|
||||
LOG.info(String.format("injectGUIComponent(%s, %s, %s, %s)", component.getClass().getName(), position, collapsible, visibilityConfigKey));
|
||||
if (collapsible) {
|
||||
CollapsiblePanel panel = new CollapsiblePanel(position, visibilityConfigKey);
|
||||
panel.add(component);
|
||||
component = panel;
|
||||
}
|
||||
switch (position) {
|
||||
case SwingConstants.TOP:
|
||||
@@ -350,18 +351,18 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
@Override
|
||||
public void injectMenuAction(Action action, String menuName) {
|
||||
LOG.info(String.format("injectMenuAction(%s, %s)", action == null ? "Separator" : action.getValue(Action.NAME),
|
||||
menuName));
|
||||
if (menuName != null)
|
||||
menuName = LangUtil.translate(menuName);
|
||||
menuName));
|
||||
if (menuName != null)
|
||||
menuName = LangUtil.translate(menuName);
|
||||
|
||||
JMenu menu = findOrCreateMenu(menuName);
|
||||
if (action == null) {
|
||||
menu.addSeparator();
|
||||
} else {
|
||||
// translate
|
||||
String name = (String) action.getValue(Action.NAME);
|
||||
if (name != null)
|
||||
action.putValue(Action.NAME, LangUtil.translate(name));
|
||||
} else {
|
||||
// translate
|
||||
String name = (String) action.getValue(Action.NAME);
|
||||
if (name != null)
|
||||
action.putValue(Action.NAME, LangUtil.translate(name));
|
||||
|
||||
Boolean isCheckBox = (Boolean) action.getValue(IView.CHECK_BOX_MENU_ITEM);
|
||||
String groupName = (String) action.getValue(IView.RADIO_BUTTON_GROUP_KEY);
|
||||
@@ -386,31 +387,31 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
|
||||
@Override
|
||||
public void injectSubmenu(String name, Icon icon, String parentMenuName) {
|
||||
LOG.info(String.format("injectSubmenu(%s, icon, %s)", name, parentMenuName));
|
||||
|
||||
// translate
|
||||
name = LangUtil.translate(name);
|
||||
parentMenuName = parentMenuName == null ? null : LangUtil.translate(parentMenuName);
|
||||
LOG.info(String.format("injectSubmenu(%s, icon, %s)", name, parentMenuName));
|
||||
|
||||
// translate
|
||||
name = LangUtil.translate(name);
|
||||
parentMenuName = parentMenuName == null ? null : LangUtil.translate(parentMenuName);
|
||||
|
||||
JMenu menu = findOrCreateMenu(parentMenuName);
|
||||
JMenu submenu = new JMenu(name);
|
||||
submenu.setIcon(icon);
|
||||
menu.add(submenu);
|
||||
menuMap.put(name, submenu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectMenuComponent(JComponent component) {
|
||||
getMainMenuBar().add(component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectMenuComponent(JComponent component) {
|
||||
getMainMenuBar().add(component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectDynamicSubmenu(String name, Icon icon, String parentMenuName, final IDynamicSubmenuHandler handler) {
|
||||
LOG.info(String.format("injectDynamicSubmenu(%s, icon, %s)", name, parentMenuName));
|
||||
|
||||
// translate
|
||||
name = LangUtil.translate(name);
|
||||
parentMenuName = parentMenuName == null ? null : LangUtil.translate(parentMenuName);
|
||||
LOG.info(String.format("injectDynamicSubmenu(%s, icon, %s)", name, parentMenuName));
|
||||
|
||||
// translate
|
||||
name = LangUtil.translate(name);
|
||||
parentMenuName = parentMenuName == null ? null : LangUtil.translate(parentMenuName);
|
||||
|
||||
final JMenu menu = findOrCreateMenu(parentMenuName);
|
||||
final JMenu submenu = new JMenu(name);
|
||||
+2
-1
@@ -32,7 +32,8 @@ import javax.swing.Icon;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
import org.diylc.utils.IconLoader;
|
||||
|
||||
public class SearchTextField extends JTextField {
|
||||
|
||||
+64
-63
@@ -1,63 +1,64 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.common.DrawOption;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.IView;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
|
||||
import org.diylc.common.DrawOption;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.presenter.Presenter;
|
||||
|
||||
public class TemplateDialog extends JDialog {
|
||||
@@ -95,11 +96,11 @@ public class TemplateDialog extends JDialog {
|
||||
@Override
|
||||
public void showMessage(String message, String title, int messageType) {
|
||||
JOptionPane.showMessageDialog(TemplateDialog.this, message, title, messageType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showInputDialog(String message, String title) {
|
||||
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showInputDialog(String message, String title) {
|
||||
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
+1
@@ -20,6 +20,7 @@ package org.diylc.swing.gui;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedMenu extends JMenu {
|
||||
+1
@@ -21,6 +21,7 @@ import java.awt.Component;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedPanel extends JPanel {
|
||||
+1
@@ -20,6 +20,7 @@ package org.diylc.swing.gui;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class TranslatedPopupMenu extends JPopupMenu {
|
||||
+2
-1
@@ -37,6 +37,7 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
@@ -45,7 +46,7 @@ import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.help.HelpMenuPlugin;
|
||||
|
||||
/**
|
||||
+1
@@ -32,6 +32,7 @@ import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class ActionToolbar extends JPanel {
|
||||
+1
@@ -29,6 +29,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
public class ToggleConfigLabel extends JLabel implements IConfigListener {
|
||||
+1
@@ -26,6 +26,7 @@ import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.Angle;
|
||||
import org.diylc.lang.LangUtil;
|
||||
+28
-27
@@ -19,37 +19,38 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class BooleanEditor extends JCheckBox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
public BooleanEditor(final PropertyWrapper property) {
|
||||
super();
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class BooleanEditor extends JCheckBox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
public BooleanEditor(final PropertyWrapper property) {
|
||||
super();
|
||||
setSelected((Boolean) property.getValue());
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
property.setValue(isSelected());
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
setEnabled(false);
|
||||
addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
property.setValue(isSelected());
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-38
@@ -1,38 +1,40 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.PercentEditor;
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.PercentEditor;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class ByteEditor extends JPanel {
|
||||
@@ -61,11 +63,11 @@ public class ByteEditor extends JPanel {
|
||||
}
|
||||
|
||||
final JSlider slider = new JSlider();
|
||||
final DoubleTextField valueField = new DoubleTextField();
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
slider.setEnabled(false);
|
||||
valueField.setEnabled(false);
|
||||
final DoubleTextField valueField = new DoubleTextField();
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
slider.setEnabled(false);
|
||||
valueField.setEnabled(false);
|
||||
}
|
||||
|
||||
final double percentFactor = (double) default100Percent / _100PercentValue;
|
||||
+67
-66
@@ -1,41 +1,42 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
|
||||
public class ColorEditor extends JPanel {
|
||||
@@ -70,11 +71,11 @@ public class ColorEditor extends JPanel {
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = new Insets(0, 0, 0, 0);
|
||||
add(getColorField(), gbc);
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
getColorField().setEnabled(false);
|
||||
getColorLabel().setEnabled(false);
|
||||
add(getColorField(), gbc);
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
getColorField().setEnabled(false);
|
||||
getColorLabel().setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +107,13 @@ public class ColorEditor extends JPanel {
|
||||
Color newColor = JColorChooser.showDialog(ColorEditor.this, "Choose Color", colorLabel.getBackground());
|
||||
if (newColor != null) {
|
||||
property.setChanged(true);
|
||||
property.setValue(new Color(newColor.getRGB()));
|
||||
property.setValue(new Color(newColor.getRGB()));
|
||||
if (newColor.getAlpha() == 255) {
|
||||
getColorField().setText(Integer.toHexString(newColor.getRGB()).substring(2).toUpperCase());
|
||||
getColorLabel().setBackground(newColor);
|
||||
} else { // has alpha, convert to RGBA
|
||||
getColorField().setText(Integer.toHexString(newColor.getRGB()).toUpperCase());
|
||||
getColorLabel().setBackground(new Color(newColor.getRGB()));
|
||||
getColorField().setText(Integer.toHexString(newColor.getRGB()).substring(2).toUpperCase());
|
||||
getColorLabel().setBackground(newColor);
|
||||
} else { // has alpha, convert to RGBA
|
||||
getColorField().setText(Integer.toHexString(newColor.getRGB()).toUpperCase());
|
||||
getColorLabel().setBackground(new Color(newColor.getRGB()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,17 +124,17 @@ public class ColorEditor extends JPanel {
|
||||
|
||||
public JTextField getColorField() {
|
||||
if (colorField == null) {
|
||||
Color color = (Color) property.getValue();
|
||||
Color color = (Color) property.getValue();
|
||||
|
||||
colorField = new JTextField();
|
||||
|
||||
if (property.isUnique()) {
|
||||
if (color.getAlpha() == 255) {
|
||||
colorField.setText(Integer.toHexString(color.getRGB()).substring(2).toUpperCase());
|
||||
} else { // has alpha, convert to RGBA
|
||||
colorField.setText(Integer.toHexString((color.getRGB())).toUpperCase());
|
||||
}
|
||||
}
|
||||
colorField = new JTextField();
|
||||
|
||||
if (property.isUnique()) {
|
||||
if (color.getAlpha() == 255) {
|
||||
colorField.setText(Integer.toHexString(color.getRGB()).substring(2).toUpperCase());
|
||||
} else { // has alpha, convert to RGBA
|
||||
colorField.setText(Integer.toHexString((color.getRGB())).toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
colorField.setColumns(8);
|
||||
colorField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@@ -166,15 +167,15 @@ public class ColorEditor extends JPanel {
|
||||
property.setChanged(true);
|
||||
property.setValue(newColor);
|
||||
}
|
||||
} else if (getColorField().getText().length() == 8) {
|
||||
int rgba = (int)Long.parseLong(getColorField().getText(), 16);
|
||||
Color newColor = new Color(rgba, true);
|
||||
if (newColor != null && getColorLabel().getBackground() != newColor) {
|
||||
getColorLabel().setBackground(new Color(newColor.getRGB()));
|
||||
getColorLabel().setText(title);
|
||||
property.setChanged(true);
|
||||
property.setValue(newColor);
|
||||
}
|
||||
} else if (getColorField().getText().length() == 8) {
|
||||
int rgba = (int)Long.parseLong(getColorField().getText(), 16);
|
||||
Color newColor = new Color(rgba, true);
|
||||
if (newColor != null && getColorLabel().getBackground() != newColor) {
|
||||
getColorLabel().setBackground(new Color(newColor.getRGB()));
|
||||
getColorLabel().setText(title);
|
||||
property.setChanged(true);
|
||||
property.setValue(newColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
-33
@@ -19,8 +19,8 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ItemEvent;
|
||||
@@ -29,23 +29,24 @@ import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class EnumEditor extends JComboBox<Object> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
private final PropertyWrapper property;
|
||||
|
||||
public EnumEditor(final PropertyWrapper property) {
|
||||
this.property = property;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class EnumEditor extends JComboBox<Object> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
private final PropertyWrapper property;
|
||||
|
||||
public EnumEditor(final PropertyWrapper property) {
|
||||
this.property = property;
|
||||
Object[] values = property.getType().getEnumConstants();
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
setEnabled(false);
|
||||
setModel(new DefaultComboBoxModel<Object>(values));
|
||||
setRenderer(new DefaultListCellRenderer() {
|
||||
|
||||
@@ -58,21 +59,21 @@ public class EnumEditor extends JComboBox<Object> {
|
||||
return super.getListCellRendererComponent(list, value == null ? null : LangUtil.translate(value.toString()), index, isSelected, cellHasFocus);
|
||||
}
|
||||
|
||||
});
|
||||
setSelectedItem(property.getValue());
|
||||
addItemListener(new ItemListener() {
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
EnumEditor.this.property.setValue(e.getItem());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
setSelectedItem(property.getValue());
|
||||
addItemListener(new ItemListener() {
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
EnumEditor.this.property.setValue(e.getItem());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
+55
-54
@@ -1,38 +1,39 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.components.misc.LoadlineEntity;
|
||||
import org.diylc.core.Angle;
|
||||
import org.diylc.core.annotations.ByteArrayProperty;
|
||||
import org.diylc.core.annotations.DynamicList;
|
||||
import org.diylc.core.annotations.MultiLineText;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.components.misc.LoadlineEntity;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.Angle;
|
||||
import org.diylc.core.annotations.ByteArrayProperty;
|
||||
import org.diylc.core.annotations.DynamicList;
|
||||
import org.diylc.core.annotations.MultiLineText;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
|
||||
/**
|
||||
* Based on {@link PropertyWrapper#getType()}, creates an appropriate {@link Component} that can
|
||||
@@ -72,20 +73,20 @@ public class FieldEditorFactory {
|
||||
if (AbstractMeasure.class.isAssignableFrom(property.getType())) {
|
||||
MeasureEditor editor = new MeasureEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (AbstractMeasure[].class.isAssignableFrom(property.getType())) {
|
||||
MeasureArrayEditor editor = new MeasureArrayEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (AbstractMeasure[].class.isAssignableFrom(property.getType())) {
|
||||
MeasureArrayEditor editor = new MeasureArrayEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (byte[].class.isAssignableFrom(property.getType())) {
|
||||
ByteArrayProperty annotation = null;
|
||||
try {
|
||||
property.getGetter().isAnnotationPresent(ByteArrayProperty.class);
|
||||
annotation = property.getGetter().getAnnotation(ByteArrayProperty.class);
|
||||
} catch (SecurityException e) {
|
||||
LOG.error("Error while reading ByteArrayProperty annotation", e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
LOG.error("Error while reading ByteArrayProperty annotation", e);
|
||||
if (byte[].class.isAssignableFrom(property.getType())) {
|
||||
ByteArrayProperty annotation = null;
|
||||
try {
|
||||
property.getGetter().isAnnotationPresent(ByteArrayProperty.class);
|
||||
annotation = property.getGetter().getAnnotation(ByteArrayProperty.class);
|
||||
} catch (SecurityException e) {
|
||||
LOG.error("Error while reading ByteArrayProperty annotation", e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
LOG.error("Error while reading ByteArrayProperty annotation", e);
|
||||
}
|
||||
ImageEditor editor = new ImageEditor(property, annotation == null ? null : annotation.binaryType());
|
||||
return editor;
|
||||
@@ -109,14 +110,14 @@ public class FieldEditorFactory {
|
||||
if (Integer.class.isAssignableFrom(property.getType()) || int.class.isAssignableFrom(property.getType())) {
|
||||
IntEditor editor = new IntEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (LoadlineEntity.class.isAssignableFrom(property.getType())) {
|
||||
LoadlineEditor editor = new LoadlineEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (Angle.class.isAssignableFrom(property.getType())) {
|
||||
AngleEditor editor = new AngleEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (LoadlineEntity.class.isAssignableFrom(property.getType())) {
|
||||
LoadlineEditor editor = new LoadlineEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (Angle.class.isAssignableFrom(property.getType())) {
|
||||
AngleEditor editor = new AngleEditor(property);
|
||||
return editor;
|
||||
}
|
||||
LOG.error("Unrecognized parameter type: " + property.getType().getName());
|
||||
return new JLabel("Unrecognized");
|
||||
+33
-31
@@ -1,34 +1,36 @@
|
||||
/*
|
||||
|
||||
O DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
O DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JTextField;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swingframework.fonts.FontChooserComboBox;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.diylc.swingframework.fonts.FontChooserComboBox;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class FontEditor extends FontChooserComboBox {
|
||||
@@ -40,8 +42,8 @@ public class FontEditor extends FontChooserComboBox {
|
||||
private final PropertyWrapper property;
|
||||
|
||||
public FontEditor(final PropertyWrapper property) {
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
((JTextField) getEditor().getEditorComponent()).setBorder(BorderFactory.createCompoundBorder(
|
||||
((JTextField) getEditor().getEditorComponent()).getBorder(), BorderFactory.createEmptyBorder(0, 2, 0, 0)));
|
||||
+1
@@ -24,6 +24,7 @@ import java.io.FileInputStream;
|
||||
import javax.swing.JButton;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.BinaryType;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
+30
-28
@@ -19,39 +19,41 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class IntEditor extends DoubleTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
public IntEditor(final PropertyWrapper property) {
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class IntEditor extends DoubleTextField {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
public IntEditor(final PropertyWrapper property) {
|
||||
setLayout(new BorderLayout());
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
if (property.getValue() != null)
|
||||
setValue((double) (Integer) property.getValue());
|
||||
addPropertyChangeListener(DoubleTextField.VALUE_PROPERTY, new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
property.setValue(evt.getNewValue() == null ? null : ((Double) evt.getNewValue()).intValue());
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (property.getValue() != null)
|
||||
setValue((double) (Integer) property.getValue());
|
||||
addPropertyChangeListener(DoubleTextField.VALUE_PROPERTY, new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
property.setValue(evt.getNewValue() == null ? null : ((Double) evt.getNewValue()).intValue());
|
||||
}
|
||||
});
|
||||
if (!property.isUnique()) {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-17
@@ -19,8 +19,8 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@@ -32,24 +32,26 @@ import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.components.misc.LoadlineEntity;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.loadline.LoadlineEditorFrame;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
public class LoadlineEditor extends JButton {
|
||||
|
||||
|
||||
public class LoadlineEditor extends JButton {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LoadlineEditor.class);
|
||||
|
||||
private static final String title = " (click to load from a file)";
|
||||
|
||||
public LoadlineEditor(final PropertyWrapper property) {
|
||||
super();
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LoadlineEditor.class);
|
||||
|
||||
private static final String title = " (click to load from a file)";
|
||||
|
||||
public LoadlineEditor(final PropertyWrapper property) {
|
||||
super();
|
||||
|
||||
LoadlineEntity loadline = (LoadlineEntity) property.getValue();
|
||||
|
||||
String name = (loadline == null ? "<empty>" : loadline.getName()) + " ";
|
||||
@@ -87,6 +89,6 @@ public class LoadlineEditor extends JButton {
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -19,8 +19,8 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
@@ -36,9 +36,10 @@ import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import javax.swing.JComboBox;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.swingframework.DoubleArrayTextField;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
import org.diylc.swingframework.DoubleArrayTextField;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class MeasureArrayEditor extends Container {
|
||||
+52
-51
@@ -1,44 +1,45 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import javax.swing.JComboBox;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
import org.diylc.core.measures.Unit;
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import javax.swing.JComboBox;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.measures.AbstractMeasure;
|
||||
import org.diylc.core.measures.Unit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class MeasureEditor extends Container {
|
||||
@@ -85,13 +86,13 @@ public class MeasureEditor extends Container {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
try {
|
||||
Constructor<?> ctor = property.getType().getConstructors()[0];
|
||||
Double newValue = valueField.getValue();
|
||||
if (newValue != null && property.isReadOnly()) {
|
||||
double oldFactor = ((Unit)((AbstractMeasure<?>)property.getValue()).getUnit()).getFactor();
|
||||
double newFactor = ((Unit)unitBox.getSelectedItem()).getFactor();
|
||||
newValue = newValue * oldFactor / newFactor;
|
||||
valueField.setValue(newValue);
|
||||
Constructor<?> ctor = property.getType().getConstructors()[0];
|
||||
Double newValue = valueField.getValue();
|
||||
if (newValue != null && property.isReadOnly()) {
|
||||
double oldFactor = ((Unit)((AbstractMeasure<?>)property.getValue()).getUnit()).getFactor();
|
||||
double newFactor = ((Unit)unitBox.getSelectedItem()).getFactor();
|
||||
newValue = newValue * oldFactor / newFactor;
|
||||
valueField.setValue(newValue);
|
||||
}
|
||||
AbstractMeasure<?> newMeasure =
|
||||
(AbstractMeasure<?>) ctor.newInstance(newValue,
|
||||
@@ -105,11 +106,11 @@ public class MeasureEditor extends Container {
|
||||
}
|
||||
}
|
||||
});
|
||||
add(unitBox, BorderLayout.EAST);
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
valueField.setEnabled(false);
|
||||
unitBox.setEnabled(true);
|
||||
add(unitBox, BorderLayout.EAST);
|
||||
|
||||
if (property.isReadOnly()) {
|
||||
valueField.setEnabled(false);
|
||||
unitBox.setEnabled(true);
|
||||
}
|
||||
|
||||
if (!property.isUnique()) {
|
||||
+40
-39
@@ -1,36 +1,37 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class MultiLineStringEditor extends JScrollPane {
|
||||
@@ -48,8 +49,8 @@ public class MultiLineStringEditor extends JScrollPane {
|
||||
public MultiLineStringEditor(PropertyWrapper property) {
|
||||
super();
|
||||
this.property = property;
|
||||
setViewportView(getTextArea());
|
||||
if (property.isReadOnly())
|
||||
setViewportView(getTextArea());
|
||||
if (property.isReadOnly())
|
||||
getTextArea().setEnabled(false);
|
||||
setPreferredSize(new Dimension(192, 64));
|
||||
setBorder(border);
|
||||
@@ -88,11 +89,11 @@ public class MultiLineStringEditor extends JScrollPane {
|
||||
property.setChanged(true);
|
||||
getTextArea().setBackground(oldBg);
|
||||
property.setValue(getTextArea().getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocusInWindow() {
|
||||
getTextArea().selectAll();
|
||||
return getTextArea().requestFocusInWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocusInWindow() {
|
||||
getTextArea().selectAll();
|
||||
return getTextArea().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -39,10 +39,11 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.lang.LangUtil;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
public class PropertyEditorDialog extends ButtonDialog {
|
||||
|
||||
+29
-28
@@ -1,31 +1,32 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class StringEditor extends JTextField {
|
||||
@@ -38,8 +39,8 @@ public class StringEditor extends JTextField {
|
||||
|
||||
public StringEditor(PropertyWrapper property) {
|
||||
super(property.getValue() == null ? "" : (String) property.getValue());
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
this.setColumns(32);
|
||||
getDocument().addDocumentListener(new DocumentListener() {
|
||||
+32
-31
@@ -1,34 +1,35 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.gui.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.DynamicList;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.DynamicList;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class StringListEditor extends JComboBox<Object> {
|
||||
@@ -40,8 +41,8 @@ public class StringListEditor extends JComboBox<Object> {
|
||||
private final PropertyWrapper property;
|
||||
|
||||
public StringListEditor(final PropertyWrapper property) throws Exception {
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
this.property = property;
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
String listFunctionName = property.getGetter().getAnnotation(DynamicList.class).availableValueFunction();
|
||||
Method function = property.getOwnerObject().getClass().getMethod(listFunctionName);
|
||||
+13
-12
@@ -35,13 +35,6 @@ import org.apache.poi.util.IOUtils;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractCurvedComponent.PointCount;
|
||||
import org.diylc.components.connectivity.Dot;
|
||||
import org.diylc.components.connectivity.Line;
|
||||
import org.diylc.components.misc.Image;
|
||||
@@ -49,6 +42,18 @@ import org.diylc.components.misc.Image.ImageSizingMode;
|
||||
import org.diylc.components.misc.Label;
|
||||
import org.diylc.components.misc.LoadlineCurve;
|
||||
import org.diylc.components.misc.LoadlineEntity;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractCurvedComponent.PointCount;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.core.Project;
|
||||
@@ -60,13 +65,9 @@ import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.TranslatedPanel;
|
||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.canvas.CanvasPanel;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
|
||||
public class LoadlineEditorFrame extends JFrame implements IView {
|
||||
|
||||
+1
@@ -32,6 +32,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
+1
@@ -25,6 +25,7 @@ import java.awt.dnd.DragGestureEvent;
|
||||
import java.awt.dnd.DragGestureListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
/**
|
||||
+45
-24
@@ -42,11 +42,13 @@ import javax.swing.AbstractAction;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.common.DrawOption;
|
||||
import org.diylc.common.IBlockProcessor.InvalidBlockException;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.IBlockProcessor.InvalidBlockException;
|
||||
import org.diylc.swing.plugins.tree.TreePanel;
|
||||
import org.diylc.utils.ScaledBufferedImage;
|
||||
|
||||
@@ -97,6 +99,15 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
// GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
|
||||
// screenGraphicsConfiguration = devices[0].getDefaultConfiguration();
|
||||
|
||||
configManager.addConfigListener(IPlugInPort.HIGH_DPI_RENDERING,
|
||||
new IConfigListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(String key, Object value) {
|
||||
bufferImage = null;
|
||||
}
|
||||
});
|
||||
|
||||
initializeActions();
|
||||
}
|
||||
|
||||
@@ -310,8 +321,12 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
}
|
||||
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
double scaleFactor = Math.sqrt(g2d.getTransform().getDeterminant());
|
||||
// scaleFactor = 1d;
|
||||
double scaleFactor;
|
||||
if (configManager.readBoolean(IPlugInPort.HIGH_DPI_RENDERING, false)) {
|
||||
scaleFactor = Math.sqrt(g2d.getTransform().getDeterminant());
|
||||
} else {
|
||||
scaleFactor = 1d;
|
||||
}
|
||||
|
||||
Rectangle visibleRect = getVisibleRect();
|
||||
|
||||
@@ -323,28 +338,9 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
double x = visibleRect.x;// / scaleFactor;
|
||||
double y = visibleRect.y;// / scaleFactor;
|
||||
bufferG2d.translate(-x, -y);
|
||||
bufferG2d.setClip(visibleRect);
|
||||
|
||||
Set<DrawOption> drawOptions =
|
||||
EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
|
||||
|
||||
if (configManager.readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
|
||||
drawOptions.add(DrawOption.ANTIALIASING);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.OUTLINE_KEY, false)) {
|
||||
drawOptions.add(DrawOption.OUTLINE_MODE);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.SHOW_GRID_KEY, true)) {
|
||||
drawOptions.add(DrawOption.GRID);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.EXTRA_SPACE_KEY, true)) {
|
||||
drawOptions.add(DrawOption.EXTRA_SPACE);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.CACHING_ENABLED_KEY, true)) {
|
||||
drawOptions.add(DrawOption.ENABLE_CACHING);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.LOCKED_ALPHA, true)) {
|
||||
drawOptions.add(DrawOption.LOCKED_ALPHA);
|
||||
}
|
||||
Set<DrawOption> drawOptions = getDrawOptions();
|
||||
|
||||
plugInPort.draw(bufferG2d, drawOptions, null, null, scaleFactor, visibleRect);
|
||||
|
||||
@@ -374,6 +370,31 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
bufferG2d.dispose();
|
||||
}
|
||||
|
||||
private Set<DrawOption> getDrawOptions() {
|
||||
Set<DrawOption> drawOptions =
|
||||
EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
|
||||
|
||||
if (configManager.readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
|
||||
drawOptions.add(DrawOption.ANTIALIASING);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.OUTLINE_KEY, false)) {
|
||||
drawOptions.add(DrawOption.OUTLINE_MODE);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.SHOW_GRID_KEY, true)) {
|
||||
drawOptions.add(DrawOption.GRID);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.EXTRA_SPACE_KEY, true)) {
|
||||
drawOptions.add(DrawOption.EXTRA_SPACE);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.CACHING_ENABLED_KEY, true)) {
|
||||
drawOptions.add(DrawOption.ENABLE_CACHING);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.LOCKED_ALPHA, true)) {
|
||||
drawOptions.add(DrawOption.LOCKED_ALPHA);
|
||||
}
|
||||
return drawOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Graphics g) {
|
||||
paint(g);
|
||||
+8
-7
@@ -41,6 +41,14 @@ import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.swingframework.ruler.IRulerListener;
|
||||
import org.diylc.swingframework.ruler.Ruler.InchSubdivision;
|
||||
import org.diylc.swingframework.ruler.RulerScrollPane;
|
||||
import com.guigarage.gestures.GestureMagnificationEvent;
|
||||
import com.guigarage.gestures.GestureMagnificationListener;
|
||||
import com.guigarage.gestures.GestureUtilities;
|
||||
import com.guigarage.gestures.GesturesNotSupportedException;
|
||||
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
@@ -52,13 +60,6 @@ import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.ComponentPopupMenu;
|
||||
import org.diylc.swing.plugins.file.ProjectDrawingProvider;
|
||||
import org.diylc.swingframework.ruler.IRulerListener;
|
||||
import org.diylc.swingframework.ruler.Ruler.InchSubdivision;
|
||||
import org.diylc.swingframework.ruler.RulerScrollPane;
|
||||
import com.guigarage.gestures.GestureMagnificationEvent;
|
||||
import com.guigarage.gestures.GestureMagnificationListener;
|
||||
import com.guigarage.gestures.GestureUtilities;
|
||||
import com.guigarage.gestures.GesturesNotSupportedException;
|
||||
|
||||
public class CanvasPlugin implements IPlugIn{
|
||||
|
||||
+27
-26
@@ -1,31 +1,32 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.plugins.canvas;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.dnd.DragSourceDragEvent;
|
||||
import java.awt.dnd.DragSourceDropEvent;
|
||||
import java.awt.dnd.DragSourceEvent;
|
||||
import java.awt.dnd.DragSourceListener;
|
||||
import java.awt.Point;
|
||||
import java.awt.dnd.DragSourceDragEvent;
|
||||
import java.awt.dnd.DragSourceDropEvent;
|
||||
import java.awt.dnd.DragSourceEvent;
|
||||
import java.awt.dnd.DragSourceListener;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
|
||||
+28
-27
@@ -1,32 +1,33 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.plugins.canvas;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.dnd.DnDConstants;
|
||||
import java.awt.dnd.DropTargetDragEvent;
|
||||
import java.awt.dnd.DropTargetDropEvent;
|
||||
import java.awt.dnd.DropTargetEvent;
|
||||
import java.awt.dnd.DropTargetListener;
|
||||
import java.awt.Point;
|
||||
import java.awt.dnd.DnDConstants;
|
||||
import java.awt.dnd.DropTargetDragEvent;
|
||||
import java.awt.dnd.DropTargetDropEvent;
|
||||
import java.awt.dnd.DropTargetEvent;
|
||||
import java.awt.dnd.DropTargetListener;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
|
||||
+28
-27
@@ -1,32 +1,33 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.plugins.canvas;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.awt.Point;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
|
||||
+53
-52
@@ -1,57 +1,58 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.swing.plugins.cloud;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.presenter.CloudException;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.DummyView;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.LoginDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.UploadDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.UserEditDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.browser.CloudBrowserFrame;
|
||||
import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.presenter.CloudException;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.gui.DummyView;
|
||||
import org.diylc.utils.IconLoader;
|
||||
import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.LoginDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.UploadDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.UserEditDialog;
|
||||
import org.diylc.swing.plugins.cloud.view.browser.CloudBrowserFrame;
|
||||
import org.diylc.swing.plugins.cloud.view.browser.UploadManagerFrame;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
|
||||
public class CloudPlugIn implements IPlugIn {
|
||||
|
||||
private static final String ONLINE_TITLE = "Project Cloud";
|
||||
@@ -60,7 +61,7 @@ public class CloudPlugIn implements IPlugIn {
|
||||
|
||||
private ISwingUI swingUI;
|
||||
private IPlugInPort plugInPort;
|
||||
private IPlugInPort thumbnailPresenter;
|
||||
private IPlugInPort thumbnailPresenter;
|
||||
private ThumbnailGenerator thumbnailGenerator;
|
||||
|
||||
private LibraryAction libraryAction;
|
||||
@@ -80,7 +81,7 @@ public class CloudPlugIn implements IPlugIn {
|
||||
super();
|
||||
|
||||
this.swingUI = swingUI;
|
||||
this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
|
||||
this.thumbnailPresenter = new Presenter(new DummyView(), InMemoryConfigurationManager.getInstance());
|
||||
this.thumbnailGenerator = new ThumbnailGenerator(thumbnailPresenter);
|
||||
|
||||
swingUI.injectMenuAction(getLibraryAction(), ONLINE_TITLE);
|
||||
+1
@@ -28,6 +28,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.diylc.common.DrawOption;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user