Exemplo n.º 1
0
 @Override
 public void setVisible(boolean visible) {
   if (this.visible != visible) {
     this.visible = visible;
     if (app.getGuiManager() != null) {
       app.getGuiManager().updatePropertiesViewStylebar();
     }
   }
 }
Exemplo n.º 2
0
 private void setLocation() {
   if (app.getGuiManager().showView(App.VIEW_DATA_ANALYSIS)) {
     setLocationRelativeTo(
         ((DataAnalysisViewD) app.getGuiManager().getDataAnalysisView())
             .getDataAnalysisViewComponent());
   } else {
     setLocationRelativeTo(app.getMainComponent());
   }
 }
Exemplo n.º 3
0
 /** sets the active toolbar */
 protected void setActiveToolBar() {
   if (hasToolbar()) {
     ((GuiManagerD) app.getGuiManager()).getToolbarPanel().setActiveToolbar(toolbar);
   } else {
     ((GuiManagerD) app.getGuiManager()).getToolbarPanel().setActiveToolbar(-1);
   }
   // switching the view may cause shrinking of help panel,
   // we need an update here
   ((GuiManagerD) app.getGuiManager()).getToolbarPanel().validate();
   ((GuiManagerD) app.getGuiManager()).getToolbarPanel().updateHelpText();
 }
Exemplo n.º 4
0
 @Override
 protected void setActiveToolBar() {
   // use the focused euclidian view for active toolbar
   if (dockManager.getFocusedEuclidianPanel() == null
       || !dockManager.getFocusedEuclidianPanel().hasToolbar()) {
     ((GuiManagerD) app.getGuiManager()).getToolbarPanel().setActiveToolbar(-1);
   } else {
     ((GuiManagerD) app.getGuiManager())
         .getToolbarPanel()
         .setActiveToolbar(dockManager.getFocusedEuclidianPanel().getToolbar());
   }
 }
Exemplo n.º 5
0
  /** Display this panel in an external window. */
  public void windowPanel() {

    // try to hide the panel
    if (dockManager.hide(this, false)) {

      // move the toolbar from the main window to the panel
      if (hasToolbar()) {
        if (toolbarContainer == null) {
          toolbarContainer = new ToolbarContainer(app, false);
        }

        toolbarContainer.addToolbar(toolbar);
        toolbarContainer.buildGui();
        toolbarContainer.setActiveToolbar(getViewId());
        toolbarPanel.add(toolbarContainer, BorderLayout.CENTER);

        ToolbarContainer mainContainer = ((GuiManagerD) app.getGuiManager()).getToolbarPanel();
        mainContainer.removeToolbar(toolbar);
        mainContainer.updateToolbarPanel();
      }

      setVisible(true);
      createFrame();
    }
  }
Exemplo n.º 6
0
  @Override
  protected JComponent loadComponent() {
    JScrollPane scrollPane = new JScrollPane((Component) app.getGuiManager().getAlgebraView());
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    scrollPane.setBackground(Color.white);

    return scrollPane;
  }
Exemplo n.º 7
0
  /**
   * @param source event source
   * @param targetGeos cells that need updating
   */
  protected void processSource(Object source, ArrayList<GeoElement> targetGeos) {

    if (source == btnTextColor) {
      if (btnTextColor.getSelectedIndex() >= 0) {
        applyTextColor(targetGeos);
        // btnTextColor.setFgColor((Color)btnTextColor.getSelectedValue());
        // btnItalic.setForeground((Color)btnTextColor.getSelectedValue());
        // btnBold.setForeground((Color)btnTextColor.getSelectedValue());
      }
    } else if (source == btnBold) {
      applyFontStyle(targetGeos);
    } else if (source == btnItalic) {
      applyFontStyle(targetGeos);
    } else if (source == btnTextSize) {
      applyTextSize(targetGeos);
    } else if (source == btnUseAsText) {
      int i = casView.getConsoleTable().getEditingRow();
      int pos =
          ((CASTableCellEditorD)
                  casView.getConsoleTable().getCellEditor(i, CASTableD.COL_CAS_CELLS))
              .getCaretPosition();
      applyUseAsText(targetGeos);
      casView.getConsoleTable().startEditingRow(i);
      ((CASTableCellEditorD) casView.getConsoleTable().getCellEditor(i, CASTableD.COL_CAS_CELLS))
          .setCaretPosition(pos);
    } else if (source == btnShowKeyboard) {
      if (((GuiManagerInterfaceD) app.getGuiManager()) != null) {
        if (AppD.isVirtualKeyboardActive()
            && !((GuiManagerD) app.getGuiManager()).showVirtualKeyboard()) {

          // if keyboard is active but hidden, just show it
          ((GuiManagerD) app.getGuiManager()).toggleKeyboard(true);
          ((GuiManagerD) app.getGuiManager()).getVirtualKeyboard().toggleNumeric(true);

        } else {

          AppD.setVirtualKeyboardActive(!AppD.isVirtualKeyboardActive());
          ((GuiManagerD) app.getGuiManager()).toggleKeyboard(AppD.isVirtualKeyboardActive());
          ((GuiManagerD) app.getGuiManager())
              .getVirtualKeyboard()
              .toggleNumeric(AppD.isVirtualKeyboardActive());
        }
      }
    }
    updateStyleBar();
  }
Exemplo n.º 8
0
  /**
   * Mark this panel as focused. When gaining focus the panel will automatically request focus for
   * its parent frame.
   *
   * @remark The focus system implemented here has nothing to do with swings focus system, therefore
   *     Swings focus methods won't work.
   * @param hasFocus has the focus
   * @param updatePropertiesView update properties view
   */
  public void setFocus(boolean hasFocus, boolean updatePropertiesView) {

    if (hasFocus && updatePropertiesView) {
      ((GuiManagerD) app.getGuiManager()).updatePropertiesView();
    }

    setFocus(hasFocus);
  }
Exemplo n.º 9
0
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == btnOK) {
      dataSourcePanel.applySettings();
      app.getGuiManager().setShowView(true, App.VIEW_DATA_ANALYSIS);
      app.setMoveMode();
      setVisible(false);

    } else if (source == btnCancel) {
      app.setMoveMode();
      setVisible(false);
    }
  }
Exemplo n.º 10
0
  /** Display this panel in the main window. */
  public void unwindowPanel() {
    // hide the frame
    dockManager.hide(this, false);

    // don't display this panel in a frame the next time
    setOpenInFrame(false);

    // show the panel in the main window
    dockManager.show(this);

    // as this view already *had* focus and will retain focus
    // DockManager::show()
    // won't be able to update the active toolbar
    if (hasToolbar()) {
      ((GuiManagerD) app.getGuiManager()).getToolbarPanel().setActiveToolbar(toolbar);
    }
  }
Exemplo n.º 11
0
 @Override
 protected JComponent loadStyleBar() {
   return ((AlgebraViewD) app.getGuiManager().getAlgebraView()).getHelperBar();
 }
  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);
  }