123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- package ui.view.holarchy;
- import javax.swing.JFrame;
- import javax.swing.JScrollPane;
- import javax.swing.JSeparator;
- import javax.swing.JSplitPane;
- import javax.swing.SwingConstants;
- import classes.Holon;
- import util.ImageImport;
- public class HolarchyWindow extends JFrame {
- JFrame parentFrame;
- JSeparator sep;
- HolarchyPanel holarchyPanel;
- HolonInfoPanel infoPanel;
- HolarchyTreePanel treePanel;
- ui.controller.Control controller;
- public boolean isClosed = false;
- JScrollPane scrollPane;
-
- public HolarchyWindow(JFrame parentFrame, ui.controller.Control controller){
- this.controller = controller;
-
- setBounds(0, 0, parentFrame.getWidth()-200, parentFrame.getHeight()-100);
- this.setIconImage(ImageImport.loadImage("/Images/Holeg.png", 30, 30));
- this.setTitle("Holarchy");
- setLocationRelativeTo(parentFrame);
- this.setVisible(true);
- this.addWindowListener(new java.awt.event.WindowAdapter() {
- @Override
- public void windowClosing(java.awt.event.WindowEvent windowEvent) {
- isClosed = true;
- }
- });
-
- this.sep = new JSeparator(SwingConstants.HORIZONTAL);
- this.sep.setBounds(0, 0, this.getWidth(), 1);
- this.add(this.sep);
-
- this.holarchyPanel = new HolarchyPanel(this, controller);
- this.holarchyPanel.setBounds(66, 0, this.getWidth()*4/5-66, this.getHeight());
-
- this.infoPanel = new HolonInfoPanel(this, controller);
- // this.infoPanel.setBounds(this.getWidth()*4/5+1, 0, this.getWidth()*1/5-1, this.getHeight());
-
- this.treePanel = new HolarchyTreePanel(this, controller);
- scrollPane = new JScrollPane(this.infoPanel);
- scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- JSplitPane infoSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, new JScrollPane(this.treePanel));
- infoSplit.setDividerLocation(this.getHeight()/2);
- infoSplit.setEnabled(false);
-
- JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.holarchyPanel, infoSplit);
- splitPane.setDividerLocation(this.getWidth()*4/5);
- splitPane.setEnabled(false);
- this.add(splitPane);
- }
-
- public void displayHolonInfos(Holon h) {
- if(this.infoPanel == null)
- return;
- this.infoPanel.displayInfos(h);
- }
-
- public void clearInfos() {
- if(this.infoPanel == null)
- return;
- this.infoPanel.clearInfos();
- }
-
- public void update() {
- if(this.holarchyPanel != null)
- this.holarchyPanel.update();
- if(this.infoPanel != null)
- this.infoPanel.update();
- if(this.treePanel != null)
- this.treePanel.update();
- }
-
- }
|