X-Git-Url: https://git.pterodactylus.net/?p=jSite2.git;a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FMainWindow.java;h=2e2e0825cbefff722330760e8714e0e6db79bcd7;hp=6d8df0a7f1922affef3842416e1f990148342960;hb=f0bc03c6988cc9abcb2fcba8f149b1d41031ec5e;hpb=9ed381297cca35dfdab072643bdb38444cfd9779
diff --git a/src/net/pterodactylus/jsite/gui/MainWindow.java b/src/net/pterodactylus/jsite/gui/MainWindow.java
index 6d8df0a..2e2e082 100644
--- a/src/net/pterodactylus/jsite/gui/MainWindow.java
+++ b/src/net/pterodactylus/jsite/gui/MainWindow.java
@@ -64,7 +64,7 @@ import net.pterodactylus.util.swing.SwingUtils;
/**
* Defines the main window of the application.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
public class MainWindow extends JFrame implements WindowListener, I18nable, PropertyChangeListener {
@@ -127,7 +127,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Creates a new main window that redirects all actions to the given swing
* interface.
- *
+ *
* @param swingInterface
* The swing interface to receive all actions
*/
@@ -149,7 +149,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets the text of the status bar.
- *
+ *
* @param text
* The text of the status bar
*/
@@ -174,7 +174,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Returns the status bar clear delay (in milliseconds).
- *
+ *
* @return The status bar clear delay
*/
public int getStatusBarClearDelay() {
@@ -183,7 +183,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets the status bar clear delay (in milliseconds).
- *
+ *
* @param statusBarClearDelay
* The status bar clear delay
*/
@@ -193,7 +193,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets whether the advanced mode is activated.
- *
+ *
* @param advancedMode
* true
if the advanced mode is activated,
* false
if the simple mode is activated
@@ -212,7 +212,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Returns the currently selected project.
- *
+ *
* @return The currently selected project
*/
public Project getSelectedProject() {
@@ -221,7 +221,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets the given node to the âonlineâ state.
- *
+ *
* @param node
* The node to set online
*/
@@ -231,7 +231,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets the given node to the âofflineâ state in the status bar.
- *
+ *
* @param node
* The node to set offline
*/
@@ -241,7 +241,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Sets the given node to the âerrorâ state in the status bar.
- *
+ *
* @param node
* The node to set the error state for
*/
@@ -255,7 +255,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Adds a node to the menu.
- *
+ *
* @param node
* The node to add
*/
@@ -271,24 +271,38 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
NodeLabel nodeLabel = new NodeLabel(swingInterface, node, onlineIcon, offlineIcon, errorIcon);
nodeLabels.put(node, nodeLabel);
statusBar.addSideComponent(nodeLabel);
+ for (int tabIndex = 0, tabCount = projectPane.getTabCount(); tabIndex < tabCount; tabIndex++) {
+ Component tabComponent = projectPane.getComponentAt(tabIndex);
+ if (!(tabComponent instanceof ProjectPanel)) {
+ continue;
+ }
+ ((ProjectPanel) tabComponent).addNode(node);
+ }
node.addPropertyChangeListener(this);
}
/**
* Removes a node from the menu.
- *
+ *
* @param node
* The node to remove
*/
void removeNode(Node node) {
nodeMenu.remove(nodeMenus.remove(node));
statusBar.removeSideComponent(nodeLabels.remove(node));
+ for (int tabIndex = 0, tabCount = projectPane.getTabCount(); tabIndex < tabCount; tabIndex++) {
+ Component tabComponent = projectPane.getComponentAt(tabIndex);
+ if (!(tabComponent instanceof ProjectPanel)) {
+ continue;
+ }
+ ((ProjectPanel) tabComponent).addNode(node);
+ }
node.removePropertyChangeListener(this);
}
/**
* Adds a project to the project pane.
- *
+ *
* @param project
* The project to add
* @param switchToProject
@@ -312,7 +326,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Removes the pane containing the given project.
- *
+ *
* @param project
* The project whose pane to remove
*/
@@ -374,7 +388,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
/**
* Returns the index of the project panel that contains the given project.
- *
+ *
* @param project
* The wanted project
* @return The index of {@link #projectPane}âs tab that contains the given
@@ -421,7 +435,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
languageMenu = new I18nMenu("mainWindow.menu.language");
menuBar.add(languageMenu);
- for (I18nAction languageAction: swingInterface.getLanguageActions()) {
+ for (I18nAction languageAction : swingInterface.getLanguageActions()) {
languageMenu.add(new FixedJMenuItem(languageAction));
}
@@ -493,17 +507,17 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
jSiteMenu.updateI18n();
nodeMenu.updateI18n();
languageMenu.updateI18n();
- for (Node node: swingInterface.getNodes()) {
+ for (Node node : swingInterface.getNodes()) {
swingInterface.getNodeConnectAction(node).updateI18n();
swingInterface.getNodeDisconnectAction(node).updateI18n();
swingInterface.getNodeEditAction(node).updateI18n();
swingInterface.getNodeDeleteAction(node).updateI18n();
}
- for (Project project: swingInterface.getProjects()) {
+ for (Project project : swingInterface.getProjects()) {
swingInterface.getCloneProjectAction(project).updateI18n();
swingInterface.getDeleteProjectAction(project).updateI18n();
}
- for (I18nAction languageAction: swingInterface.getLanguageActions()) {
+ for (I18nAction languageAction : swingInterface.getLanguageActions()) {
languageAction.updateI18n();
}
helpMenu.updateI18n();