git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@5200 ebf7c1c2-ba36-0410-9fe8-c592906822b4

This commit is contained in:
coalado 2009-04-09 09:12:18 +00:00
parent 04aeeade5c
commit 3403f3caf0
7 changed files with 81 additions and 78 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +1,10 @@
import java.awt.BorderLayout;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import org.jdesktop.swingx.JXCollapsiblePane;
import org.jdesktop.swingx.JXLoginDialog;
public class header {
@ -45,39 +38,8 @@ public class header {
}
public static void main(String[] args) throws IOException {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame("Test Oriented Collapsible Pane");
f.add(new JLabel("Press Ctrl+F or Ctrl+G to collapse panes."), BorderLayout.NORTH);
JTree tree1 = new JTree();
tree1.setBorder(BorderFactory.createEtchedBorder());
f.add(tree1);
JXCollapsiblePane pane = new JXCollapsiblePane();
pane.setCollapsed(true);
JTree tree2 = new JTree();
tree2.setBorder(BorderFactory.createEtchedBorder());
pane.add(tree2);
f.add(pane, BorderLayout.SOUTH);
pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl F"), JXCollapsiblePane.TOGGLE_ACTION);
pane = new JXCollapsiblePane();
JTree tree3 = new JTree();
pane.add(tree3);
tree3.setBorder(BorderFactory.createEtchedBorder());
f.add(pane, BorderLayout.WEST);
pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl G"), JXCollapsiblePane.TOGGLE_ACTION);
f.setSize(640, 480);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
});
}
}

View File

@ -28,6 +28,7 @@ import java.rmi.Naming;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Properties;
import java.util.TreeSet;
import java.util.logging.Level;
@ -150,7 +151,7 @@ public class Main {
JDInitFlags.SWITCH_RETURNED_FROM_UPDATE = true;
}
}
preInitChecks();
for (int i = 0; i < args.length; i++) {
@ -225,9 +226,9 @@ public class Main {
splashScreen.addProgressImage(new SplashProgressImage(JDTheme.I("gui.splash.screen", 32, 32)));
splashScreen.addProgressImage(new SplashProgressImage(JDTheme.I("gui.splash.dllist", 32, 32)));
} catch (IOException e) {
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE, "Exception occured", e);
} catch (AWTException e) {
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE, "Exception occured", e);
}
return null;
}
@ -241,7 +242,6 @@ public class Main {
LOGGER.info("init Localisation");
Main.setSplashStatus(splashScreen, 10, JDLocale.L("gui.splash.text.loadLanguage", "lade Sprachen"));
JDSounds.setSoundTheme("default");
if (!JDInitFlags.SWITCH_NEW_INSTANCE && Main.tryConnectToServer(args)) {
@ -288,7 +288,7 @@ public class Main {
try {
server.processParameters(processArgs);
} catch (RemoteException e) {
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE, "Exception occured", e);
}
}
@ -299,7 +299,7 @@ public class Main {
} catch (RemoteException e) {
LOGGER.severe("Server could not be started - ignore parameters");
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE, "Exception occured", e);
if (!JDInitFlags.STOP) {
@ -330,7 +330,7 @@ public class Main {
JDInitFlags.SHOW_SPLASH = false;
LOGGER.warning("Heapcheck: Not enough heap. use: java -jar -Xmx512m JDownloader.jar");
}
}
/**
@ -393,13 +393,13 @@ public class Main {
@SuppressWarnings("unchecked")
private void go() {
final JDInit init = new JDInit(splashScreen);
init.init();
LOGGER.info("init Images");
init.loadImages();
LOGGER.info("init Configuration");
Main.setSplashStatus(splashScreen, 10, JDLocale.L("gui.splash.text.configLoaded", "Lade Konfiguration"));
String old = JDUtilities.getSubConfig(SimpleGuiConstants.GUICONFIGNAME).getStringProperty("LOCALE", null);
if (old != null) {
JDUtilities.getSubConfig(JDLocale.CONFIG).setProperty(JDLocale.LOCALE_ID, old);
@ -411,15 +411,14 @@ public class Main {
JOptionPane.showMessageDialog(null, "JDownloader cannot create the config files. Make sure, that JD_HOME/config/ exists and is writeable");
}
// JFrame.setDefaultLookAndFeelDecorated(true);
// JDialog.setDefaultLookAndFeelDecorated(true);
if (JDInitFlags.SWITCH_DEBUG) {
LOGGER.info("DEBUG MODE ACTIVATED");
jd.controlling.JDLogger.getLogger().setLevel(Level.ALL);
}else{
JDLogger.removeConsoleHandler();
} else {
JDLogger.removeConsoleHandler();
}
// JDInit.setupProxy();
// JDInit.setupSocks();
@ -430,25 +429,34 @@ public class Main {
final JDController controller = init.initController();
// if (JDInitFlags.SWITCH_DEBUG || JDUtilities.getConfiguration().getBooleanProperty(Configuration.LOGGER_FILELOG, false)) {
// try {
//
// File log = JDUtilities.getResourceFile("logs/" + (JDInitFlags.SWITCH_DEBUG ? "debug" : "") + "log_" + System.currentTimeMillis() + ".log");
// LOGGER.info("DEBUGGER: Write log to "+log);
// if (!log.getParentFile().exists()) {
// log.getParentFile().mkdirs();
// }
// controller.setLogFileWriter(new BufferedWriter(new FileWriter(log)));
// } catch (IOException e) {
// jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
// }
// }
// if (JDInitFlags.SWITCH_DEBUG ||
// JDUtilities.getConfiguration().getBooleanProperty
// (Configuration.LOGGER_FILELOG, false)) {
// try {
//
// File log = JDUtilities.getResourceFile("logs/" +
// (JDInitFlags.SWITCH_DEBUG ? "debug" : "") + "log_" +
// System.currentTimeMillis() + ".log");
// LOGGER.info("DEBUGGER: Write log to "+log);
// if (!log.getParentFile().exists()) {
// log.getParentFile().mkdirs();
// }
// controller.setLogFileWriter(new BufferedWriter(new FileWriter(log)));
// } catch (IOException e) {
//jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE
// ,"Exception occured",e);
// }
// }
LOGGER.info("init Webupdate");
Main.setSplashStatus(splashScreen, 10, JDLocale.L("gui.splash.text.webupdate", "Check Updates"));
new WebUpdate().doWebupdate(false);
LOGGER.info("init plugins");
Main.setSplashStatus(splashScreen, 15, JDLocale.L("gui.splash.text.loadPlugins", "Lade Plugins"));
init.initPlugins();
Locale.setDefault(Locale.ENGLISH);
LOGGER.info("init gui");
Main.setSplashStatus(splashScreen, 20, JDLocale.L("gui.splash.text.loadGUI", "Lade Benutzeroberfläche"));
new GuiRunnable() {
@ -482,12 +490,12 @@ public class Main {
LOGGER.info("Revision: " + JDUtilities.getJDTitle());
LOGGER.finer("Runtype: " + JDUtilities.getRunType());
try{
throw new Exception ("Test Exception ");
}catch(Exception e){
JDLogger.exception(e);
}
try {
throw new Exception("Test Exception ");
} catch (Exception e) {
JDLogger.exception(e);
}
try {
splashScreen.finish();
} catch (Exception e) {
@ -495,13 +503,28 @@ try{
}
init.checkUpdate();
// logger.info(JDUtilities.getSubConfig(SimpleGUI.GUICONFIGNAME).
// getBooleanProperty(SimpleGUI.PARAM_DISABLE_CONFIRM_DIALOGS,
// false).toString());
// if ((JDUtilities.getRunType() == JDUtilities.RUNTYPE_LOCAL_JARED) && (JDUtilities.getConfiguration().getBooleanProperty(Configuration.LOGGER_FILELOG, false) || level.equals(Level.ALL) || level.equals(Level.FINER) || level.equals(Level.FINE)) && !JDInitFlags.SWITCH_DEBUG && (!JDUtilities.getSubConfig(SimpleGuiConstants.GUICONFIGNAME).getBooleanProperty(SimpleGuiConstants.PARAM_DISABLE_CONFIRM_DIALOGS, false))) {
// JDUtilities.getGUI().showHelpMessage(JDLocale.L("main.start.logwarning.title", "Logwarnung"), JDLocale.LF("main.start.logwarning.body", "ACHTUNG. Das Loglevel steht auf %s und der Dateischreiber ist %s. \r\nDiese Einstellungen belasten das System und sind nur zur Fehlersuche geeignet.", level.getName(), JDUtilities.getConfiguration().getBooleanProperty(Configuration.LOGGER_FILELOG, false) ? JDLocale.L("main.status.active", "an") : JDLocale.L("main.status.inactive", "aus")), true, JDLocale.L("main.urls.faq", "http://jdownloader.org/faq.php?lng=deutsch"), null, 10);
// }
// if ((JDUtilities.getRunType() == JDUtilities.RUNTYPE_LOCAL_JARED) &&
// (JDUtilities.getConfiguration().getBooleanProperty(Configuration.
// LOGGER_FILELOG, false) || level.equals(Level.ALL) ||
// level.equals(Level.FINER) || level.equals(Level.FINE)) &&
// !JDInitFlags.SWITCH_DEBUG &&
// (!JDUtilities.getSubConfig(SimpleGuiConstants
// .GUICONFIGNAME).getBooleanProperty
// (SimpleGuiConstants.PARAM_DISABLE_CONFIRM_DIALOGS, false))) {
// JDUtilities.getGUI().showHelpMessage(JDLocale.L(
// "main.start.logwarning.title", "Logwarnung"),
// JDLocale.LF("main.start.logwarning.body",
// "ACHTUNG. Das Loglevel steht auf %s und der Dateischreiber ist %s. \r\nDiese Einstellungen belasten das System und sind nur zur Fehlersuche geeignet."
// , level.getName(),
// JDUtilities.getConfiguration().getBooleanProperty(Configuration
// .LOGGER_FILELOG, false) ? JDLocale.L("main.status.active", "an") :
// JDLocale.L("main.status.inactive", "aus")), true,
// JDLocale.L("main.urls.faq",
// "http://jdownloader.org/faq.php?lng=deutsch"), null, 10);
// }
JDUtilities.getController().fireControlEvent(new ControlEvent(this, ControlEvent.CONTROL_INIT_COMPLETE, null));
@ -510,7 +533,7 @@ try{
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE,"Exception occured",e);
jd.controlling.JDLogger.getLogger().log(java.util.logging.Level.SEVERE, "Exception occured", e);
}
new PackageManager().interact(this);

View File

@ -98,7 +98,7 @@ public interface UIInterface extends ControlListener {
public boolean showConfirmDialog(String string);
public boolean showConfirmDialog(String string, String title);
public String[] showLoginDialog(String title,String defaultUser,String defaultPassword,String errorMessage);
/**
* Zeigt einen MessageDialog mit Countdown an
*

View File

@ -107,8 +107,11 @@ import net.miginfocom.swing.MigLayout;
import org.jdesktop.swingx.JXCollapsiblePane;
import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.JXLoginDialog;
import org.jdesktop.swingx.JXTipOfTheDay;
import org.jdesktop.swingx.JXTitledSeparator;
import org.jdesktop.swingx.JXLoginPane.Status;
import org.jdesktop.swingx.auth.LoginService;
import org.jdesktop.swingx.tips.DefaultTip;
import org.jdesktop.swingx.tips.DefaultTipOfTheDayModel;
import org.jvnet.substance.SubstanceLookAndFeel;
@ -750,7 +753,7 @@ public class SimpleGUI extends JXFrame implements UIInterface, ActionListener, W
if (SimpleGuiConstants.GUI_CONFIG.getBooleanProperty(SimpleGuiConstants.PARAM_START_DOWNLOADS_AFTER_START, false)) {
JDUtilities.getController().startDownloads();
}
break;
case ControlEvent.CONTROL_PLUGIN_ACTIVE:
logger.info("Plugin Aktiviert: " + event.getSource());
@ -1437,4 +1440,19 @@ public class SimpleGUI extends JXFrame implements UIInterface, ActionListener, W
return this.linkListPane;
}
public String[] showLoginDialog(String title, String defaultUser, String defaultPassword,String error) {
JXLoginDialog d = new JXLoginDialog(this,JDLocale.L("gui.dialogs.login.title","Login required"),true);
if(defaultPassword!=null)d.getPanel().setPassword(defaultPassword.toCharArray());
d.getPanel().setUserName(defaultUser);
d.getPanel().setErrorMessage(error);
d.getPanel().setMessage(title);
d.setVisible(true);
if(d.getStatus()!=Status.SUCCEEDED)return null;
return new String[]{ d.getPanel().getUserName(),new String(d.getPanel().getPassword())};
}
}