* use system laf on Windows and Mac, use Nimbus on all the others (Linux, *BSD, ...)

* visual imrovements under Nimbus LAF
This commit is contained in:
Reinhard Pointner 2009-04-05 21:03:40 +00:00
parent d7a5b58c32
commit 4afc701ff7
5 changed files with 75 additions and 47 deletions

View File

@ -21,6 +21,8 @@ import net.sourceforge.filebot.ui.panel.sfv.SfvPanelBuilder;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
import com.sun.jna.Platform;
public class Main { public class Main {
@ -47,15 +49,15 @@ public class Main {
initializeSettings(); initializeSettings();
try { try {
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); if (Platform.isWindows() || Platform.isMac()) {
// UIManager.setLookAndFeel("a03.swing.plaf.A03LookAndFeel"); // use native laf of windows and mac
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel"); } else {
// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceSaharaLookAndFeel"); // use nimubs laf on linux, bsd, ...
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, e.toString(), e); Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.toString(), e);
} }
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {

View File

@ -120,8 +120,14 @@ public class EpisodeFormatBindingBean {
return null; return null;
} }
@Define("general")
public SortedMap<String, String> getGeneralMediaInfo() {
return getMediaInfo().snapshot(StreamKind.General, 0);
}
@Define("video") @Define("video")
public SortedMap<String, String> getVideoInfo() { public SortedMap<String, String> getVideoInfo() {
return getMediaInfo().snapshot(StreamKind.Video, 0); return getMediaInfo().snapshot(StreamKind.Video, 0);
@ -133,12 +139,18 @@ public class EpisodeFormatBindingBean {
return getMediaInfo().snapshot(StreamKind.Audio, 0); return getMediaInfo().snapshot(StreamKind.Audio, 0);
} }
@Define("general") @Define("text")
public SortedMap<String, String> getGeneralMediaInfo() { public SortedMap<String, String> getTextInfo() {
return getMediaInfo().snapshot(StreamKind.General, 0); return getMediaInfo().snapshot(StreamKind.Text, 0);
} }
@Define("image")
public SortedMap<String, String> getImageInfo() {
return getMediaInfo().snapshot(StreamKind.Image, 0);
}
public synchronized MediaInfo getMediaInfo() { public synchronized MediaInfo getMediaInfo() {
if (mediaFile == null) { if (mediaFile == null) {

View File

@ -1,43 +1,57 @@
package net.sourceforge.filebot.ui.panel.episodelist; package net.sourceforge.filebot.ui.panel.episodelist;
import static net.sourceforge.filebot.ui.panel.episodelist.SeasonSpinnerModel.ALL_SEASONS; import static net.sourceforge.filebot.ui.panel.episodelist.SeasonSpinnerModel.ALL_SEASONS;
import java.awt.Color; import java.text.ParseException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JSpinner; import javax.swing.JSpinner;
import javax.swing.event.ChangeEvent; import javax.swing.SwingConstants;
import javax.swing.event.ChangeListener; import javax.swing.JSpinner.DefaultEditor;
import javax.swing.text.DefaultFormatter;
import javax.swing.text.DefaultFormatterFactory;
class SeasonSpinnerEditor extends DefaultEditor {
class SeasonSpinnerEditor extends JLabel implements ChangeListener {
public SeasonSpinnerEditor(JSpinner spinner) { public SeasonSpinnerEditor(JSpinner spinner) {
setHorizontalAlignment(RIGHT); super(spinner);
spinner.addChangeListener(this); getTextField().setFormatterFactory(new DefaultFormatterFactory(new DefaultFormatter() {
setValueFromSpinner(spinner);
setBorder(BorderFactory.createEmptyBorder(1, 3, 1, 3));
setBackground(Color.WHITE);
setOpaque(true);
}
public void stateChanged(ChangeEvent e) { @Override
setValueFromSpinner((JSpinner) e.getSource()); public Object stringToValue(String string) throws ParseException {
} if ("All Seasons".equals(string)) {
return ALL_SEASONS;
}
private void setValueFromSpinner(JSpinner spinner) { Matcher matcher = Pattern.compile("Season (\\d+)").matcher(string);
int season = ((SeasonSpinnerModel) spinner.getModel()).getSeason();
if (matcher.matches()) {
return Integer.valueOf(matcher.group(1));
}
// negative season number
throw new ParseException("Illegal season number", 0);
}
@Override
public String valueToString(Object value) throws ParseException {
int season = ((Number) value).intValue();
if (season == ALL_SEASONS)
return "All Seasons";
else if (season >= 1)
return String.format("Season %d", season);
// negative season number
throw new ParseException("Illegal season number", 0);
}
}));
if (season == ALL_SEASONS) getTextField().setHorizontalAlignment(SwingConstants.RIGHT);
setText("All Seasons");
else
setText(String.format("Season %d", season));
} }
} }

View File

@ -67,9 +67,9 @@ public class ListPanel extends JComponent {
add(new JLabel("Pattern:"), "gapbefore indent"); add(new JLabel("Pattern:"), "gapbefore indent");
add(textField, "gap related, wmin 2cm"); add(textField, "gap related, wmin 2cm");
add(new JLabel("From:"), "gap 5mm"); add(new JLabel("From:"), "gap 5mm");
add(fromSpinner, "gap related, wmax 12mm, sizegroup spinner"); add(fromSpinner, "gap related, wmax 14mm, sizegroup spinner");
add(new JLabel("To:"), "gap 5mm"); add(new JLabel("To:"), "gap 5mm");
add(toSpinner, "gap related, wmax 12mm, sizegroup spinner"); add(toSpinner, "gap related, wmax 14mm, sizegroup spinner");
add(new JButton(createAction), "gap 7mm, gapafter indent, wrap paragraph"); add(new JButton(createAction), "gap 7mm, gapafter indent, wrap paragraph");
add(list, "grow"); add(list, "grow");

View File

@ -40,12 +40,12 @@ public class FancyTreeCellRenderer extends DefaultTreeCellRenderer {
@Override @Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, false); super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, false);
setIconTextGap(5); setIconTextGap(5);
if (sel) { if (selected) {
setPaintGradient(true); setPaintGradient(true);
setGradientBeginColor(backgroundSelectionColor.brighter()); setGradientBeginColor(backgroundSelectionColor.brighter());
setGradientEndColor(backgroundSelectionColor); setGradientEndColor(backgroundSelectionColor);