X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FProjectPanel.java;h=dd2701650e4ce2498afa30e74b206b60af807f67;hb=90f3a1c8e0c85f19c82130e49d7a605cb9e55286;hp=c16f2a527a8906a4f5a91647eb5387c7efddd092;hpb=1d6a66d8572e57f31aa1f440646cf00dda4d1800;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/ProjectPanel.java b/src/net/pterodactylus/jsite/gui/ProjectPanel.java index c16f2a5..dd27016 100644 --- a/src/net/pterodactylus/jsite/gui/ProjectPanel.java +++ b/src/net/pterodactylus/jsite/gui/ProjectPanel.java @@ -20,10 +20,15 @@ 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. @@ -33,13 +38,35 @@ import javax.swing.JPanel; */ public class ProjectPanel extends JPanel { + /** The Swing interface. */ + private final SwingInterface swingInterface; + 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 +77,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; } }