/** Update the panel. */
  public void updatePanel() {

    // load content if panel was hidden till now
    if (component == null && isVisible()) {
      component = loadComponent();
      add(component, BorderLayout.CENTER);

      if (isStyleBarVisible()) {
        setStyleBar();
      }

      // load toolbar if this panel has one
      if (hasToolbar()) {
        toolbar = new ToolbarD(app, this);

        if (isOpenInFrame()) {
          toolbarContainer = new ToolbarContainer(app, false);
          toolbarContainer.addToolbar(toolbar);
          toolbarContainer.buildGui();
          toolbarContainer.setActiveToolbar(getViewId());
          toolbarPanel.add(toolbarContainer, BorderLayout.CENTER);
        }
      }

      // euclidian view uses the general toolbar
      if (this instanceof EuclidianDockPanelAbstract) {
        // TODO implement..
      }
    }

    // make panels visible if necessary
    if (isVisible()) {

      if (isStyleBarVisible()) {
        setStyleBar();
      }

      // display toolbar panel if the dock panel is open in a frame
      if (hasToolbar()) {
        toolbarPanel.setVisible(frame != null);
      }
    }

    // if this is the last dock panel don't display the title bar, otherwise
    // take the user's configuration into consideration

    titlePanel.setVisible(
        app.getSettings().getLayout().showTitleBar()
            && !(isAlone && !isMaximized())
            && !app.isApplet()
            && (!isOpenInFrame()));

    // update stylebar visibility
    setShowStyleBar(isStyleBarVisible());
    updateStyleBarVisibility();

    // update the title bar if necessary
    updateTitleBarIfNecessary();
  }
 /** @return If the style bar should be visible. */
 protected boolean isStyleBarVisible() {
   if (id == App.VIEW_EUCLIDIAN || id == App.VIEW_EUCLIDIAN2 || id == App.VIEW_ALGEBRA) {
     if (!app.getSettings().getLayout().isAllowingStyleBar()) {
       return false;
     }
   }
   return (showStyleBar || !titlePanel.isVisible());
 }
 private SpreadsheetSettings settings() {
   return app.getSettings().getSpreadsheet();
 }
  public ConstructionProtocolViewD(final AppD app) {
    // cpPanel = new JPanel(new BorderLayout());

    this.app = app;
    kernel = app.getKernel();
    data = new ConstructionTableData(this);
    useColors = true;
    addIcons = false;

    table = new JTable();
    table.setAutoCreateColumnsFromModel(false);
    table.setModel(((GAbstractTableModelD) data.getImpl()).getImpl());
    table.setRowSelectionAllowed(true);
    table.setGridColor(Color.lightGray);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);

    // header
    JTableHeader header = table.getTableHeader();
    // header.setUpdateTableInRealTime(true);
    header.setReorderingAllowed(false);

    // init model
    ConstructionTableCellRenderer renderer;
    HeaderRenderer headerRend = new HeaderRenderer();
    tableColumns = new TableColumn[data.columns.length];

    for (int k = 0; k < data.columns.length; k++) {
      renderer = new ConstructionTableCellRenderer();
      renderer.setHorizontalAlignment(data.columns[k].getAlignment());
      tableColumns[k] = new TableColumn(k, data.columns[k].getPreferredWidth(), renderer, null);
      tableColumns[k].setMinWidth(data.columns[k].getMinWidth());
      tableColumns[k].setHeaderRenderer(headerRend);
      if (data.columns[k].getInitShow()) table.addColumn(tableColumns[k]);
      if (data.columns[k].getTitle() == "Caption") {
        tableColumns[k].setCellEditor(new ConstructionTableCellEditor());
      }
    }
    // first column "No." should have fixed width
    tableColumns[0].setMaxWidth(tableColumns[0].getMinWidth());

    table
        .getColumnModel()
        .addColumnModelListener(((ConstructionTableData) data).new ColumnMovementListener());

    scrollPane = new JScrollPane(table);
    scrollPane.getViewport().setBackground(Color.white);
    // cpPanel.add(scrollPane, BorderLayout.CENTER);

    // clicking
    ConstructionMouseListener ml = new ConstructionMouseListener();
    table.addMouseListener(ml);
    table.addMouseMotionListener(ml);
    header.addMouseListener(ml); // double clicking, right-click menu
    scrollPane.addMouseListener(ml); // right-click menu

    // keys
    ConstructionKeyListener keyListener = new ConstructionKeyListener();
    table.addKeyListener(keyListener);

    app.getGuiManager().registerConstructionProtocolView(this);

    // navigation bar
    // protNavBar = new ConstructionProtocolNavigationD(app);
    // protNavBar.register(this);
    // protNavBar.setPlayButtonVisible(false);
    // protNavBar.setConsProtButtonVisible(false);
    // this.cpPanel.add(protNavBar.getImpl(), BorderLayout.SOUTH);
    // org.geogebra.desktop.util.Util.addKeyListenerToAll(protNavBar.getImpl(),
    // keyListener);

    initGUI();
    initActions();

    ConstructionProtocolSettings cps = app.getSettings().getConstructionProtocol();
    settingsChanged(cps);
    cps.addListener(this);
  }