Move plugin list to a ribbon gallery

This commit is contained in:
skylarmt 2015-04-01 20:18:47 -06:00
parent e2635ba44b
commit adab034091
5 changed files with 120 additions and 165 deletions

View File

@ -34,7 +34,6 @@ endorsed.classpath=
excludes= excludes=
file.reference.autocomplete-2.5.4.jar=lib/autocomplete-2.5.4.jar file.reference.autocomplete-2.5.4.jar=lib/autocomplete-2.5.4.jar
file.reference.beautyeye_lnf.jar=lib/beautyeye_lnf.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.flamingo-6.3.jar=lib/flamingo-6.3.jar
file.reference.htmlcleaner-2.10.jar=lib/htmlcleaner-2.10.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 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=\ javac.classpath=\
${file.reference.autocomplete-2.5.4.jar}:\ ${file.reference.autocomplete-2.5.4.jar}:\
${file.reference.beautyeye_lnf.jar}:\ ${file.reference.beautyeye_lnf.jar}:\
${file.reference.flamingo-6.3-javadoc.jar}:\
${file.reference.flamingo-6.3.jar}:\ ${file.reference.flamingo-6.3.jar}:\
${file.reference.htmlcleaner-2.10.jar}:\ ${file.reference.htmlcleaner-2.10.jar}:\
${file.reference.iText-4.2.0-com.itextpdf.jar}:\ ${file.reference.iText-4.2.0-com.itextpdf.jar}:\
@ -93,6 +91,7 @@ javadoc.noindex=false
javadoc.nonavbar=false javadoc.nonavbar=false
javadoc.notree=false javadoc.notree=false
javadoc.private=false javadoc.private=false
javadoc.reference.flamingo-6.3.jar=lib/flamingo-6.3-javadoc.jar
javadoc.splitindex=true javadoc.splitindex=true
javadoc.use=true javadoc.use=true
javadoc.version=false javadoc.version=false

View File

@ -68,7 +68,9 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javafx.application.Platform; import javafx.application.Platform;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
@ -276,8 +278,17 @@ public class Main extends JRibbonFrame {
*/ */
public void loadPlugins() { public void loadPlugins() {
pluginband = new JRibbonBand("Plugins", null); 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( 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"); File dir = new File(System.getProperty("user.home") + "\\.symat\\plugins");
dir.mkdirs(); dir.mkdirs();
File[] files = dir.listFiles(new FilenameFilter() { File[] files = dir.listFiles(new FilenameFilter() {
@ -287,18 +298,27 @@ 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) { for (File pl : files) {
try { try {
LoadPlugin lp = new LoadPlugin(pl); LoadPlugin lp = new LoadPlugin(pl);
JCommandButton b = lp.getRibbonBtn(); appGalleryButtonsList.add(lp.getGalleryBtn());
pluginband.addCommandButton(
b,
RibbonElementPriority.MEDIUM);
b.setVisible(true);
} catch (Exception ex) { } 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);
} }
/** /**
@ -321,7 +341,8 @@ public class Main extends JRibbonFrame {
JRibbonBand appsband = new JRibbonBand("Apps", null); JRibbonBand appsband = new JRibbonBand("Apps", null);
JRibbonBand webband = new JRibbonBand("Community", null); JRibbonBand webband = new JRibbonBand("Community", null);
JRibbonBand collabband = new JRibbonBand("Team", null); JRibbonBand collabband = new JRibbonBand("Team", null);
JRibbonBand getpluginband = new JRibbonBand("Install", null); //JRibbonBand getpluginband = new JRibbonBand("Install", null);
loadPlugins(); loadPlugins();
shellbtn.addActionListener(new ActionListener() { shellbtn.addActionListener(new ActionListener() {
@ -376,12 +397,6 @@ public class Main extends JRibbonFrame {
loadFrame(new Tasks()); loadFrame(new Tasks());
} }
}); });
installpluginbtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
loadFrame(new InstallPlugin());
}
});
shellbtn.setActionRichTooltip(new RichTooltip("Command Shell", shellbtn.setActionRichTooltip(new RichTooltip("Command Shell",
"Open a window for running interactive commands.")); "Open a window for running interactive commands."));
@ -399,8 +414,6 @@ public class Main extends JRibbonFrame {
"Collaborate over the Internet on projects.")); "Collaborate over the Internet on projects."));
tasksbtn.setActionRichTooltip(new RichTooltip("Task List", tasksbtn.setActionRichTooltip(new RichTooltip("Task List",
"Manage tasks and to-do lists for projects.")); "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(shellbtn, RibbonElementPriority.TOP);
coreband.addCommandButton(editorbtn, RibbonElementPriority.TOP); coreband.addCommandButton(editorbtn, RibbonElementPriority.TOP);
@ -414,8 +427,6 @@ public class Main extends JRibbonFrame {
collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM); collabband.addCommandButton(padsbtn, RibbonElementPriority.MEDIUM);
collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM); collabband.addCommandButton(tasksbtn, RibbonElementPriority.MEDIUM);
getpluginband.addCommandButton(installpluginbtn, RibbonElementPriority.MEDIUM);
coreband.setResizePolicies((List) Arrays.asList( coreband.setResizePolicies((List) Arrays.asList(
new CoreRibbonResizePolicies.None(coreband.getControlPanel()), new CoreRibbonResizePolicies.None(coreband.getControlPanel()),
new IconRibbonBandResizePolicy(coreband.getControlPanel()))); new IconRibbonBandResizePolicy(coreband.getControlPanel())));
@ -428,16 +439,16 @@ public class Main extends JRibbonFrame {
collabband.setResizePolicies((List) Arrays.asList( collabband.setResizePolicies((List) Arrays.asList(
new CoreRibbonResizePolicies.None(collabband.getControlPanel()), new CoreRibbonResizePolicies.None(collabband.getControlPanel()),
new IconRibbonBandResizePolicy(collabband.getControlPanel()))); new IconRibbonBandResizePolicy(collabband.getControlPanel())));
getpluginband.setResizePolicies((List) Arrays.asList( // getpluginband.setResizePolicies((List) Arrays.asList(
new CoreRibbonResizePolicies.None(appsband.getControlPanel()), // new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
new IconRibbonBandResizePolicy(pluginband.getControlPanel()))); // new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
pluginband.setResizePolicies((List) Arrays.asList( // pluginband.setResizePolicies((List) Arrays.asList(
new CoreRibbonResizePolicies.None(appsband.getControlPanel()), // new CoreRibbonResizePolicies.None(appsband.getControlPanel()),
new IconRibbonBandResizePolicy(pluginband.getControlPanel()))); // new IconRibbonBandResizePolicy(pluginband.getControlPanel())));
RibbonTask hometask = new RibbonTask("Home", coreband, appsband); RibbonTask hometask = new RibbonTask("Home", coreband, appsband);
RibbonTask webtask = new RibbonTask("Tools", webband, collabband); RibbonTask webtask = new RibbonTask("Tools", webband, collabband);
RibbonTask plugintask = new RibbonTask("Plugins", getpluginband, pluginband); RibbonTask plugintask = new RibbonTask("Plugins", pluginband);
loadRibbonMenu(null); loadRibbonMenu(null);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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> <NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="themeGroup"> <Component class="javax.swing.ButtonGroup" name="themeGroup">
</Component> </Component>
@ -13,13 +13,13 @@
<Image iconType="3" name="/net/apocalypselabs/symat/icons/settings.png"/> <Image iconType="3" name="/net/apocalypselabs/symat/icons/settings.png"/>
</Property> </Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[524, 274]"/> <Dimension value="[390, 293]"/>
</Property> </Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[524, 274]"/> <Dimension value="[390, 293]"/>
</Property> </Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[524, 274]"/> <Dimension value="[390, 293]"/>
</Property> </Property>
</Properties> </Properties>
<SyntheticProperties> <SyntheticProperties>
@ -44,21 +44,21 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" 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="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace 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>
<Group type="102" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Component id="jPanel4" min="-2" max="-2" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="applyBtn" min="-2" max="-2" attributes="0"/> <Component id="applyBtn" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="saveBtn" min="-2" max="-2" attributes="0"/> <Component id="saveBtn" min="-2" max="-2" attributes="0"/>
@ -71,24 +71,22 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="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"> <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="jPanel2" max="32767" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/> <Component id="jPanel1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0"> <Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
<Component id="jPanel3" max="32767" attributes="0"/> <Component id="jPanel4" 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> </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>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -238,6 +236,7 @@
<Component id="quickStart" min="-2" max="-2" attributes="0"/> <Component id="quickStart" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="skipUpdates" min="-2" max="-2" attributes="0"/> <Component id="skipUpdates" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -277,7 +276,7 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" 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> </Group>
<Component id="nameBox" max="32767" attributes="0"/> <Component id="nameBox" max="32767" attributes="0"/>
</Group> </Group>
@ -288,7 +287,7 @@
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="nameBox" min="-2" 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>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -303,44 +302,5 @@
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </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> </SubComponents>
</Form> </Form>

View File

@ -56,7 +56,6 @@ public class Settings extends javax.swing.JInternalFrame {
*/ */
public Settings() { public Settings() {
initComponents(); initComponents();
jPanel5.setVisible(false);
setBackground(Theme.windowColor()); setBackground(Theme.windowColor());
} }
@ -84,16 +83,14 @@ public class Settings extends javax.swing.JInternalFrame {
jPanel4 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
nameBox = new javax.swing.JTextField(); nameBox = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
textSize = new javax.swing.JSpinner();
setClosable(true); setClosable(true);
setIconifiable(true); setIconifiable(true);
setTitle("Settings"); setTitle("Settings");
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/settings.png"))); // NOI18N setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/settings.png"))); // NOI18N
setMaximumSize(new java.awt.Dimension(524, 274)); setMaximumSize(new java.awt.Dimension(390, 293));
setMinimumSize(new java.awt.Dimension(524, 274)); setMinimumSize(new java.awt.Dimension(390, 293));
setPreferredSize(new java.awt.Dimension(524, 274)); setPreferredSize(new java.awt.Dimension(390, 293));
addComponentListener(new java.awt.event.ComponentAdapter() { addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) { public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt); formComponentShown(evt);
@ -195,7 +192,8 @@ public class Settings extends javax.swing.JInternalFrame {
.addContainerGap() .addContainerGap()
.addComponent(quickStart) .addComponent(quickStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(skipUpdates)) .addComponent(skipUpdates)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
); );
applyBtn.setText("Apply"); applyBtn.setText("Apply");
@ -215,7 +213,7 @@ public class Settings extends javax.swing.JInternalFrame {
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel1) .addComponent(jLabel1)
.addGap(0, 96, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE))
.addComponent(nameBox) .addComponent(nameBox)
); );
jPanel4Layout.setVerticalGroup( jPanel4Layout.setVerticalGroup(
@ -224,28 +222,7 @@ public class Settings extends javax.swing.JInternalFrame {
.addComponent(jLabel1) .addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(nameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(13, Short.MAX_VALUE)) .addGap(0, 0, 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))
); );
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@ -253,19 +230,18 @@ public class Settings extends javax.swing.JInternalFrame {
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup() .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) .addGap(0, 0, 0)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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) .addComponent(applyBtn)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveBtn))) .addComponent(saveBtn)))
@ -276,18 +252,17 @@ public class Settings extends javax.swing.JInternalFrame {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .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(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)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.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(jPanel3, 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))
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(applyBtn) .addComponent(applyBtn)
.addComponent(saveBtn))) .addComponent(saveBtn))
.addGap(57, 57, 57)) .addGap(40, 40, 40))
); );
pack(); pack();
@ -313,7 +288,6 @@ public class Settings extends javax.swing.JInternalFrame {
skipUpdates.setSelected( skipUpdates.setSelected(
PrefStorage.getSetting("skipupdates", "").equals("yes")); PrefStorage.getSetting("skipupdates", "").equals("yes"));
nameBox.setText(PrefStorage.getSetting("author", "")); nameBox.setText(PrefStorage.getSetting("author", ""));
textSize.setValue(Integer.valueOf(PrefStorage.getSetting("editfont")));
}//GEN-LAST:event_formComponentShown }//GEN-LAST:event_formComponentShown
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed 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("quickstart", quickStart.isSelected() ? "yes" : "");
PrefStorage.saveSetting("skipupdates", skipUpdates.isSelected() ? "yes" : ""); PrefStorage.saveSetting("skipupdates", skipUpdates.isSelected() ? "yes" : "");
PrefStorage.saveSetting("author", nameBox.getText()); PrefStorage.saveSetting("author", nameBox.getText());
PrefStorage.saveSetting("editfont", String.valueOf(textSize.getValue()));
PrefStorage.save(); PrefStorage.save();
Main.updateDisplay(); Main.updateDisplay();
} }
@ -349,13 +322,11 @@ public class Settings extends javax.swing.JInternalFrame {
private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JTextField nameBox; private javax.swing.JTextField nameBox;
private javax.swing.JCheckBox quickStart; private javax.swing.JCheckBox quickStart;
private javax.swing.JButton saveBtn; private javax.swing.JButton saveBtn;
private javax.swing.JCheckBox showRecent; private javax.swing.JCheckBox showRecent;
private javax.swing.JCheckBox skipUpdates; private javax.swing.JCheckBox skipUpdates;
private javax.swing.JSpinner textSize;
private javax.swing.JRadioButton themeDark; private javax.swing.JRadioButton themeDark;
private javax.swing.ButtonGroup themeGroup; private javax.swing.ButtonGroup themeGroup;
private javax.swing.JRadioButton themeLight; private javax.swing.JRadioButton themeLight;

View File

@ -50,34 +50,34 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import net.apocalypselabs.symat.CodeRunner; import net.apocalypselabs.symat.CodeRunner;
import net.apocalypselabs.symat.Debug; import net.apocalypselabs.symat.Debug;
import org.pushingpixels.flamingo.api.common.JCommandButton; 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.RichTooltip;
import org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon; import org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon;
import org.pushingpixels.flamingo.api.common.icon.ResizableIcon; import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
/** /**
* Plugin loader class. * Plugin loader class.
*
* @author Skylar * @author Skylar
*/ */
public class LoadPlugin { public class LoadPlugin {
private Plugin p = new Plugin(); private Plugin p = new Plugin();
public LoadPlugin(File f) { public LoadPlugin(File f) throws FileNotFoundException, IOException, ClassNotFoundException {
try { FileInputStream fin = new FileInputStream(f);
FileInputStream fin = new FileInputStream(f); ObjectInputStream ois = new ObjectInputStream(fin);
ObjectInputStream ois = new ObjectInputStream(fin); p = (Plugin) ois.readObject();
p = (Plugin) ois.readObject(); ois.close();
ois.close();
} catch (Exception ex) {
Debug.stacktrace(ex);
}
} }
public LoadPlugin(String path) { public LoadPlugin(String path) throws FileNotFoundException, IOException, ClassNotFoundException {
this(new File(path)); this(new File(path));
} }
@ -97,6 +97,20 @@ public class LoadPlugin {
exec(); 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; return b;
} }