public TextWord(PlatformContext context, WordPresenter presenter, FileModel fmodel) { super(context, presenter); this.model = fmodel; if (fmodel.isAdmin() || context.getUser().isSuper()) { add(getEditTab(), new TabItemConfig("编辑", false)); } else { add(getViewTab(), new TabItemConfig("查看", false)); } addBeforeSelectionHandler(new BeforeSelectionHandler<Widget>() { public void onBeforeSelection(BeforeSelectionEvent<Widget> event) { if (event.getItem() == getViewTab()) { if (editTab.getNewContent() != null) { getViewTab().refresh(editTab.getNewContent()); } else if (model.getContent() != null) { getViewTab().refresh(model.getContent()); } } else if (event.getItem() == getEditTab()) { getEditTab().getCodeMirror().refresh(); } } }); }
public void selectTab(int index, boolean fireEvents) { if (index < 0 || index >= _tabs.size()) { throw new AssertionError("Index out of bound."); } if (index == _selectedIndex) { return; } if (fireEvents) { BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } } _tabBar.selectTab(index); _contentPanel.setContent(_tabs.get(index).content()); _selectedIndex = index; if (fireEvents) { SelectionEvent.fire(this, index); } }
/** * @return this editor as a Widget. */ public Widget asWidget() { VerticalPanel panel = new VerticalPanel(); panel.add(new ContentGroupLabel(Singleton.MESSAGES.label_serviceDetails())); panel.add(new ContentDescription(Singleton.MESSAGES.description_serviceDetails())); panel.add(createImplementationDetailsPanel()); TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); //$NON-NLS-1$ tabs.getElement().setAttribute("style", "margin-top:15px;"); //$NON-NLS-1$ //$NON-NLS-2$ tabs.add(createGatewayDetailsPanel(), Singleton.MESSAGES.label_gateways()); tabs.add(createThrottlingDetailsPanel(), Singleton.MESSAGES.label_throttling()); tabs.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { @Override public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { _toolstrip.doCancel(); } }); panel.add(tabs); tabs.selectTab(0); return panel; }
public ShellWord(PlatformContext context,WordPresenter presenter,FileModel fmodel) { super(context ,presenter); this.model=fmodel; if(fmodel.isAdmin() || context.getUser().isSuper()){ add(getEditTab(), new TabItemConfig("编辑", false)); add(getHistoryTab(),new TabItemConfig("调试历史", false)); setActiveWidget(editTab); }else{ add(getViewTab(), new TabItemConfig("查看", false)); } addBeforeSelectionHandler(new BeforeSelectionHandler<Widget>() { public void onBeforeSelection( BeforeSelectionEvent<Widget> event) { if (event.getItem() == getViewTab()) { if(editTab.getNewContent()!=null){ getViewTab().refresh(editTab.getNewContent()); }else if (model.getContent() != null) { getViewTab().refresh(model.getContent()); } }else if(event.getItem()==getEditTab()){ getEditTab().getCodeMirror().refresh(); }else if(event.getItem() == getHistoryTab()){ getHistoryTab().refresh(); } } }); }
public HiveWord(PlatformContext context, WordPresenter presenter, FileModel fmodel) { super(context, presenter); this.model = fmodel; if (fmodel.isAdmin() || context.getUser().isSuper()) { add(getEditTab(), new TabItemConfig("编辑", false)); add(getHistoryTab(), new TabItemConfig("调试历史", false)); setActiveWidget(editTab); } else { add(getViewTab(), new TabItemConfig("查看", false)); } addBeforeSelectionHandler(new BeforeSelectionHandler<Widget>() { @Override public void onBeforeSelection(BeforeSelectionEvent<Widget> event) { if (event.getItem() == getViewTab()) { if (editTab.getNewContent() != null) { getViewTab().refresh(editTab.getNewContent()); } else if (model.getContent() != null) { getViewTab().refresh(model.getContent()); } } else if (event.getItem() == getEditTab()) { getEditTab().getCodeMirror().refresh(); } else if (event.getItem() == getHistoryTab()) { getHistoryTab().refresh(); } } }); }
protected void doSingleSelect(Node node, boolean suppressEvent) { int index; index = nodeStorage.indexOf(node); if (index == -1 || isSelected(node)) { return; } else { if (!suppressEvent) { BeforeSelectionEvent<Node> evt = BeforeSelectionEvent.fire(this, node); if (evt != null && evt.isCanceled()) { return; } } } boolean change = false; if (selectionStorage.size() > 0 && !isSelected(node)) { doDeselect(Collections.singletonList(lastSelectedNode), true); change = true; } if (selectionStorage.size() == 0) { change = true; } selectionStorage.add(node); lastSelectedNode = node; onSelectChange(node, true); setLastFocused(lastSelectedNode); if (!suppressEvent) { SelectionEvent.fire(this, node); } if (change && !suppressEvent) { fireSelectionChange(); } }
protected void doMultiSelect(List<Node> nodes, boolean keepExisting, boolean suppressEvent) { boolean change = false; if (!keepExisting && selectionStorage.size() > 0) { change = true; doDeselect(new ArrayList<>(selectionStorage), true); } for (Node node : nodes) { if (tree.getNodeDescriptor(node) == null) { continue; } boolean isSelected = isSelected(node); if (!suppressEvent && !isSelected) { BeforeSelectionEvent<Node> evt = BeforeSelectionEvent.fire(this, node); if (evt != null && evt.isCanceled()) { continue; } } change = true; lastSelectedNode = node; selectionStorage.add(node); setLastFocused(lastSelectedNode); if (!isSelected) { onSelectChange(node, true); if (!suppressEvent) { SelectionEvent.fire(this, node); } } } if (change && !suppressEvent) { fireSelectionChange(); } }
public void makeUI() { spacialOpsTabs.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { if (tabUpdateOn) updateSelectedTab(); } }); spacialOpsTabs.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> ev) { preSelectedTab(ev.getItem()); } }); makeSingle(); makeIbeSingle(); makeMulti(); makeIbeMulti(); makePolygon(); makeAllSky(); reinitTabPane(true, true, true, true, true, true); mainPanel.add(spacialOpsTabs); spacialOpsTabs.setSize("100%", "100%"); // mainPanel.setSize("700px", "245px"); mainPanel.setSize("600px", NORMAL_HEIGHT_REQUIRED+"px"); GwtUtil.setStyle(mainPanel,"paddingTop", PADDING_TOP+"px"); }
public PreferencePanel() { //populatePreferences(); String[] items = WebProp.getItems(PROP_BASE); groupPanels = new PrefGroupPanel[items.length]; int idx = 0; for (String s : items) { // construct tab String title = WebProp.getTitle(PROP_BASE+"."+s); groupPanels[idx] = new PrefGroupPanel(PROP_BASE+"."+s+".field"); tabs.addTab(groupPanels[idx], title); idx++; } panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.add(grid); panel.addStyleName("content-panel"); WebAppProperties wap = Application.getInstance().getProperties(); hasViewAll = wap.getBooleanProperty(PROP_BASE+".hasViewAll"); if (hasViewAll) { tabs.addTab(panel, "View All"); } // make sure preference view is in sync with the latest updates tabs.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> ev) { int tabIndex= ev.getItem(); if (hasViewAll && tabIndex == tabs.getWidgetCount()-1) { populatePreferences(); } lastTab = tabIndex; } }); tabs.setSize("99%", "99%"); tabs.selectTab(0); initWidget(tabs); }
public void onBeforeSelection(BeforeSelectionEvent<Integer> bse) { buttonClicked = true; TabBar tb = (TabBar) bse.getSource(); cSelIdx = tb.getSelectedTab(); int selIdx = bse.getItem(); TabHolder th = findTab(selIdx, tb); if (!th.button.isUseDropdown()) { th.button.activate(); bse.cancel(); } else { dropdown.clearHeaderBar(); } }
/** * Programmatically selects the specified tab. * * @param index the index of the tab to be selected * @param fireEvents true to fire events, false not to */ public void selectTab(int index, boolean fireEvents) { checkIndex(index); if (index == selectedIndex) { return; } // Fire the before selection event, giving the recipients a chance to // cancel the selection. if (fireEvents) { BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } } // Update the tabs being selected and unselected. if (selectedIndex != -1) { tabs.get(selectedIndex).setSelected(false); } deckPanel.showWidget(index); tabs.get(index).setSelected(true); selectedIndex = index; // Fire the selection event. if (fireEvents) { SelectionEvent.fire(this, index); } }
protected void onRender(Element parent, int index) { super.onRender(parent, index); topStatistics.setWidth("100%"); topStatistics.setHeight("30"); topDate.setHeight("30"); searchconditions.setWidth("100%"); add(topStatistics); add(getTopDate()); add(searchconditions); searchconditions.setHorizontalAlignment(searchconditions.ALIGN_CENTER); tabPanel.setWidth("100%"); tabPanel.setAnimationEnabled(true); tabPanel.add(orderReportPanel , "订单概况"); tabPanel.add(shippingReportPanel , "配送方式"); tabPanel.add(payReportPanel , "支付方式"); tabPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> sender) { int tabIndex = sender.getItem(); if(tabIndex == 0){ setOrderReportPanel(); }else if(tabIndex == 1){ setShippingReportPanel(); }else if(tabIndex == 2){ setPayReportPanel(); }else{ System.out.println("Error in tab select"); } } }); searchconditions.add(tabPanel); }
/** {@inheritDoc} */ @Override public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Node> handler) { return ensureHandlers().addHandler(BeforeSelectionEvent.getType(), handler); }
public void onBeforeSelection(BeforeSelectionEvent<Integer> ev) { int idx = tabPanel.getSelectedIndex(); if (idx >= 0) { prevTab = getVisibleTab(idx); } }
@Override public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }
@Override public HandlerRegistration addBeforeSelectionHandler(final BeforeSelectionHandler<PartDefinition> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }
public HandlerRegistration addBeforeSelectionHandler( BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }