mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
mavenization
This commit is contained in:
@@ -9,6 +9,7 @@ import java.awt.geom.AffineTransform;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,10 @@ 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 ca.cgjennings.jvm.JarLoader;
|
||||
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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
@@ -17,7 +20,6 @@ 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;
|
||||
|
||||
public class CheckProximityAction extends AbstractAction implements Cloneable {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -3,6 +3,10 @@ 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;
|
||||
@@ -10,8 +14,6 @@ import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.IDrawingProvider;
|
||||
import org.diylc.swingframework.export.DrawingExporter;
|
||||
|
||||
public class ExportPNGAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -2,8 +2,10 @@ 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;
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ 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;
|
||||
@@ -12,7 +15,6 @@ 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;
|
||||
|
||||
public class GenerateNetlistAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -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,6 +4,9 @@ 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;
|
||||
@@ -11,7 +14,6 @@ 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;
|
||||
|
||||
public class SummarizeNetlistAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@@ -3,6 +3,9 @@ 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;
|
||||
@@ -10,7 +13,6 @@ 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;
|
||||
|
||||
public class EditProjectAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
|
||||
+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;
|
||||
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
|
||||
+1
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
@@ -17,7 +19,6 @@ 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;
|
||||
|
||||
public class NudgeAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
+1
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
|
||||
+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 {
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ 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;
|
||||
@@ -10,8 +14,6 @@ import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+3
-1
@@ -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;
|
||||
@@ -21,7 +24,6 @@ import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swing.plugins.file.NetlistImportDialog;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
public class ImportNetlistAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,6 +6,9 @@ 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;
|
||||
@@ -13,7 +16,6 @@ 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;
|
||||
|
||||
public class NewAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
public class PrintAction extends AbstractAction {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,10 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
public class InfoDialog extends ButtonDialog {
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -32,6 +32,7 @@ import javax.swing.Icon;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
public class SearchTextField extends JTextField {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -63,10 +68,6 @@ import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||
import org.diylc.swing.images.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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,10 +43,11 @@ import javax.swing.JComponent;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.apache.log4j.Logger;
|
||||
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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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.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;
|
||||
|
||||
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+43
-42
@@ -1,47 +1,48 @@
|
||||
/*
|
||||
|
||||
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.view;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.JTextArea;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.CommentEntity;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.CommentEntity;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
|
||||
/**
|
||||
|
||||
+50
-48
@@ -1,50 +1,52 @@
|
||||
/*
|
||||
|
||||
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.view;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.util.List;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
import org.diylc.swing.plugins.cloud.ThumbnailGenerator;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.util.List;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
import org.diylc.swing.plugins.cloud.ThumbnailGenerator;
|
||||
import org.diylc.utils.KeywordExtractor;
|
||||
|
||||
public class UploadDialog extends ButtonDialog {
|
||||
@@ -72,13 +74,13 @@ public class UploadDialog extends ButtonDialog {
|
||||
private JTextField keywordsField;
|
||||
|
||||
private IPlugInPort plugInPort;
|
||||
private String[] categories;
|
||||
|
||||
private String[] categories;
|
||||
|
||||
private ThumbnailGenerator thumbnailGenerator;
|
||||
|
||||
public UploadDialog(JFrame owner, IPlugInPort plugInPort, String[] categories, boolean isUpdate) {
|
||||
super(owner, isUpdate ? "Re-Upload A Project" : "Upload A Project", new String[] {OK, CANCEL});
|
||||
this.plugInPort = plugInPort;
|
||||
this.plugInPort = plugInPort;
|
||||
this.thumbnailGenerator = new ThumbnailGenerator(plugInPort);
|
||||
this.categories = categories;
|
||||
layoutGui();
|
||||
|
||||
+41
-39
@@ -1,46 +1,48 @@
|
||||
/*
|
||||
|
||||
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.view;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import org.diylc.plugins.cloud.model.UserEntity;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.plugins.cloud.model.UserEntity;
|
||||
import org.diylc.swing.gui.components.HTMLTextArea;
|
||||
|
||||
public class UserEditDialog extends ButtonDialog {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+41
-40
@@ -1,45 +1,46 @@
|
||||
/*
|
||||
|
||||
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.view.browser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.image.VolatileImage;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.image.VolatileImage;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.Timer;
|
||||
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
/**
|
||||
|
||||
+50
-49
@@ -1,54 +1,55 @@
|
||||
/*
|
||||
|
||||
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.view.browser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.plugins.cloud.presenter.SearchSession;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.plugins.cloud.presenter.SearchSession;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.Pair;
|
||||
|
||||
/**
|
||||
|
||||
+317
-316
@@ -51,6 +51,8 @@ import javax.swing.SwingWorker;
|
||||
import javax.swing.text.DefaultCaret;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
@@ -70,7 +72,6 @@ import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.swing.plugins.cloud.ThumbnailGenerator;
|
||||
import org.diylc.swing.plugins.cloud.view.CommentDialog;
|
||||
import org.diylc.swing.plugins.file.FileFilterEnum;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.Pair;
|
||||
|
||||
/**
|
||||
@@ -206,191 +207,191 @@ public class ResultsScrollPanel extends JScrollPane {
|
||||
}
|
||||
}
|
||||
|
||||
private JComponent addProjectToDisplay(final ProjectEntity project) {
|
||||
final JLabel thumbnailLabel = new JLabel(loadImage(project.getThumbnailUrl()));
|
||||
final JLabel nameLabel = new JLabel("<html><b>" + project.getName() + "</b></html>");
|
||||
nameLabel.setFont(nameLabel.getFont().deriveFont(12f));
|
||||
|
||||
final JTextArea descriptionArea = new HTMLTextArea(project.getDescription());
|
||||
descriptionArea.setEditable(false);
|
||||
descriptionArea.setFont(thumbnailLabel.getFont());
|
||||
descriptionArea.setLineWrap(true);
|
||||
descriptionArea.setWrapStyleWord(true);
|
||||
descriptionArea.setFocusable(false);
|
||||
descriptionArea.setRequestFocusEnabled(false);
|
||||
DefaultCaret caret = (DefaultCaret) descriptionArea.getCaret();
|
||||
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
|
||||
descriptionArea.setEnabled(false);
|
||||
|
||||
final JLabel commentLabel =
|
||||
new JLabel(Integer.toString(project.getCommentCount()), IconLoader.Messages.getIcon(), SwingConstants.LEFT);
|
||||
commentLabel.setToolTipText("Click to see and add public comments");
|
||||
commentLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
commentLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
cloudUI.executeBackgroundTask(new ITask<List<CommentEntity>>() {
|
||||
|
||||
@Override
|
||||
public List<CommentEntity> doInBackground() throws Exception {
|
||||
return CloudPresenter.Instance.getComments(project.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not open file. Detailed message is in the logs.", "Cloud Error",
|
||||
IView.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(List<CommentEntity> result) {
|
||||
CommentDialog dialog = new CommentDialog(cloudUI, project, result);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel viewLabel =
|
||||
new JLabel(Integer.toString(project.getViewCount()), IconLoader.Eye.getIcon(), SwingConstants.LEFT);
|
||||
viewLabel.setToolTipText("View count");
|
||||
|
||||
final JLabel downloadLabel =
|
||||
new JLabel(Integer.toString(project.getDownloadCount()), IconLoader.Download.getIcon(), SwingConstants.LEFT);
|
||||
downloadLabel.setToolTipText("Download count");
|
||||
|
||||
final JLabel categoryLabel = new JLabel("<html>Category: <b>" + project.getCategory() + "</b></html>");
|
||||
final JLabel authorLabel = new JLabel("<html>Author: <b>" + project.getOwner() + "</b></html>");
|
||||
final JLabel updatedLabel = new JLabel("<html>Last updated: <b>" + project.getUpdated() + "</b></html>");
|
||||
|
||||
final JLabel downloadButton = new JLabel(IconLoader.CloudDownload.getIcon());
|
||||
downloadButton.setFocusable(true);
|
||||
downloadButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
downloadButton.setToolTipText("Download to local drive");
|
||||
downloadButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
final File file =
|
||||
DialogFactory.getInstance().showSaveDialog((JFrame) cloudUI, FileFilterEnum.DIY.getFilter(),
|
||||
new File(project.getName() + ".diy"), FileFilterEnum.DIY.getExtensions()[0], null);
|
||||
if (file != null) {
|
||||
cloudUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
LOG.debug("Downloading project to " + file.getAbsolutePath());
|
||||
URL website = new URL(project.getDownloadUrl());
|
||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
if (cloudUI.showConfirmDialog("Project downloaded to " + file.getAbsolutePath()
|
||||
+ ".\nDo you want to open it?", "Cloud", ISwingUI.YES_NO_OPTION, ISwingUI.INFORMATION_MESSAGE) == IView.YES_OPTION) {
|
||||
if (!plugInPort.allowFileAction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
LOG.debug("Opening from " + file.getAbsolutePath());
|
||||
plugInPort.loadProjectFromFile(file.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
mainUI.bringToFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
mainUI.showMessage("Could not open file. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not save to file. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel spacerLabel = new JLabel();
|
||||
final JSeparator separator = new JSeparator();
|
||||
|
||||
final JPanel buttonPanel = new JPanel(new FlowLayout());
|
||||
|
||||
final JLabel editButton = new JLabel(IconLoader.CloudEdit.getIcon());
|
||||
editButton.setFocusable(true);
|
||||
editButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
editButton.setToolTipText("Edit details without changing the project file");
|
||||
editButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
List<PropertyWrapper> projectProperties = CloudPresenter.Instance.getProjectProperties(project);
|
||||
PropertyEditorDialog editor =
|
||||
DialogFactory.getInstance().createPropertyEditorDialog(cloudUI.getOwnerFrame(), projectProperties,
|
||||
"Edit Published Project", true);
|
||||
editor.setVisible(true);
|
||||
if (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) {
|
||||
// Update the project
|
||||
for (PropertyWrapper property : projectProperties) {
|
||||
try {
|
||||
property.writeTo(project);
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Could not update the project", ex);
|
||||
cloudUI.showMessage("Could not update the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cloudUI.executeBackgroundTask(new ITask<ProjectEntity>() {
|
||||
|
||||
@Override
|
||||
public ProjectEntity doInBackground() throws Exception {
|
||||
CloudPresenter.Instance.updateProjectDetails(project, plugInPort.getCurrentVersionNumber().toString());
|
||||
return CloudPresenter.Instance.fetchUserUploads(project.getId()).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not update the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(ProjectEntity result) {
|
||||
nameLabel.setText("<html><b>" + project.getName() + "</b></html>");
|
||||
descriptionArea.setText(result.getDescription());
|
||||
categoryLabel.setText("<html>Category: <b>" + result.getCategory() + "</b></html>");
|
||||
updatedLabel.setText("<html>Last updated: <b>" + result.getUpdated() + "</b></html>");
|
||||
cloudUI.showMessage("The project has been updated successfully.", "Upload Success",
|
||||
IView.INFORMATION_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel replaceButton = new JLabel(IconLoader.CloudUpload.getIcon());
|
||||
replaceButton.setFocusable(true);
|
||||
replaceButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
replaceButton.setToolTipText("Replace project with a new version");
|
||||
private JComponent addProjectToDisplay(final ProjectEntity project) {
|
||||
final JLabel thumbnailLabel = new JLabel(loadImage(project.getThumbnailUrl()));
|
||||
final JLabel nameLabel = new JLabel("<html><b>" + project.getName() + "</b></html>");
|
||||
nameLabel.setFont(nameLabel.getFont().deriveFont(12f));
|
||||
|
||||
final JTextArea descriptionArea = new HTMLTextArea(project.getDescription());
|
||||
descriptionArea.setEditable(false);
|
||||
descriptionArea.setFont(thumbnailLabel.getFont());
|
||||
descriptionArea.setLineWrap(true);
|
||||
descriptionArea.setWrapStyleWord(true);
|
||||
descriptionArea.setFocusable(false);
|
||||
descriptionArea.setRequestFocusEnabled(false);
|
||||
DefaultCaret caret = (DefaultCaret) descriptionArea.getCaret();
|
||||
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
|
||||
descriptionArea.setEnabled(false);
|
||||
|
||||
final JLabel commentLabel =
|
||||
new JLabel(Integer.toString(project.getCommentCount()), IconLoader.Messages.getIcon(), SwingConstants.LEFT);
|
||||
commentLabel.setToolTipText("Click to see and add public comments");
|
||||
commentLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
commentLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
cloudUI.executeBackgroundTask(new ITask<List<CommentEntity>>() {
|
||||
|
||||
@Override
|
||||
public List<CommentEntity> doInBackground() throws Exception {
|
||||
return CloudPresenter.Instance.getComments(project.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not open file. Detailed message is in the logs.", "Cloud Error",
|
||||
IView.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(List<CommentEntity> result) {
|
||||
CommentDialog dialog = new CommentDialog(cloudUI, project, result);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel viewLabel =
|
||||
new JLabel(Integer.toString(project.getViewCount()), IconLoader.Eye.getIcon(), SwingConstants.LEFT);
|
||||
viewLabel.setToolTipText("View count");
|
||||
|
||||
final JLabel downloadLabel =
|
||||
new JLabel(Integer.toString(project.getDownloadCount()), IconLoader.Download.getIcon(), SwingConstants.LEFT);
|
||||
downloadLabel.setToolTipText("Download count");
|
||||
|
||||
final JLabel categoryLabel = new JLabel("<html>Category: <b>" + project.getCategory() + "</b></html>");
|
||||
final JLabel authorLabel = new JLabel("<html>Author: <b>" + project.getOwner() + "</b></html>");
|
||||
final JLabel updatedLabel = new JLabel("<html>Last updated: <b>" + project.getUpdated() + "</b></html>");
|
||||
|
||||
final JLabel downloadButton = new JLabel(IconLoader.CloudDownload.getIcon());
|
||||
downloadButton.setFocusable(true);
|
||||
downloadButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
downloadButton.setToolTipText("Download to local drive");
|
||||
downloadButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
final File file =
|
||||
DialogFactory.getInstance().showSaveDialog((JFrame) cloudUI, FileFilterEnum.DIY.getFilter(),
|
||||
new File(project.getName() + ".diy"), FileFilterEnum.DIY.getExtensions()[0], null);
|
||||
if (file != null) {
|
||||
cloudUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
LOG.debug("Downloading project to " + file.getAbsolutePath());
|
||||
URL website = new URL(project.getDownloadUrl());
|
||||
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
if (cloudUI.showConfirmDialog("Project downloaded to " + file.getAbsolutePath()
|
||||
+ ".\nDo you want to open it?", "Cloud", ISwingUI.YES_NO_OPTION, ISwingUI.INFORMATION_MESSAGE) == IView.YES_OPTION) {
|
||||
if (!plugInPort.allowFileAction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
LOG.debug("Opening from " + file.getAbsolutePath());
|
||||
plugInPort.loadProjectFromFile(file.getAbsolutePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
mainUI.bringToFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
mainUI.showMessage("Could not open file. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not save to file. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel spacerLabel = new JLabel();
|
||||
final JSeparator separator = new JSeparator();
|
||||
|
||||
final JPanel buttonPanel = new JPanel(new FlowLayout());
|
||||
|
||||
final JLabel editButton = new JLabel(IconLoader.CloudEdit.getIcon());
|
||||
editButton.setFocusable(true);
|
||||
editButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
editButton.setToolTipText("Edit details without changing the project file");
|
||||
editButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
List<PropertyWrapper> projectProperties = CloudPresenter.Instance.getProjectProperties(project);
|
||||
PropertyEditorDialog editor =
|
||||
DialogFactory.getInstance().createPropertyEditorDialog(cloudUI.getOwnerFrame(), projectProperties,
|
||||
"Edit Published Project", true);
|
||||
editor.setVisible(true);
|
||||
if (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) {
|
||||
// Update the project
|
||||
for (PropertyWrapper property : projectProperties) {
|
||||
try {
|
||||
property.writeTo(project);
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Could not update the project", ex);
|
||||
cloudUI.showMessage("Could not update the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cloudUI.executeBackgroundTask(new ITask<ProjectEntity>() {
|
||||
|
||||
@Override
|
||||
public ProjectEntity doInBackground() throws Exception {
|
||||
CloudPresenter.Instance.updateProjectDetails(project, plugInPort.getCurrentVersionNumber().toString());
|
||||
return CloudPresenter.Instance.fetchUserUploads(project.getId()).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not update the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(ProjectEntity result) {
|
||||
nameLabel.setText("<html><b>" + project.getName() + "</b></html>");
|
||||
descriptionArea.setText(result.getDescription());
|
||||
categoryLabel.setText("<html>Category: <b>" + result.getCategory() + "</b></html>");
|
||||
updatedLabel.setText("<html>Last updated: <b>" + result.getUpdated() + "</b></html>");
|
||||
cloudUI.showMessage("The project has been updated successfully.", "Upload Success",
|
||||
IView.INFORMATION_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel replaceButton = new JLabel(IconLoader.CloudUpload.getIcon());
|
||||
replaceButton.setFocusable(true);
|
||||
replaceButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
replaceButton.setToolTipText("Replace project with a new version");
|
||||
replaceButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -460,136 +461,136 @@ public class ResultsScrollPanel extends JScrollPane {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final JLabel deleteButton = new JLabel(IconLoader.CloudDelete.getIcon());
|
||||
deleteButton.setFocusable(true);
|
||||
deleteButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
deleteButton.setToolTipText("Delete from the cloud");
|
||||
deleteButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (cloudUI.showConfirmDialog("Are you sure you want to permanently delete project \"" + project.getName()
|
||||
+ "\" from the cloud?", "Delete Project", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE) == IView.YES_OPTION) {
|
||||
LOG.info("Deleting project " + project.getName() + "(" + project.getId() + ")");
|
||||
cloudUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
CloudPresenter.Instance.deleteProject(project.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not delete the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
getResultsPanel().remove(thumbnailLabel);
|
||||
getResultsPanel().remove(nameLabel);
|
||||
getResultsPanel().remove(spacerLabel);
|
||||
getResultsPanel().remove(commentLabel);
|
||||
getResultsPanel().remove(viewLabel);
|
||||
getResultsPanel().remove(downloadLabel);
|
||||
getResultsPanel().remove(descriptionArea);
|
||||
getResultsPanel().remove(categoryLabel);
|
||||
getResultsPanel().remove(buttonPanel);
|
||||
getResultsPanel().remove(authorLabel);
|
||||
getResultsPanel().remove(updatedLabel);
|
||||
getResultsPanel().remove(separator);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttonPanel.setBackground(Color.white);
|
||||
buttonPanel.add(downloadButton);
|
||||
if (showEditControls) {
|
||||
buttonPanel.add(editButton);
|
||||
buttonPanel.add(replaceButton);
|
||||
buttonPanel.add(deleteButton);
|
||||
}
|
||||
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = currentLocation * 6;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.gridheight = 5;
|
||||
gbc.weightx = 0;
|
||||
getResultsPanel().add(thumbnailLabel, gbc);
|
||||
|
||||
gbc.gridheight = 1;
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 1000;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
getResultsPanel().add(nameLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 0.1;
|
||||
getResultsPanel().add(spacerLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 0;
|
||||
getResultsPanel().add(commentLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
getResultsPanel().add(viewLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
getResultsPanel().add(downloadLabel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 1;
|
||||
gbc.weighty = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.gridwidth = 6;
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
getResultsPanel().add(descriptionArea, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.weighty = 0;
|
||||
getResultsPanel().add(categoryLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridheight = 3;
|
||||
gbc.gridwidth = 4;
|
||||
gbc.weightx = 0;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
gbc.anchor = GridBagConstraints.SOUTHEAST;
|
||||
getResultsPanel().add(buttonPanel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.gridheight = 1;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
getResultsPanel().add(authorLabel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
getResultsPanel().add(updatedLabel, gbc);
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.gridwidth = 6;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbc.weightx = 1;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
getResultsPanel().add(separator, gbc);
|
||||
|
||||
return nameLabel;
|
||||
});
|
||||
|
||||
final JLabel deleteButton = new JLabel(IconLoader.CloudDelete.getIcon());
|
||||
deleteButton.setFocusable(true);
|
||||
deleteButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
deleteButton.setToolTipText("Delete from the cloud");
|
||||
deleteButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (cloudUI.showConfirmDialog("Are you sure you want to permanently delete project \"" + project.getName()
|
||||
+ "\" from the cloud?", "Delete Project", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE) == IView.YES_OPTION) {
|
||||
LOG.info("Deleting project " + project.getName() + "(" + project.getId() + ")");
|
||||
cloudUI.executeBackgroundTask(new ITask<Void>() {
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
CloudPresenter.Instance.deleteProject(project.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Exception e) {
|
||||
cloudUI.showMessage("Could not delete the project. Detailed message is in the logs.", "Error",
|
||||
ISwingUI.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Void result) {
|
||||
getResultsPanel().remove(thumbnailLabel);
|
||||
getResultsPanel().remove(nameLabel);
|
||||
getResultsPanel().remove(spacerLabel);
|
||||
getResultsPanel().remove(commentLabel);
|
||||
getResultsPanel().remove(viewLabel);
|
||||
getResultsPanel().remove(downloadLabel);
|
||||
getResultsPanel().remove(descriptionArea);
|
||||
getResultsPanel().remove(categoryLabel);
|
||||
getResultsPanel().remove(buttonPanel);
|
||||
getResultsPanel().remove(authorLabel);
|
||||
getResultsPanel().remove(updatedLabel);
|
||||
getResultsPanel().remove(separator);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttonPanel.setBackground(Color.white);
|
||||
buttonPanel.add(downloadButton);
|
||||
if (showEditControls) {
|
||||
buttonPanel.add(editButton);
|
||||
buttonPanel.add(replaceButton);
|
||||
buttonPanel.add(deleteButton);
|
||||
}
|
||||
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = currentLocation * 6;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.gridheight = 5;
|
||||
gbc.weightx = 0;
|
||||
getResultsPanel().add(thumbnailLabel, gbc);
|
||||
|
||||
gbc.gridheight = 1;
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 1000;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
getResultsPanel().add(nameLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 0.1;
|
||||
getResultsPanel().add(spacerLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.weightx = 0;
|
||||
getResultsPanel().add(commentLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
getResultsPanel().add(viewLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
getResultsPanel().add(downloadLabel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 1;
|
||||
gbc.weighty = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.gridwidth = 6;
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
getResultsPanel().add(descriptionArea, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.weighty = 0;
|
||||
getResultsPanel().add(categoryLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridheight = 3;
|
||||
gbc.gridwidth = 4;
|
||||
gbc.weightx = 0;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
gbc.anchor = GridBagConstraints.SOUTHEAST;
|
||||
getResultsPanel().add(buttonPanel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 1;
|
||||
gbc.gridheight = 1;
|
||||
gbc.insets = new Insets(2, 6, 2, 2);
|
||||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
getResultsPanel().add(authorLabel, gbc);
|
||||
|
||||
gbc.gridy++;
|
||||
getResultsPanel().add(updatedLabel, gbc);
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.gridwidth = 6;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbc.weightx = 1;
|
||||
gbc.insets = new Insets(2, 2, 2, 2);
|
||||
getResultsPanel().add(separator, gbc);
|
||||
|
||||
return nameLabel;
|
||||
}
|
||||
|
||||
public JLabel getTopLabel() {
|
||||
|
||||
+32
-31
@@ -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.plugins.cloud.view.browser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
public class SearchHeaderPanel extends JPanel {
|
||||
|
||||
+33
-32
@@ -1,37 +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.plugins.cloud.view.browser;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
/**
|
||||
|
||||
+36
-35
@@ -1,40 +1,41 @@
|
||||
/*
|
||||
|
||||
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.view.browser;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.swing.ISimpleView;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
|
||||
public class UploadManagerFrame extends JFrame implements ISimpleView {
|
||||
|
||||
@@ -26,10 +26,15 @@ import javax.swing.Icon;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
import org.diylc.components.autocreate.SolderPadAutoCreator;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.components.autocreate.SolderPadAutoCreator;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.flags.FlagLoader;
|
||||
import org.diylc.lang.LangUtil;
|
||||
@@ -38,9 +43,6 @@ import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.images.IconLoader;
|
||||
import org.diylc.utils.ResourceLoader;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
|
||||
/**
|
||||
* Controls configuration menu.
|
||||
|
||||
@@ -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.plugins.edit;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.FlavorEvent;
|
||||
import java.awt.datatransfer.FlavorListener;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.util.EnumSet;
|
||||
import org.diylc.appframework.undo.IUndoListener;
|
||||
import org.diylc.appframework.undo.UndoHandler;
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.actions.FindAction;
|
||||
import org.diylc.swing.actions.FlexibleLeadsAction;
|
||||
import org.diylc.swing.actions.RenumberAction;
|
||||
import org.diylc.swing.actions.edit.BringToFrontAction;
|
||||
import org.diylc.swing.actions.edit.CopyAction;
|
||||
import org.diylc.swing.actions.edit.CutAction;
|
||||
import org.diylc.swing.actions.edit.DeleteSelectionAction;
|
||||
import org.diylc.swing.actions.edit.DuplicateAction;
|
||||
import org.diylc.swing.actions.edit.EditSelectionAction;
|
||||
import org.diylc.swing.actions.edit.ExpandSelectionAction;
|
||||
import org.diylc.swing.actions.edit.GroupAction;
|
||||
import org.diylc.swing.actions.edit.MirrorSelectionAction;
|
||||
import org.diylc.swing.actions.edit.NudgeAction;
|
||||
import org.diylc.swing.actions.edit.PasteAction;
|
||||
import org.diylc.swing.actions.edit.RotateSelectionAction;
|
||||
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 java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.FlavorEvent;
|
||||
import java.awt.datatransfer.FlavorListener;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.util.EnumSet;
|
||||
import org.diylc.appframework.undo.IUndoListener;
|
||||
import org.diylc.appframework.undo.UndoHandler;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.actions.FindAction;
|
||||
import org.diylc.swing.actions.FlexibleLeadsAction;
|
||||
import org.diylc.swing.actions.RenumberAction;
|
||||
import org.diylc.swing.actions.edit.BringToFrontAction;
|
||||
import org.diylc.swing.actions.edit.CopyAction;
|
||||
import org.diylc.swing.actions.edit.CutAction;
|
||||
import org.diylc.swing.actions.edit.DeleteSelectionAction;
|
||||
import org.diylc.swing.actions.edit.DuplicateAction;
|
||||
import org.diylc.swing.actions.edit.EditSelectionAction;
|
||||
import org.diylc.swing.actions.edit.ExpandSelectionAction;
|
||||
import org.diylc.swing.actions.edit.GroupAction;
|
||||
import org.diylc.swing.actions.edit.MirrorSelectionAction;
|
||||
import org.diylc.swing.actions.edit.NudgeAction;
|
||||
import org.diylc.swing.actions.edit.PasteAction;
|
||||
import org.diylc.swing.actions.edit.RotateSelectionAction;
|
||||
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;
|
||||
|
||||
public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
@@ -93,8 +94,8 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
private RotateSelectionAction rotateClockwiseAction;
|
||||
private RotateSelectionAction rotateCounterClockwiseAction;
|
||||
private MirrorSelectionAction mirrorHorizontallyAction;
|
||||
private MirrorSelectionAction mirrorVerticallyAction;
|
||||
private FindAction findAction;
|
||||
private MirrorSelectionAction mirrorVerticallyAction;
|
||||
private FindAction findAction;
|
||||
private FlexibleLeadsAction flexibleLeadsAction;
|
||||
|
||||
private UndoHandler<Project> undoHandler;
|
||||
@@ -282,18 +283,18 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
ActionFactory.getInstance().createMirrorSelectionAction(plugInPort, IComponentTransformer.VERTICAL);
|
||||
}
|
||||
return mirrorVerticallyAction;
|
||||
}
|
||||
|
||||
public FindAction getFindAction() {
|
||||
if (findAction == null)
|
||||
findAction = ActionFactory.getInstance().createFindAction(plugInPort, swingUI);
|
||||
return findAction;
|
||||
}
|
||||
|
||||
public FlexibleLeadsAction getFlexibleLeadsAction() {
|
||||
if (flexibleLeadsAction == null)
|
||||
flexibleLeadsAction = ActionFactory.getInstance().createFlexibleLeadsAction(plugInPort);
|
||||
return flexibleLeadsAction;
|
||||
}
|
||||
|
||||
public FindAction getFindAction() {
|
||||
if (findAction == null)
|
||||
findAction = ActionFactory.getInstance().createFindAction(plugInPort, swingUI);
|
||||
return findAction;
|
||||
}
|
||||
|
||||
public FlexibleLeadsAction getFlexibleLeadsAction() {
|
||||
if (flexibleLeadsAction == null)
|
||||
flexibleLeadsAction = ActionFactory.getInstance().createFlexibleLeadsAction(plugInPort);
|
||||
return flexibleLeadsAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -309,7 +310,7 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
swingUI.injectMenuAction(getCopyAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getPasteAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getDuplicateAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getFindAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(actionFactory.createSelectAllAction(plugInPort), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getEditSelectionAction(), EDIT_TITLE);
|
||||
@@ -337,8 +338,8 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
swingUI.injectMenuAction(getExpandSelectionAllAction(), EXPAND_TITLE);
|
||||
swingUI.injectMenuAction(getExpandSelectionImmediateAction(), EXPAND_TITLE);
|
||||
swingUI.injectMenuAction(getExpandSelectionSameTypeAction(), EXPAND_TITLE);
|
||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getFlexibleLeadsAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||
swingUI.injectMenuAction(getFlexibleLeadsAction(), EDIT_TITLE);
|
||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||
swingUI.injectMenuAction(actionFactory.createEditProjectAction(plugInPort), EDIT_TITLE);
|
||||
|
||||
@@ -392,7 +393,7 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||
getMirrorHorizontallyAction().setEnabled(enabled);
|
||||
getMirrorVerticallyAction().setEnabled(enabled);
|
||||
getSaveAsTemplateAction().setEnabled(enabled);
|
||||
getSaveAsBlockAction().setEnabled(enabled);
|
||||
getSaveAsBlockAction().setEnabled(enabled);
|
||||
getFlexibleLeadsAction().setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user