/** Creates the WorkingView */ private void createWorkingView() { workingViewLabels = getResourceBundle(tbe.getLang()); this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); Invoker.getInstance().clear(); // Toolbar this.add(toolbar, BorderLayout.NORTH); // Attributebar sideBar = new SideBar(board); this.add(sideBar, BorderLayout.WEST); // gemeinsames Panel für Board und Legend rightPanel.setLayout(new BorderLayout()); rightPanel.add(new JScrollPane(board), BorderLayout.CENTER); class ViewMouseListener extends MouseAdapter { public void mousePressed(MouseEvent e) { if (e.getButton() == 3 && !(currentTool instanceof CursorTool)) { setTool(cursorTool, cursorButton); } else { Point p = new Point(e.getX(), e.getY()); WorkingView.this.getTool().mouseDown(p.x, p.y, e); } if (currentTool instanceof ArrowTool || currentTool instanceof TextBoxTool) { setTool(cursorTool, cursorButton); } board.requestFocus(); } public void mouseReleased(MouseEvent e) { checkDefaultButtonVisibility(); } } initDefaultTools(); initSportTools(); listeners[0] = board.getMouseListeners()[0]; listeners[1] = new ViewMouseListener(); board.addMouseListener(listeners[1]); // Legend legendBar = new LegendBar(board); rightPanel.add(legendBar, BorderLayout.SOUTH); this.add(rightPanel, BorderLayout.CENTER); this.activatePoints(false); tbe.getMenu().setVisibleToolbar(!this.toolbar.isVisible()); tbe.getMenu().setVisibleLegend(!this.legendBar.isVisible()); tbe.getMenu().setVisibleSidebar(!this.sideBar.isVisible()); }
/** Shows/Hide Toolbar */ public void hideToolbar() { toolbar.setVisible(!this.toolbar.isVisible()); tbe.getMenu().setVisibleToolbar(!this.toolbar.isVisible()); }
/** Shows/Hide Sidebar */ public void hideSidebar() { sideBar.setVisible(!this.sideBar.isVisible()); tbe.getMenu().setVisibleSidebar(!this.sideBar.isVisible()); }
/** Shows/Hide Legend */ public void hideLegend() { legendBar.setVisible(!this.legendBar.isVisible()); tbe.getMenu().setVisibleLegend(!this.legendBar.isVisible()); }
/** * Activate/Deactivate Add and Remove Buttons * * @param b boolean, true = activate, false = deactivate */ public void activatePoints(boolean b) { tbe.getMenu().activatePoints(b); rem.setEnabled(b); add.setEnabled(b); }