current state
[jSite2.git] / src / net / pterodactylus / jsite / gui / ProjectPanel.java
index c16f2a5..dd27016 100644 (file)
 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;
        }
 
 }