add usage tips

This commit is contained in:
Branislav Stojkovic
2018-12-17 00:18:14 +01:00
parent 2bf7de07f3
commit d8b7e99044
9 changed files with 1667 additions and 1569 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
<property name="jar.dir" value="${build.dir}/jar" /> <property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/junitreport" /> <property name="report.dir" value="${build.dir}/junitreport" />
<property name="main.class" value="org.diylc.DIYLCStarter" /> <property name="main.class" value="org.diylc.DIYLCStarter" />
<property name="diylc.version" value="3.42.0" /> <property name="diylc.version" value="3.42.1" />
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" /> <property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" /> <property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
Binary file not shown.
@@ -62,7 +62,7 @@ public enum IconLoader {
"pin_green.png"), CoffeebeanEdit("coffeebean_edit.png"), ApplicationEdit("application_edit.png"), ComponentAdd( "pin_green.png"), CoffeebeanEdit("coffeebean_edit.png"), ApplicationEdit("application_edit.png"), ComponentAdd(
"component_add.png"), History("history.png"), DocumentPlain("document_plain.png"), FitToSize("fit_to_size.png"), DocumentsGear( "component_add.png"), History("history.png"), DocumentPlain("document_plain.png"), FitToSize("fit_to_size.png"), DocumentsGear(
"documents_gear.png"), SplashResistor("splash_resistor.png"), SplashCeramic("splash_ceramic.png"), SplashElectrolytic( "documents_gear.png"), SplashResistor("splash_resistor.png"), SplashCeramic("splash_ceramic.png"), SplashElectrolytic(
"splash_electrolytic.png"), SplashFilm("splash_film.png"), Splash("splash.png"); "splash_electrolytic.png"), SplashFilm("splash_film.png"), Splash("splash.png"), Help("help2.png");
protected String name; protected String name;
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -1,24 +1,20 @@
/* /*
*
DIY Layout Creator (DIYLC). * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
Copyright (c) 2009-2018 held jointly by the individual authors. *
* This file is part of DIYLC.
This file is part of DIYLC. *
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
DIYLC is free software: you can redistribute it and/or modify * General Public License as published by the Free Software Foundation, either version 3 of the
it under the terms of the GNU General Public License as published by * License, or (at your option) any later version.
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
DIYLC is distributed in the hope that it will be useful, * Public License for more details.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * You should have received a copy of the GNU General Public License along with DIYLC. If not, see
GNU General Public License for more details. * <http://www.gnu.org/licenses/>.
*/
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; package org.diylc.swing;
import java.awt.Toolkit; import java.awt.Toolkit;
@@ -201,6 +197,11 @@ public class ActionFactory {
return new ConfigAction(plugInPort, title, configKey, defaultValue); return new ConfigAction(plugInPort, title, configKey, defaultValue);
} }
public ConfigAction createConfigAction(IPlugInPort plugInPort, String title, String configKey, boolean defaultValue,
String tipKey) {
return new ConfigAction(plugInPort, title, configKey, defaultValue, tipKey);
}
public ThemeAction createThemeAction(IPlugInPort plugInPort, Theme theme) { public ThemeAction createThemeAction(IPlugInPort plugInPort, Theme theme) {
return new ThemeAction(plugInPort, theme); return new ThemeAction(plugInPort, theme);
} }
@@ -748,7 +749,7 @@ public class ActionFactory {
putValue(AbstractAction.NAME, "Duplicate"); putValue(AbstractAction.NAME, "Duplicate");
putValue(AbstractAction.ACCELERATOR_KEY, putValue(AbstractAction.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentsGear.getIcon()); putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentsGear.getIcon());
} }
@Override @Override
@@ -1146,20 +1147,30 @@ public class ActionFactory {
private IPlugInPort plugInPort; private IPlugInPort plugInPort;
private String configKey; private String configKey;
private String tipKey;
public ConfigAction(IPlugInPort plugInPort, String title, String configKey, boolean defaultValue) { public ConfigAction(IPlugInPort plugInPort, String title, String configKey, boolean defaultValue, String tipKey) {
super(); super();
this.plugInPort = plugInPort; this.plugInPort = plugInPort;
this.configKey = configKey; this.configKey = configKey;
this.tipKey = tipKey;
putValue(AbstractAction.NAME, title); putValue(AbstractAction.NAME, title);
putValue(IView.CHECK_BOX_MENU_ITEM, true); putValue(IView.CHECK_BOX_MENU_ITEM, true);
putValue(AbstractAction.SELECTED_KEY, ConfigurationManager.getInstance().readBoolean(configKey, defaultValue)); putValue(AbstractAction.SELECTED_KEY, ConfigurationManager.getInstance().readBoolean(configKey, defaultValue));
} }
public ConfigAction(IPlugInPort plugInPort, String title, String configKey, boolean defaultValue) {
this(plugInPort, title, configKey, defaultValue, null);
}
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
LOG.info(getValue(AbstractAction.NAME) + " triggered"); LOG.info(getValue(AbstractAction.NAME) + " triggered");
ConfigurationManager.getInstance().writeValue(configKey, getValue(AbstractAction.SELECTED_KEY)); ConfigurationManager.getInstance().writeValue(configKey, getValue(AbstractAction.SELECTED_KEY));
if ((Boolean) getValue(AbstractAction.SELECTED_KEY) && tipKey != null
&& !ConfigurationManager.getInstance().readBoolean(tipKey + ".dismissed", false)) {
DialogFactory.getInstance().createInfoDialog(tipKey).setVisible(true);
}
plugInPort.refresh(); plugInPort.refresh();
} }
} }
@@ -1,24 +1,20 @@
/* /*
*
DIY Layout Creator (DIYLC). * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
Copyright (c) 2009-2018 held jointly by the individual authors. *
* This file is part of DIYLC.
This file is part of DIYLC. *
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
DIYLC is free software: you can redistribute it and/or modify * General Public License as published by the Free Software Foundation, either version 3 of the
it under the terms of the GNU General Public License as published by * License, or (at your option) any later version.
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
DIYLC is distributed in the hope that it will be useful, * Public License for more details.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * You should have received a copy of the GNU General Public License along with DIYLC. If not, see
GNU General Public License for more details. * <http://www.gnu.org/licenses/>.
*/
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; package org.diylc.swing.gui;
import java.awt.Window; import java.awt.Window;
@@ -35,6 +31,7 @@ import org.diylc.common.IPlugInPort;
import org.diylc.common.PropertyWrapper; import org.diylc.common.PropertyWrapper;
import org.diylc.plugins.cloud.model.UserEntity; import org.diylc.plugins.cloud.model.UserEntity;
import org.diylc.swing.gui.components.OverwritePromptFileChooser; import org.diylc.swing.gui.components.OverwritePromptFileChooser;
import org.diylc.swing.gui.editor.InfoDialog;
import org.diylc.swing.gui.editor.PropertyEditorDialog; import org.diylc.swing.gui.editor.PropertyEditorDialog;
import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog; import org.diylc.swing.plugins.cloud.view.ChangePasswordDialog;
import org.diylc.swing.plugins.cloud.view.LoginDialog; import org.diylc.swing.plugins.cloud.view.LoginDialog;
@@ -78,15 +75,21 @@ public class DialogFactory {
} }
} }
public PropertyEditorDialog createPropertyEditorDialog(List<PropertyWrapper> properties, String title, boolean saveDefaults) { public PropertyEditorDialog createPropertyEditorDialog(List<PropertyWrapper> properties, String title,
boolean saveDefaults) {
return createPropertyEditorDialog(mainFrame, properties, title, saveDefaults); return createPropertyEditorDialog(mainFrame, properties, title, saveDefaults);
} }
public PropertyEditorDialog createPropertyEditorDialog(JFrame owner, List<PropertyWrapper> properties, String title, boolean saveDefaults) { public PropertyEditorDialog createPropertyEditorDialog(JFrame owner, List<PropertyWrapper> properties, String title,
boolean saveDefaults) {
PropertyEditorDialog editor = new PropertyEditorDialog(owner, properties, title, saveDefaults); PropertyEditorDialog editor = new PropertyEditorDialog(owner, properties, title, saveDefaults);
return editor; return editor;
} }
public InfoDialog createInfoDialog(String tipKey) {
return new InfoDialog(mainFrame, tipKey);
}
public BomDialog createBomDialog(List<BomEntry> bom) { public BomDialog createBomDialog(List<BomEntry> bom) {
BomDialog dialog = new BomDialog(mainFrame, bom); BomDialog dialog = new BomDialog(mainFrame, bom);
return dialog; return dialog;
@@ -0,0 +1,72 @@
/*
*
* 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.Dimension;
import java.util.Arrays;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.common.IPlugInPort;
import org.diylc.images.IconLoader;
import org.diylc.swingframework.ButtonDialog;
public class InfoDialog extends ButtonDialog {
private static final long serialVersionUID = 1L;
private String message;
private String tipKey;
public InfoDialog(JFrame owner, String tipKey) {
super(owner, "Usage Tip", new String[] {"OK", "Dismiss"});
this.tipKey = tipKey;
int index = Arrays.asList(tipKeys).indexOf(tipKey);
this.message = messages[index];
setMinimumSize(new Dimension(240, 40));
layoutGui();
setLocationRelativeTo(owner);
}
@Override
protected JComponent getMainComponent() {
JLabel label = new JLabel("<html>" + message + "</html>");
label.setIcon(IconLoader.Help.getIcon());
label.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));
label.setIconTextGap(8);
return label;
}
@Override
public void setVisible(boolean b) {
if (!b && getSelectedButtonCaption() == "Dismiss")
ConfigurationManager.getInstance().writeValue(tipKey + ".dismissed", true);
super.setVisible(b);
}
private static String[] tipKeys = new String[] {IPlugInPort.HIGHLIGHT_CONTINUITY_AREA};
private static String[] messages =
new String[] {"Click on a component to highlight continuity area directly or indirectly connected to it.<br>In this mode components cannot be moved or edited. In order to continue editing,<br>this mode needs to be switched OFF."};
}
@@ -1,24 +1,20 @@
/* /*
*
DIY Layout Creator (DIYLC). * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
Copyright (c) 2009-2018 held jointly by the individual authors. *
* This file is part of DIYLC.
This file is part of DIYLC. *
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
DIYLC is free software: you can redistribute it and/or modify * General Public License as published by the Free Software Foundation, either version 3 of the
it under the terms of the GNU General Public License as published by * License, or (at your option) any later version.
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
DIYLC is distributed in the hope that it will be useful, * Public License for more details.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * You should have received a copy of the GNU General Public License along with DIYLC. If not, see
GNU General Public License for more details. * <http://www.gnu.org/licenses/>.
*/
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.config; package org.diylc.swing.plugins.config;
import java.io.File; import java.io.File;
@@ -101,8 +97,8 @@ public class ConfigPlugin implements IPlugIn {
ActionFactory.getInstance() ActionFactory.getInstance()
.createConfigAction(plugInPort, "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU); .createConfigAction(plugInPort, "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU);
swingUI.injectMenuAction( swingUI.injectMenuAction(
ActionFactory.getInstance() ActionFactory.getInstance().createConfigAction(plugInPort, "Highlight Connected Areas",
.createConfigAction(plugInPort, "Highlight Connected Areas", IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false), CONFIG_MENU); IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false, IPlugInPort.HIGHLIGHT_CONTINUITY_AREA), CONFIG_MENU);
File themeDir = new File("themes"); File themeDir = new File("themes");
if (themeDir.exists()) { if (themeDir.exists()) {
+16
View File
@@ -1913,5 +1913,21 @@
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>
<org.diylc.appframework.update.Version>
<versionNumber>
<major>3</major>
<minor>42</minor>
<build>1</build>
</versionNumber>
<releaseDate>2018-12-16 00:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Added usage hints for new functionality</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
</a> </a>
</java.util.Arrays_-ArrayList> </java.util.Arrays_-ArrayList>