public void updateActionPanel() { rightButtonPanel.clear(); boolean exam = app.isExam(); setStyleName("examToolbar", exam); if (exam) { // We directly read the parameters to show the intention. // It may be possible that 3D is not supported from technical // reasons (e.g. the graphics card is problematic), but in such // cases we don't want to show that here. if (!app.getExam().isCASAllowed()) { Label nocas = new Label("CAS"); nocas.getElement().getStyle().setTextDecoration(TextDecoration.LINE_THROUGH); nocas.getElement().setClassName("timer"); rightButtonPanel.add(nocas); } if (!app.getExam().is3DAllowed()) { Label no3d = new Label("3D"); no3d.getElement().getStyle().setTextDecoration(TextDecoration.LINE_THROUGH); no3d.getElement().setClassName("timer"); rightButtonPanel.add(no3d); } rightButtonPanel.add(getTimer()); } if (app.getLAF().undoRedoSupported()) { addUndoPanel(); } if (app.getArticleElement().getDataParamShowMenuBar(false) || app.getArticleElement().getDataParamApp()) { PerspectiveResources pr = ((ImageFactory) GWT.create(ImageFactory.class)).getPerspectiveResources(); this.menuBarShowing = true; // openMenuButton = new StandardButton(pr.button_open_menu(), null, // 32); // // openMenuButton.addFastClickHandler(new FastClickHandler() { // @Override // public void onClick(Widget source) { // app.hideKeyboard(); // app.closePopups(); // GGWToolBar.this.app.toggleMenu(); // } openMenuButton = new StandardButton(pr.menu_header_open_menu(), null, 32); openMenuButton.getUpHoveringFace().setImage(getImage(pr.menu_header_open_menu_hover(), 32)); openMenuButton.addFastClickHandler( new FastClickHandler() { @Override public void onClick(Widget source) { app.hideKeyboard(); app.closePopups(); GGWToolBar.this.app.toggleMenu(); } }); openMenuButton.addDomHandler( new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { GGWToolBar.this.app.toggleMenu(); } if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT) { GGWToolBar.this.selectMenuButton(0); } if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) { GGWToolBar.this.toolBar.selectMenu(0); } } }, KeyUpEvent.getType()); if (!exam && app.enableFileFeatures()) { // openSearchButton = new // StandardButton(pr.button_open_search(), // null, 32); // openSearchButton.addFastClickHandler(new FastClickHandler() { // @Override // public void onClick(Widget source) { // app.openSearch(null); // } // }); openSearchButton = new StandardButton(pr.menu_header_open_search(), null, 32); openSearchButton.getUpFace().setImage(getImage(pr.menu_header_open_search(), 32)); openSearchButton .getUpHoveringFace() .setImage(getImage(pr.menu_header_open_search_hover(), 32)); openSearchButton.addFastClickHandler( new FastClickHandler() { @Override public void onClick(Widget source) { app.openSearch(null); } }); openSearchButton.addDomHandler( new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { app.openSearch(null); } if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) { GGWToolBar.this.selectMenuButton(1); } if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT) { GGWToolBar.this.toolBar.selectMenu(-1); } } }, KeyUpEvent.getType()); this.rightButtonPanel.add(openSearchButton); } this.rightButtonPanel.add(openMenuButton); } }
// undo-redo buttons private void addUndoPanel() { PerspectiveResources pr = ((ImageFactory) GWT.create(ImageFactory.class)).getPerspectiveResources(); // Image redoImage = new Image(GuiResources.INSTANCE.button_redo()); // redoButton = new StandardButton(pr.button_redo(), null, 32); // redoButton.getElement().appendChild(redoImage.getElement()); // redoButton.addFastClickHandler(new FastClickHandler(){ // @Override // public void onClick(Widget source) { // app.getGuiManager().redo(); // app.hideKeyboard(); // } // }); redoButton = new StandardButton(pr.menu_header_redo(), null, 32); redoButton.getUpHoveringFace().setImage(getImage(pr.menu_header_redo_hover(), 32)); redoButton.addFastClickHandler( new FastClickHandler() { @Override public void onClick(Widget source) { app.getGuiManager().redo(); app.hideKeyboard(); } }); redoButton.addStyleName("redoButton"); // redoButton.getElement().addClassName("button"); redoButton.getElement().getStyle().setOverflow(Overflow.HIDDEN); // Image undoImage = new Image(GuiResources.INSTANCE.button_undo()); // undoButton = new StandardButton(pr.button_undo(), null, 32); // undoButton.getElement().appendChild(undoImage.getElement()); // undoButton.addFastClickHandler(new FastClickHandler(){ // @Override // public void onClick(Widget source) { // app.getGuiManager().undo(); // app.hideKeyboard(); // } // }); undoButton = new StandardButton(pr.menu_header_undo(), null, 32); undoButton.getUpHoveringFace().setImage(getImage(pr.menu_header_undo_hover(), 32)); undoButton.addFastClickHandler( new FastClickHandler() { @Override public void onClick(Widget source) { app.getGuiManager().undo(); app.hideKeyboard(); } }); undoButton.addStyleName("undoButton"); // undoButton.getElement().addClassName("button"); // toolBarPanel.add(redoButton); updateUndoActions(); rightButtonPanel.add(undoButton); rightButtonPanel.add(redoButton); setLabels(); }