@Override public void show() { super.show(); // Wizard size (having it resize between page changes is quite annoying) int width = 340; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(85); DeferredCommand.addCommand(new Command() { public void execute() { projectNameTextBox.setFocus(true); projectNameTextBox.selectAll(); } }); }
@Override public void show() { super.show(); // Wizard size (having it resize between page changes is quite annoying) int width = 320; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { projectNameTextBox.setFocus(true); projectNameTextBox.selectAll(); } }); }
@Override public void show() { super.show(); // Wizard size (having it resize between page changes is quite annoying) int width = 500; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { urlTextBox.setFocus(true); urlTextBox.selectAll(); } }); }
@Override public void show() { super.show(); int width = 320; int height = 40; this.center(); setPixelSize(width, height); super.setPagePanelHeight(40); DeferredCommand.addCommand(new Command() { public void execute() { renameTextBox.setFocus(true); } }); }
public static void it(String html) { try { buildFrame(html); if (USE_TIMER) { Timer timer = new Timer() { public void run() { printFrame(); } }; timer.schedule(TIMER_DELAY * 1000); } else { DeferredCommand.addCommand(new Command() { public void execute() { printFrame(); } }); } } catch (Throwable exc) { Window.alert(exc.getMessage()); } }
protected void initOptimalSize() { _scroll.setVisible(false); DeferredCommand.addCommand(new Command() { public void execute() { Element e = _panel.getCellFormatter().getElement(0, 0); int w = DOM.getElementPropertyInt(e, "offsetWidth"); int h = DOM.getElementPropertyInt(e, "offsetHeight"); GWT.log("Initial table size is " + w + "," + h, null); if(w == 0 || h == 0) { _scroll.setVisible(true); // Skip all this if it is used inside a TabPanel } else { w -= 2; if(w < 0) w = 0; h -= 2; if(h < 0) h = 0; _scroll.setSize("" + w + "px", "" + h + "px"); _scroll.setVisible(true); w = DOM.getElementPropertyInt(e, "offsetWidth"); h = DOM.getElementPropertyInt(e, "offsetHeight"); GWT.log("Now table size is " + w + "," + h, null); } } }); }
private void updateModel(final ContentPanel cp, final CIModel model) { DeferredCommand.addCommand(new Command() { public void execute() { localData = new CIModelCollection(); localData.addCIModel("offspring", model); baseData = localData.copy(); redraw(); /* cp.remove(currentGrid); currentGrid = new CIPropertyGrid(gridModelConfig, localData); currentGrid.setPermissions(permissions); cp.add(currentGrid); cp.layout(); setHeader(getParent(), "Properties for " + model.getDisplayName()); */ } }); }
private void updateAsync(final boolean resolveNow) { if (_activeTask != null) _activeTask.cancel(); DeferredCommand.addCommand(new Command() { public void execute() { updateFeedback(); if (posFd.getInputType() == Name) { if (resolveNow) { triggerResolver(true); } else { triggerResolverWithWait(); } } } }); }
@Override public void onShow() { _showing= true; if (_plotDeck.getMPW()!=null) { _plotDeck.getMPW().setActive(true); AllPlots.getInstance().setSelectedMPW(_plotDeck.getMPW()); } if (_plotDeck.getMPW().isInit()) { _plotDeck.getMPW().getOps(new MiniPlotWidget.OpsAsync() { public void ops(PlotWidgetOps widgetOps) { final WebPlotView pv= widgetOps.getPlotView(); if (pv!=null && pv.size()>0 && pv.getPrimaryPlot()==null) { pv.setPrimaryPlot(pv.get(0)); } DeferredCommand.addCommand(new Command() { public void execute() { if (pv!=null) pv.notifyWidgetShowing(); } }); } }); } super.onShow(); }
private void changePanel(String list) { _columns.clear(); vp.remove(table); vp.remove(html); if (panel != null && vp.getWidgetIndex(panel) >= 0) { vp.remove(panel); } if (list.equalsIgnoreCase("short")) { buildPanel(true); } else { buildPanel(false); } DeferredCommand.addCommand(new Command() { public void execute() { onResize(); } }); }
@Override protected void onLoad() { super.onLoad(); getEventManager().fireEvent(new WebEvent(this, ON_LOAD)); DeferredCommand.addCommand(new Command(){ public void execute() { if (GwtUtil.isOnDisplay(Component.this)) { if (isInit()) { onShow(); } else { // due to async init, this init() could return false. // in that case, add a listener to execute this request once it is initialized. eventManager.addListener(ON_INIT, new WebEventListener(){ public void eventNotify(WebEvent ev) { eventManager.removeListener(ON_INIT, this); onShow(); } }); } } } }); }
public static void maskAndExecute(String msg, Widget widget, MaskPane.MaskHint hint, final Runnable runnable) { final MaskPane mp = mask(msg, widget, hint); mp.show(); DeferredCommand.addCommand(new Command() { public void execute() { try { runnable.run(); } finally { mp.hide(); } } }); }
public void setVisible(boolean visible, PopupPane.Align alignAt, int xOffset, int yOffset) { if (_firstTime && visible) deferredBuild(); setContainerVisible(visible, alignAt, xOffset, yOffset); if ( visible) { final boolean first= _firstTime; DeferredCommand.addCommand(new Command() { public void execute() { if (first) { onFirstVisible(); if (_theWidget instanceof RequiresResize && !_sizeSet) { int maxW= Math.max(_theWidget.getOffsetHeight(),_buttons.getOffsetHeight()); setDefaultContentSize(maxW, _theWidget.getOffsetHeight()+_buttons.getOffsetHeight()); } } onVisible(); } }); _firstTime= false; } }
public void supportTabs() { if (!_supportTabs) { _supportTabs= true; WebEventManager.getAppEvManager().addListener(Name.CATALOG_SEARCH_IN_PROCESS,new WebEventListener() { public void eventNotify(WebEvent ev) { _tabPane = new TabPane(); _tabPane.setSize("100%", "100%"); _tabPane.setTabPaneName("ExpandTabView"); _tabPane.addTab(_expandRoot, "Plot", "Fits Viewer", false, true); new NewTableEventHandler(FFToolEnv.getHub(), _tabPane); WebEventManager.getAppEvManager().removeListener(Name.CATALOG_SEARCH_IN_PROCESS,this); if (_expanded) _expandPopout.show(); DeferredCommand.addCommand(new Command() { public void execute() { _tabPane.forceLayout(); } }); } }); } }
@Override protected void onDataTableRendered() { if (getPageSize() > 200) { // large page size: do fast rendering if (!fillWidthPending && isAttached() && getResizePolicy() == ResizePolicy.FILL_WIDTH) { fillWidthPending = true; DeferredCommand.addCommand(new Command() { public void execute() { fillWidthPending = false; fillWidth(); } }); } resizeTablesVertically(); fireEvent(new PageLoadEvent(getCurrentPage())); } else { super.onDataTableRendered(); } }
@Override public void onInit() { super.onInit(); getTable().setResizePolicy(AbstractScrollTable.ResizePolicy.FILL_WIDTH); getTable().addStyleName("singleColumn"); if (BrowserUtil.isBrowser(Browser.IE)) { WebEventManager.getAppEvManager().addListener(Name.WINDOW_RESIZE, new WebEventListener(){ public void eventNotify(WebEvent ev) { getTable().getDataTable().setColumnWidth(0, getTable().getDataTable().getOffsetWidth()-30); } }); DeferredCommand.addCommand(new Command(){ public void execute() { getTable().getDataTable().setColumnWidth(0, getTable().getDataTable().getOffsetWidth()-30); } }); } }
public void bind(FormHub formHub) { this.formHub = formHub; if (formHub != null) { formHub.getEventManager().addListener(FormHub.FIELD_VALUE_CHANGE, new WebEventListener() { public void eventNotify(WebEvent ev) { Param p = (Param) ev.getData(); if (p.getName().equalsIgnoreCase(fieldLink)) { fieldValue = p.getValue(); } setDefaultValues(); } }); DeferredCommand.addCommand(new Command() { public void execute() { fieldValue = getFormHub().getValue(fieldLink); } }); } }
public static void wcsSyncToLevel(final float primaryZoomLevel, boolean all, boolean northUp) { final AllPlots allPlots= AllPlots.getInstance(); List<MiniPlotWidget> list= allPlots.getActiveGroupList(false); MiniPlotWidget selectedMPW= allPlots.getMiniPlotWidget(); WebPlot selectedPlot= selectedMPW.getCurrentPlot(); // determine the target zoom level and what the arcsec / pix it will be at that level float targetASpix= getArcSecPerPix(selectedPlot, primaryZoomLevel); for(MiniPlotWidget mpwItem : list) { if (all || selectedMPW==mpwItem) { wcsSyncToAS(selectedMPW, mpwItem, targetASpix, northUp); } } DeferredCommand.addCommand(new Command() { public void execute() { allPlots.fireAllPlotTasksCompleted(); } }); }
public static void wcsSyncToMatch(final MiniPlotWidget mpwPrim, final MiniPlotWidget mpw, final boolean northUp) { WebPlot matchPlot= mpwPrim.getCurrentPlot(); final WebPlot plot= mpw.getCurrentPlot(); final float targetASpix= getArcSecPerPix(matchPlot, matchPlot.getZoomFact()); float targetZoomLevel= getZoomLevelForScale(plot, targetASpix); final float newZoomLevel= (Math.abs(targetZoomLevel-plot.getZoomFact())<.01) ? plot.getZoomFact() : targetZoomLevel; if (targetASpix!=0F) { DeferredCommand.addCommand(new Command() { public void execute() { if (mpw.isInit()) { // we want each plot to have the same arcsec / pixel as the target level // if the new level is only slightly different then use the target level determineHowToMatch(newZoomLevel,mpwPrim,mpw,northUp); } else { mpw.addRequestMod(WebPlotRequest.ZOOM_TYPE, ZoomType.ARCSEC_PER_SCREEN_PIX.toString()); mpw.addRequestMod(WebPlotRequest.ZOOM_ARCSEC_PER_SCREEN_PIX, targetASpix+""); } } }); } }
private void plotInternal(final WebPlotRequest request, final boolean addToHistory, final boolean enableMods, final boolean plotExpanded, final boolean canCollapse, final AsyncCallback<WebPlot> notify) { _mpw.setDefaultPlotRequest(new DefaultRequestInfo(request)); _mpw.setStartingExpanded(plotExpanded); _mpw.setCanCollapse(canCollapse); if (plotExpanded) { Vis.init(_mpw,new Vis.InitComplete() { public void done() { DeferredCommand.addCommand(new Command() { public void execute() { doExpand(request, addToHistory, enableMods, notify); } }); } }); } else { _mpw.initAndPlot(request,null,null,false,addToHistory,enableMods, notify); } }
private void expand() { AllPlots ap = AllPlots.getInstance(); final MiniPlotWidget mpw = ap.getMiniPlotWidget(); ensureSelected(); DeferredCommand.addCommand(new Command() { public void execute() { mpw.toggleExpand(); _popup.hide(); mpw.getPlotView().addListener(Name.REPLOT, new WebEventListener<ReplotDetails>() { public void eventNotify(WebEvent<ReplotDetails> ev) { if (ev.getData().getReplotReason() == ReplotDetails.Reason.REPARENT) { mpw.getPlotView().getEventManager().removeListener(Name.REPLOT, this); _popup.show(); } } }); } }); }
void redrawAllAsync(final WebPlotView pv, Drawer drawer, boolean forceRebuild) { if (_dataConnect == null) { drawer.setData((List<DrawObj>) null); return; } List<DrawObj> data = _dataConnect.getData(forceRebuild, pv.getPrimaryPlot()); // if (data == null || data.size() == 0) { // drawer.setData((DrawObj)null); // } // else { final int scrollX = pv.getScrollX(); final int scrollY = pv.getScrollY(); drawer.setData(data); updateHighlightLayer(drawer, pv); DeferredCommand.addCommand(new Command() { public void execute() { pv.setScrollXY(scrollX, scrollY); } }); // } }
private void redrawHighlightChangeAsync(final WebPlotView pv, Drawer drawer) { if ((_dataConnect != null && _dataConnect.size() == 0) || (_dataConnect != null && !_dataConnect.getSupportsHighlight())) { return; } if (_dataConnect == null) return; final int scrollX = pv.getScrollX(); final int scrollY = pv.getScrollY(); updateHighlightLayer(drawer,pv); DeferredCommand.addCommand(new Command() { public void execute() { pv.setScrollXY(scrollX, scrollY); } }); }
private void handleHighlightChange() { if (_dataConnect.isActive()) { DeferredCommand.addCommand(new Command() { public void execute() { for (WebPlotView pv : _allPV.keySet()) { final WebPlotView tmpPV= pv; final Drawer drawer = _allPV.get(pv).getDrawer(); Vis.init(new Vis.InitComplete() { public void done() { redrawHighlightChangeAsync(tmpPV, drawer); } }); } } }); } }
private void handleAreaSelectChange() { if (_dataConnect.isActive()) { final int selected[] = getAndSaveSelectedArea(); if (selected.length>0) { // if (selectOwner==null) { // SelectAreaCmd cmd= (SelectAreaCmd)AllPlots.getInstance().getCommand(SelectAreaCmd.CommandName); // cmd.clearSelect(); // } // if (selectOwner==DrawingManager.this) selectOwner= null; } DeferredCommand.addCommand(new Command() { public void execute() { for (WebPlotView pv : _allPV.keySet()) { final Drawer drawer = _allPV.get(pv).getDrawer(); final WebPlotView tmpPV= pv; Vis.init(new Vis.InitComplete() { public void done() { redrawSelectAreaChangeAsync(tmpPV, drawer, selected); } }); } } }); } }
public void onPostPageInExpandedMode(PopoutWidget oldPopout, PopoutWidget newPopout, Dimension dim) { if (newPopout instanceof MiniPlotWidget) { final MiniPlotWidget mpwNew = (MiniPlotWidget) newPopout; mpwNew.getGroup().setLastPoppedOut(mpwNew); AllPlots.getInstance().setSelectedMPW(mpwNew, true); DeferredCommand.addCommand(new Command() { public void execute() { if (AllPlots.getInstance().isWCSMatch()) { mpwNew.getPlotView().smartCenter(); } else { mpwNew.getPlotView().centerOnPoint(_pagingCenter); } } }); } else { AllPlots.getInstance().setSelectedMPW(null, true); newPopout.widgetResized(dim.getWidth(), dim.getHeight()); } }
private void setInlineTitleVisible(boolean v) { if (v==inlineTitleVisible) return; inlineTitleVisible= v; if (v) { setWidgetTopHeight(_inlineTitle, 0, Style.Unit.PX, INLINE_TITLE_HEIGHT, Style.Unit.PX); setWidgetLeftRight(_inlineTitle, 0, Style.Unit.PX, 40, Style.Unit.PX); if (_inlineTitle.getElement().getParentElement()!=null) { _inlineTitle.getElement().getParentElement().getStyle().setProperty("pointerEvents", "none"); } } else { setWidgetTopHeight(_inlineTitle,0, Style.Unit.PX,0, Style.Unit.PX); } DeferredCommand.addCommand(new Command() { public void execute() { forceLayout(); } }); }
@Override public void show() { if( isChatMode() ) { return; } m_text.setText( "" ); m_isChatMode = true; // center call show method // center(); DeferredCommand.addCommand( new Command() { public void execute() { m_text.setFocus( true ); } } ); super.show(); }
public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONCLICK: if (items != null && items.length > 0) { Element target = DOM.eventGetTarget(event); for (int i = 0; i < items.length; i++) { if (items[i].getElement()!=null){ // if (DOM.compare(target, items[i].getElement())) { if (target.getId()!=null && target.getId().equals(items[i].getElement().getId())) { Command command = items[i].getCommand(); if (command != null) { DeferredCommand.addCommand(command); } } } } DOM.eventPreventDefault(event); return; } } super.onBrowserEvent(event); }
public void testCanPassTestVectorsWhenUpdatingRangeOfBytes() throws GeneralSecurityException { Security.addProvider(CryptoGwtProvider.INSTANCE); DeferredCommand.addCommand(new DigestTestRunner( "testCanPassTestVectorsWhenUpdatingRangeOfBytes", new DigestStrategy() { public byte[] digest(MessageDigest md, byte[] input) throws DigestException { for (int i=0; i < input.length; i += 4) { if (i + 4 > input.length) { md.update(input, i, input.length-i); } else { md.update(input, i, 4); } } return md.digest(); } })); delayTestFinish(10000); }
public void startTesting(final boolean validateText,final boolean validateMap,final boolean deploy, final ExportBookCallback callback) { startProgress(); DeferredCommand.addCommand(new Command() { public void execute() { try { validate(validateText,validateMap,false,deploy); } catch (TimeoutException e) { //we cannot be here in client side } stopProgress(); if (errorCount==0) { callback.onSuccess(null); } else { callback.onError(); } } }); }
public void perform(RemoteRequest request) { if (timeoutChecher != null) { timeoutChecher.cancel(); } listener.beforeRequest(); currentRequest = request; if (request.getUrl() == null) { if (urlMapping.containsKey(request.getFunction())) { request.setUrl(urlMapping.get(request.getFunction())); } else { request.setUrl(serverUrl+request.getFunction()); } } frame.setUrl(PROCESS); new Timer() { public void run() { //wait for our local page is loaded String name = getFrameWindowName(frame.getElement()); if (name.length()>0) { cancel(); DeferredCommand.addCommand(perfomCommand); } } }.scheduleRepeating(300); }
private void updateConnectionsOfWidget(final MapWidget mapWidget) { DeferredCommand.addCommand(new Command(){ public void execute() { ArrayList<MapConnector> list = connections.get(mapWidget); if (list != null && list.size()>0) { //update all connections for (int i = 0; i < list.size(); i++) { MapConnector connector = list.get(i); connector.update(); } } int x = getPositionX(mapWidget); int y = getPositionY(mapWidget); if (x>0 || y>0) { mapWidget.updatePosition(x,y); } } }); }
public void onBlur(final BlurEvent event) { final String interval = getText(); if (!interval.matches(regexp)) { // Steal the dateBoxFormatError :) addStyleName("dateBoxFormatError"); event.stopPropagation(); DeferredCommand.addCommand(new Command() { public void execute() { // TODO(tsuna): Understand why this doesn't work as expected, even // though we cancel the onBlur event and we put the focus afterwards // using a deferred command. //setFocus(true); selectAll(); } }); } else { removeStyleName("dateBoxFormatError"); } }
public VoicesMovieWidget(String id) { super(id, GWT_VOICES_SWF); installFlashCallbackHooks(); // Flash Player version check for ExternalInterface support if (isExternalInterfaceSupported()) { flashSupport = MIME_TYPE_SUPPORT_NOT_READY; } else { flashSupport = MIME_TYPE_NOT_SUPPORTED; DeferredCommand.addCommand(new Command() { public void execute() { movieUnsupported(); } }); } }
protected void setDayIncluded(int day, boolean included) { if (daysFilter[day] == included) { // No change. // return; } daysFilter[day] = included; if (pendingRefresh == null) { pendingRefresh = new Command() { public void execute() { pendingRefresh = null; dynaTable.refresh(); } }; DeferredCommand.addCommand(pendingRefresh); } }
protected final void doSubmit() { boolean enabled = getBooleanValue("enabled"); spellChecking.setEnabled(enabled); if (!enabled) { hide(); doSubmit(spellChecking); return; } spellChecking.setDictionary(getStringValue("dictionary")); spellChecking.setCount(getIntValue("count")); spellChecking.setCollate(getBooleanValue("collate")); spellChecking.setOnlyMorePopular(getBooleanValue("popular")); hide(new AnimationCallbackAdapter() { public void onAnimationComplete() { DeferredCommand.addCommand(new Command() { public void execute() { doSubmit(spellChecking); } }); } }); }
protected final void doSubmit() { boolean enabled = getBooleanValue("enabled"); highlighting.setEnabled(enabled); if (!enabled) { hide(); doSubmit(highlighting); return; } highlighting.setFields(getStringValue("fields")); highlighting.setHighlightMultiTerm(getBooleanValue("multiTerm")); highlighting.setWrappingPrefix(getStringValue("prefix")); highlighting.setWrappingSuffix(getStringValue("suffix")); hide(new AnimationCallbackAdapter() { public void onAnimationComplete() { DeferredCommand.addCommand(new Command() { public void execute() { doSubmit(highlighting); } }); } }); }