private void setSelected(ToolButton button) { if (fSelectedToolButton != null) { fSelectedToolButton.reset(); } fSelectedToolButton = button; if (fSelectedToolButton != null) { fSelectedToolButton.select(); } }
public BaseView(PartStackUIResources resources) { container = new DockLayoutPanel(Style.Unit.PX); container.getElement().setAttribute("role", "part"); container.setSize("100%", "100%"); container.getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE); initWidget(container); toolBar = new DockLayoutPanel(Style.Unit.PX); toolBar.addStyleName(resources.partStackCss().ideBasePartToolbar()); toolBar.getElement().setAttribute("role", "toolbar"); toolBar.addDomHandler( new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { // activate last focused element if user clicked on part header if (lastFocused != null) { lastFocused.setFocus(true); } } }, MouseUpEvent.getType()); container.addNorth(toolBar, 23); // this hack used for adding box shadow effect to toolbar toolBar.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.VISIBLE); toolbarHeader = new DockLayoutPanel(Style.Unit.PX); toolbarHeader.getElement().setAttribute("role", "toolbar-header"); toolBar.addNorth(toolbarHeader, 22); titleLabel = new Label(); titleLabel.setStyleName(resources.partStackCss().ideBasePartTitleLabel()); toolbarHeader.addWest(titleLabel, 200); SVGImage minimize = new SVGImage(resources.collapseExpandIcon()); minimize.getElement().setAttribute("name", "workBenchIconMinimize"); minimizeButton = new ToolButton(minimize); minimizeButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { minimize(); } }); addToolButton(minimizeButton); if (minimizeButton.getElement() instanceof elemental.dom.Element) { Tooltip.create( (elemental.dom.Element) minimizeButton.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, "Hide"); } }
private ToolButton createButton(DrawingTool tool, String image, JPanel propertiesPanel) { ToolButton button = new ToolButton( new ImageIcon( Toolkit.getDefaultToolkit().getImage(getClass().getResource("/" + image))), tool, propertiesPanel); button.addActionListener(buttonHandler); button.setPreferredSize(new Dimension(30, 30)); buttonList.add(button); return button; }
public void paletteUserOver(PaletteButton button, boolean inside) { if (inside) { showStatus(button.name()); } else if (fSelectedToolButton != null) { showStatus(fSelectedToolButton.name()); } }
private void setTool(ToolButton toolButtonToSet) { if (tool != null) { tool.onSelectAnotherTool(); } tool = toolButtonToSet.tool; toolPropertiesPanel.removeAll(); toolPropertiesPanel.revalidate(); toolPropertiesPanel.repaint(); toolPropertiesPanel.add(toolButtonToSet.propertiesPanel); toolPropertiesPanel.revalidate(); toolPropertiesPanel.repaint(); for (ToolButton button : buttonList) { button.setSelected(false); } toolButtonToSet.setSelected(true); toolPropertiesPanel.revalidate(); toolPropertiesPanel.repaint(); }
private void editMode(boolean enabled) { separator.setVisible(enabled); btnOk.setVisible(enabled); btnCancel.setVisible(enabled); lblChangedMsg.setVisible(enabled); }
public void toolDone() { setTool(fDefaultToolButton.tool(), fDefaultToolButton.name()); setSelected(fDefaultToolButton); }
public void paletteUserSelected(PaletteButton button) { ToolButton toolButton = (ToolButton) button; setTool(toolButton.tool(), toolButton.name()); setSelected(toolButton); }