X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FProjectPanel.java;h=13ff71603f370ea3cd65e5e4f4461b9ef5acc295;hb=40aee755466b1d99bc6204112e923ed13201d89a;hp=c16f2a527a8906a4f5a91647eb5387c7efddd092;hpb=faca58518e84a345f6a737fab1dc1e2a6a1f9579;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/ProjectPanel.java b/src/net/pterodactylus/jsite/gui/ProjectPanel.java index c16f2a5..13ff716 100644 --- a/src/net/pterodactylus/jsite/gui/ProjectPanel.java +++ b/src/net/pterodactylus/jsite/gui/ProjectPanel.java @@ -20,28 +20,59 @@ package net.pterodactylus.jsite.gui; import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.GridBagLayout; import javax.swing.BorderFactory; +import javax.swing.JButton; import javax.swing.JPanel; +import net.pterodactylus.jsite.core.Project; + /** * A panel that contains all information about a project and lets the user edit * the properties of the project. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ public class ProjectPanel extends JPanel { + /** The Swing interface. */ + private final SwingInterface swingInterface; + + /** The project to show. */ + private final Project project; + /** * Creates a new project panel. + * + * @param swingInterface + * The Swing interface + * @param project + * The project to display */ - public ProjectPanel() { + public ProjectPanel(SwingInterface swingInterface, Project project) { super(new BorderLayout(12, 12)); + this.swingInterface = swingInterface; + this.project = project; initComponents(); } // + // ACCESSORS + // + + /** + * Returns the project that is displayed in this panel. + * + * @return The project of this panel + */ + public Project getProject() { + return project; + } + + // // PRIVATE METHODS // @@ -50,7 +81,38 @@ public class ProjectPanel extends JPanel { */ private void initComponents() { setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); - + + JPanel propertiesPanel = createPropertiesPanel(); + add(propertiesPanel, BorderLayout.CENTER); + + JPanel buttonPanel = createButtonPanel(); + add(buttonPanel, BorderLayout.PAGE_END); + } + + /** + * Creates the properties panel. + * + * @return The properties panel + */ + private JPanel createPropertiesPanel() { + JPanel propertiesPanel = new JPanel(new GridBagLayout()); + + return propertiesPanel; + } + + /** + * Creates the button panel. + * + * @return The button panel + */ + private JPanel createButtonPanel() { + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 12, 12)); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(-12, -12, -12, -12)); + + buttonPanel.add(new JButton(swingInterface.getDeleteProjectAction())); + buttonPanel.add(new JButton(swingInterface.getCloneProjectAction())); + + return buttonPanel; } }