Skip to content

Commit

Permalink
Merge branch 'java7'
Browse files Browse the repository at this point in the history
  • Loading branch information
rjolly committed Feb 29, 2020
2 parents f1228bd + f3c9e49 commit 8e63e04
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 17 deletions.
8 changes: 3 additions & 5 deletions mail/src/linoleum/mail/SimpleClient.form
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<NonVisualComponents>
<Container class="linoleum.application.OptionPanel" name="optionPanel1">
<Properties>
<Property name="frame" type="linoleum.application.Frame" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="Form"/>
</Property>
</Properties>

<Layout>
<DimensionLayout dim="0">
Expand Down Expand Up @@ -197,6 +192,9 @@
<Property name="resizable" type="boolean" value="true"/>
<Property name="title" type="java.lang.String" value="Simple JavaMail Client"/>
<Property name="name" type="java.lang.String" value="Mail" noResource="true"/>
<Property name="optionPanel" type="linoleum.application.OptionPanel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="optionPanel1" type="code"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
Expand Down
14 changes: 5 additions & 9 deletions mail/src/linoleum/mail/SimpleClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ public SettingsAction() {

@Override
public void actionPerformed(final ActionEvent e) {
optionPanel1.load();
final int result = JOptionPane.showInternalConfirmDialog(getDialogParent(), optionPanel1, "Account settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
switch (result) {
case JOptionPane.OK_OPTION:
optionPanel1.save();
break;
default:
try {
getApplicationManager().open(new URI("prefs", getName(), null));
} catch (final URISyntaxException ex) {
ex.printStackTrace();
}
}
}
Expand Down Expand Up @@ -287,8 +284,6 @@ private void initComponents() {
jSeparator2 = new javax.swing.JPopupMenu.Separator();
jMenuItem8 = new javax.swing.JMenuItem();

optionPanel1.setFrame(this);

jLabel1.setText("URL :");

jLabel2.setText("Transport :");
Expand Down Expand Up @@ -356,6 +351,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
setResizable(true);
setTitle("Simple JavaMail Client");
setName("Mail"); // NOI18N
setOptionPanel(optionPanel1);
addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/linoleum/FileManager.form
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem11ActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator5">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem12">
<Properties>
<Property name="action" type="javax.swing.Action" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="preferenceAction" type="code"/>
</Property>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/linoleum/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class FileManager extends FileSupport implements Runnable {
private final Action renameAction = new RenameAction();
private final Action cancelSelectionAction = new CancelSelectionAction();
private final Action deleteAction = new DeleteAction();
private final Action preferenceAction = new PreferenceAction();
private final FileChooser chooser = new FileChooser();
private final ListCellRenderer renderer = new Renderer();
private final DefaultListModel<Path> model = new DefaultListModel<>();
Expand Down Expand Up @@ -463,6 +464,21 @@ public void actionPerformed(final ActionEvent e) {
}
}

private class PreferenceAction extends AbstractAction {
private PreferenceAction() {
super("Preferences");
}

@Override
public void actionPerformed(final ActionEvent e) {
try {
getApplicationManager().open(new URI("prefs", getName(), null));
} catch (final URISyntaxException ex) {
ex.printStackTrace();
}
}
}

private Path newFolderFile;
private Path editFile;

Expand Down Expand Up @@ -1057,6 +1073,8 @@ private void initComponents() {
jCheckBoxMenuItem2 = new javax.swing.JCheckBoxMenuItem();
jSeparator4 = new javax.swing.JPopupMenu.Separator();
jMenuItem11 = new javax.swing.JMenuItem();
jSeparator5 = new javax.swing.JPopupMenu.Separator();
jMenuItem12 = new javax.swing.JMenuItem();

jLabel2.setText("Home :");

Expand Down Expand Up @@ -1299,6 +1317,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
jMenu4.add(jMenuItem11);
jMenu4.add(jSeparator5);

jMenuItem12.setAction(preferenceAction);
jMenu4.add(jMenuItem12);

jMenuBar1.add(jMenu4);

Expand Down Expand Up @@ -1420,6 +1442,7 @@ private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRS
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem10;
private javax.swing.JMenuItem jMenuItem11;
private javax.swing.JMenuItem jMenuItem12;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
Expand All @@ -1436,6 +1459,7 @@ private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRS
private javax.swing.JPopupMenu.Separator jSeparator2;
private javax.swing.JPopupMenu.Separator jSeparator3;
private javax.swing.JPopupMenu.Separator jSeparator4;
private javax.swing.JPopupMenu.Separator jSeparator5;
private linoleum.FileTable jTable1;
private javax.swing.JTextField jTextField1;
private linoleum.application.OptionPanel optionPanel1;
Expand Down
36 changes: 33 additions & 3 deletions src/main/java/linoleum/PreferenceManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package linoleum;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import javax.swing.ImageIcon;
import linoleum.application.Frame;
Expand All @@ -15,13 +17,41 @@ public class PreferenceManager extends Frame {
public PreferenceManager() {
initComponents();
setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Properties24.gif")));
setScheme("prefs");
}

@Override
public void open() {
public void setURI(final URI uri) {
if (uri != null) {
final int index = jTabbedPane1.indexOfTab(uri.getSchemeSpecificPart());
if (index > -1) {
current = index;
}
}
}

@Override
public URI getURI() {
update();
try {
return new URI("prefs", get(current).getName(), null);
} catch (final URISyntaxException e) {
e.printStackTrace();
}
return null;
}

private void update() {
for(final OptionPanel panel : getApplicationManager().getOptionPanels()) {
jTabbedPane1.add(panel);
if (jTabbedPane1.indexOfTab(panel.getName()) < 0) {
jTabbedPane1.add(panel);
}
}
}

@Override
public void open() {
update();
jTabbedPane1.setSelectedIndex(current);
get(current).load();
ready = true;
Expand Down Expand Up @@ -53,7 +83,7 @@ public void init() {
getApplicationManager().addClassPathListener(new ClassPathListener() {
@Override
public void classPathChanged(final ClassPathChangeEvent e) {
open();
update();
}
});
}
Expand Down

0 comments on commit 8e63e04

Please sign in to comment.