Move plugin list to a ribbon gallery
This commit is contained in:
parent
e2635ba44b
commit
adab034091
@ -34,7 +34,6 @@ endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.autocomplete-2.5.4.jar=lib/autocomplete-2.5.4.jar
|
||||
file.reference.beautyeye_lnf.jar=lib/beautyeye_lnf.jar
|
||||
file.reference.flamingo-6.3-javadoc.jar=lib/flamingo-6.3-javadoc.jar
|
||||
file.reference.flamingo-6.3.jar=lib/flamingo-6.3.jar
|
||||
file.reference.htmlcleaner-2.10.jar=lib/htmlcleaner-2.10.jar
|
||||
file.reference.iText-4.2.0-com.itextpdf.jar=lib/iText-4.2.0-com.itextpdf.jar
|
||||
@ -57,7 +56,6 @@ jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.autocomplete-2.5.4.jar}:\
|
||||
${file.reference.beautyeye_lnf.jar}:\
|
||||
${file.reference.flamingo-6.3-javadoc.jar}:\
|
||||
${file.reference.flamingo-6.3.jar}:\
|
||||
${file.reference.htmlcleaner-2.10.jar}:\
|
||||
${file.reference.iText-4.2.0-com.itextpdf.jar}:\
|
||||
@ -93,6 +91,7 @@ javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.reference.flamingo-6.3.jar=lib/flamingo-6.3-javadoc.jar
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
|
@ -68,7 +68,9 @@ import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javafx.application.Platform;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFileChooser;
|
||||
@ -276,8 +278,17 @@ public class Main extends JRibbonFrame {
|
||||
*/
|
||||
public void loadPlugins() {
|
||||
pluginband = new JRibbonBand("Plugins", null);
|
||||
installpluginbtn.setActionRichTooltip(new RichTooltip("Install Plugin",
|
||||
"Install a plugin from a file and view plugin info."));
|
||||
installpluginbtn.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
loadFrame(new InstallPlugin());
|
||||
}
|
||||
});
|
||||
pluginband.setResizePolicies((List) Arrays.asList(
|
||||
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||
new CoreRibbonResizePolicies.Mirror(pluginband.getControlPanel())));
|
||||
pluginband.addCommandButton(installpluginbtn, RibbonElementPriority.TOP);
|
||||
File dir = new File(System.getProperty("user.home") + "\\.symat\\plugins");
|
||||
dir.mkdirs();
|
||||
File[] files = dir.listFiles(new FilenameFilter() {
|
||||
@ -287,20 +298,29 @@ public class Main extends JRibbonFrame {
|
||||
}
|
||||
});
|
||||
|
||||
Map<RibbonElementPriority, Integer> galleryVisibleButtonCounts = new HashMap<>();
|
||||
galleryVisibleButtonCounts.put(RibbonElementPriority.LOW, 1);
|
||||
galleryVisibleButtonCounts.put(RibbonElementPriority.MEDIUM, 2);
|
||||
galleryVisibleButtonCounts.put(RibbonElementPriority.TOP, 2);
|
||||
List<StringValuePair<List<JCommandToggleButton>>> appGalleryButtons = new ArrayList<>();
|
||||
List<JCommandToggleButton> appGalleryButtonsList = new ArrayList<>();
|
||||
for (File pl : files) {
|
||||
try {
|
||||
LoadPlugin lp = new LoadPlugin(pl);
|
||||
JCommandButton b = lp.getRibbonBtn();
|
||||
pluginband.addCommandButton(
|
||||
b,
|
||||
RibbonElementPriority.MEDIUM);
|
||||
b.setVisible(true);
|
||||
appGalleryButtonsList.add(lp.getGalleryBtn());
|
||||
} catch (Exception ex) {
|
||||
|
||||
Debug.stacktrace(ex);
|
||||
System.err.println("Error loading plugin: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
appGalleryButtons.add(new StringValuePair<List<JCommandToggleButton>>("Plugins",
|
||||
appGalleryButtonsList));
|
||||
pluginband.addRibbonGallery("Plugins", appGalleryButtons,
|
||||
galleryVisibleButtonCounts, 5, 3,
|
||||
RibbonElementPriority.TOP);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reload the Ribbon tabs and all sub-components.
|
||||
*/
|
||||
@ -321,7 +341,8 @@ public class Main extends JRibbonFrame {
|
||||
JRibbonBand appsband = new JRibbonBand("Apps", null);
|
||||
JRibbonBand webband = new JRibbonBand("Community", null);
|
||||
JRibbonBand collabband = new JRibbonBand("Team", null);
|
||||
JRibbonBand getpluginband = new JRibbonBand("Install", null);
|
||||
//JRibbonBand getpluginband = new JRibbonBand("Install", null);
|
||||
|
||||
loadPlugins();
|
||||
|
||||
shellbtn.addActionListener(new ActionListener() {
|
||||
@ -376,12 +397,6 @@ public class Main extends JRibbonFrame {
|
||||
loadFrame(new Tasks());
|
||||
}
|
||||
});
|
||||
installpluginbtn.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
loadFrame(new InstallPlugin());
|
||||
}
|
||||
});
|
||||
|
||||
shellbtn.setActionRichTooltip(new RichTooltip("Command Shell",
|
||||
"Open a window for running interactive commands."));
|
||||
@ -399,8 +414,6 @@ public class Main extends JRibbonFrame {
|
||||
"Collaborate over the Internet on projects."));
|
||||
tasksbtn.setActionRichTooltip(new RichTooltip("Task List",
|
||||
"Manage tasks and to-do lists for projects."));
|
||||
installpluginbtn.setActionRichTooltip(new RichTooltip("Install Plugin",
|
||||
"Install a plugin from a file and view plugin info."));
|
||||
|
||||
coreband.addCommandButton(shellbtn, RibbonElementPriority.TOP);
|
||||
coreband.addCommandButton(editorbtn, RibbonElementPriority.TOP);
|
||||
@ -413,8 +426,6 @@ public class Main extends JRibbonFrame {
|
||||
|
||||
collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM);
|
||||
collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM);
|
||||
|
||||
getpluginband.addCommandButton(installpluginbtn, RibbonElementPriority.MEDIUM);
|
||||
|
||||
coreband.setResizePolicies((List) Arrays.asList(
|
||||
new CoreRibbonResizePolicies.None(coreband.getControlPanel()),
|
||||
@ -428,16 +439,16 @@ public class Main extends JRibbonFrame {
|
||||
collabband.setResizePolicies((List) Arrays.asList(
|
||||
new CoreRibbonResizePolicies.None(collabband.getControlPanel()),
|
||||
new IconRibbonBandResizePolicy(collabband.getControlPanel())));
|
||||
getpluginband.setResizePolicies((List) Arrays.asList(
|
||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||
pluginband.setResizePolicies((List) Arrays.asList(
|
||||
new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||
new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||
// getpluginband.setResizePolicies((List) Arrays.asList(
|
||||
// new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||
// new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||
// pluginband.setResizePolicies((List) Arrays.asList(
|
||||
// new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
|
||||
// new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
|
||||
|
||||
RibbonTask hometask = new RibbonTask("Home", coreband, appsband);
|
||||
RibbonTask webtask = new RibbonTask("Tools", webband, collabband);
|
||||
RibbonTask plugintask = new RibbonTask("Plugins", getpluginband, pluginband);
|
||||
RibbonTask plugintask = new RibbonTask("Plugins", pluginband);
|
||||
|
||||
loadRibbonMenu(null);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.ButtonGroup" name="themeGroup">
|
||||
</Component>
|
||||
@ -13,13 +13,13 @@
|
||||
<Image iconType="3" name="/net/apocalypselabs/symat/icons/settings.png"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[524, 274]"/>
|
||||
<Dimension value="[390, 293]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[524, 274]"/>
|
||||
<Dimension value="[390, 293]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[524, 274]"/>
|
||||
<Dimension value="[390, 293]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
@ -44,21 +44,21 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="applyBtn" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="saveBtn" min="-2" max="-2" attributes="0"/>
|
||||
@ -71,24 +71,22 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="applyBtn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="saveBtn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="57" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="applyBtn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="saveBtn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -238,6 +236,7 @@
|
||||
<Component id="quickStart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="skipUpdates" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -277,7 +276,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="96" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="nameBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@ -288,7 +287,7 @@
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="nameBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -303,44 +302,5 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Text size"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textSize" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="textSize" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JSpinner" name="textSize">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="12" maximum="48" minimum="8" numberType="java.lang.Integer" stepSize="2" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -56,7 +56,6 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
*/
|
||||
public Settings() {
|
||||
initComponents();
|
||||
jPanel5.setVisible(false);
|
||||
setBackground(Theme.windowColor());
|
||||
}
|
||||
|
||||
@ -84,16 +83,14 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
nameBox = new javax.swing.JTextField();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
textSize = new javax.swing.JSpinner();
|
||||
|
||||
setClosable(true);
|
||||
setIconifiable(true);
|
||||
setTitle("Settings");
|
||||
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/settings.png"))); // NOI18N
|
||||
setMaximumSize(new java.awt.Dimension(524, 274));
|
||||
setMinimumSize(new java.awt.Dimension(524, 274));
|
||||
setPreferredSize(new java.awt.Dimension(524, 274));
|
||||
setMaximumSize(new java.awt.Dimension(390, 293));
|
||||
setMinimumSize(new java.awt.Dimension(390, 293));
|
||||
setPreferredSize(new java.awt.Dimension(390, 293));
|
||||
addComponentListener(new java.awt.event.ComponentAdapter() {
|
||||
public void componentShown(java.awt.event.ComponentEvent evt) {
|
||||
formComponentShown(evt);
|
||||
@ -195,7 +192,8 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
.addContainerGap()
|
||||
.addComponent(quickStart)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(skipUpdates))
|
||||
.addComponent(skipUpdates)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
applyBtn.setText("Apply");
|
||||
@ -215,7 +213,7 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(0, 96, Short.MAX_VALUE))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(nameBox)
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
@ -224,28 +222,7 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(nameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(13, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Text size"));
|
||||
|
||||
textSize.setModel(new javax.swing.SpinnerNumberModel(12, 8, 48, 2));
|
||||
|
||||
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
|
||||
jPanel5.setLayout(jPanel5Layout);
|
||||
jPanel5Layout.setHorizontalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(textSize)
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel5Layout.setVerticalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(textSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
@ -253,19 +230,18 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(applyBtn)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(saveBtn)))
|
||||
@ -276,18 +252,17 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(applyBtn)
|
||||
.addComponent(saveBtn)))
|
||||
.addGap(57, 57, 57))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(applyBtn)
|
||||
.addComponent(saveBtn))
|
||||
.addGap(40, 40, 40))
|
||||
);
|
||||
|
||||
pack();
|
||||
@ -313,7 +288,6 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
skipUpdates.setSelected(
|
||||
PrefStorage.getSetting("skipupdates", "").equals("yes"));
|
||||
nameBox.setText(PrefStorage.getSetting("author", ""));
|
||||
textSize.setValue(Integer.valueOf(PrefStorage.getSetting("editfont")));
|
||||
}//GEN-LAST:event_formComponentShown
|
||||
|
||||
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed
|
||||
@ -327,7 +301,6 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
PrefStorage.saveSetting("quickstart", quickStart.isSelected() ? "yes" : "");
|
||||
PrefStorage.saveSetting("skipupdates", skipUpdates.isSelected() ? "yes" : "");
|
||||
PrefStorage.saveSetting("author", nameBox.getText());
|
||||
PrefStorage.saveSetting("editfont", String.valueOf(textSize.getValue()));
|
||||
PrefStorage.save();
|
||||
Main.updateDisplay();
|
||||
}
|
||||
@ -349,13 +322,11 @@ public class Settings extends javax.swing.JInternalFrame {
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
private javax.swing.JTextField nameBox;
|
||||
private javax.swing.JCheckBox quickStart;
|
||||
private javax.swing.JButton saveBtn;
|
||||
private javax.swing.JCheckBox showRecent;
|
||||
private javax.swing.JCheckBox skipUpdates;
|
||||
private javax.swing.JSpinner textSize;
|
||||
private javax.swing.JRadioButton themeDark;
|
||||
private javax.swing.ButtonGroup themeGroup;
|
||||
private javax.swing.JRadioButton themeLight;
|
||||
|
@ -50,43 +50,43 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import net.apocalypselabs.symat.CodeRunner;
|
||||
import net.apocalypselabs.symat.Debug;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
|
||||
import org.pushingpixels.flamingo.api.common.RichTooltip;
|
||||
import org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon;
|
||||
import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
|
||||
|
||||
/**
|
||||
* Plugin loader class.
|
||||
*
|
||||
* @author Skylar
|
||||
*/
|
||||
public class LoadPlugin {
|
||||
|
||||
private Plugin p = new Plugin();
|
||||
|
||||
public LoadPlugin(File f) {
|
||||
try {
|
||||
FileInputStream fin = new FileInputStream(f);
|
||||
ObjectInputStream ois = new ObjectInputStream(fin);
|
||||
p = (Plugin) ois.readObject();
|
||||
ois.close();
|
||||
} catch (Exception ex) {
|
||||
Debug.stacktrace(ex);
|
||||
}
|
||||
|
||||
public LoadPlugin(File f) throws FileNotFoundException, IOException, ClassNotFoundException {
|
||||
FileInputStream fin = new FileInputStream(f);
|
||||
ObjectInputStream ois = new ObjectInputStream(fin);
|
||||
p = (Plugin) ois.readObject();
|
||||
ois.close();
|
||||
}
|
||||
|
||||
public LoadPlugin(String path) {
|
||||
public LoadPlugin(String path) throws FileNotFoundException, IOException, ClassNotFoundException {
|
||||
this(new File(path));
|
||||
}
|
||||
|
||||
|
||||
private ResizableIcon getRibbonIcon() {
|
||||
return ImageWrapperResizableIcon.getIcon(
|
||||
p.getIcon().getImage(),
|
||||
new Dimension(100, 76));
|
||||
}
|
||||
|
||||
|
||||
public JCommandButton getRibbonBtn() {
|
||||
JCommandButton b = new JCommandButton(p.getTitle(), getRibbonIcon());
|
||||
b.setActionRichTooltip(new RichTooltip(p.getLongTitle(),
|
||||
@ -97,14 +97,28 @@ public class LoadPlugin {
|
||||
exec();
|
||||
}
|
||||
});
|
||||
b.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
public JCommandToggleButton getGalleryBtn() {
|
||||
JCommandToggleButton b = new JCommandToggleButton(p.getTitle(), getRibbonIcon());
|
||||
b.setActionRichTooltip(new RichTooltip(p.getLongTitle(),
|
||||
p.getDesc()));
|
||||
b.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
exec();
|
||||
}
|
||||
});
|
||||
return b;
|
||||
}
|
||||
|
||||
public void exec() {
|
||||
CodeRunner cr = new CodeRunner(p.getLang());
|
||||
cr.evalString(p.getScript());
|
||||
}
|
||||
|
||||
|
||||
public Plugin getPlugin() {
|
||||
return p;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user