Java 类com.google.gwt.user.client.ui.RootPanel 实例源码

项目:sig-seguimiento-vehiculos    文件:PreviewWidget.java   
private Frame createFrame() {
    final Frame frame = new Frame(DEFAULT_TEMPLATE_PATH);
    frame.getElement().setId(DEFAULT_FRAME_NAME);
    frame.setTitle(UIMessages.INSTANCE.previewTitle());
    frame.setWidth("500px");
    frame.setHeight("500px");
    frame.getElement().getStyle().setBackgroundColor("gray");

    frame.setVisible(true);
    RootPanel.get().add(frame);

    frame.addLoadHandler(new LoadHandler() {

        @Override
        public void onLoad(LoadEvent event) {
            frame.getElement().getStyle().setBackgroundColor("white");
            zoomPageComboBox.setValue(75);
        }

    });

    return frame;
}
项目:empiria.player    文件:VideoFullScreenHelper.java   
protected void openFullscreenIE(MediaWrapper<?> mediaWrapper, Element template) {
    if (mediaWrapper != null && template != null) {
        clearFullScreenView();
        lastMediaWrapper = mediaWrapper;
        VideoFullScreenView parent = getFullScreenView();
        Widget widget = mediaWrapper.getMediaObject();
        parent.getContainer().add(widget);
        resizeToFullScreen(parent.asWidget(), Position.FIXED);
        resizeToFullScreen(widget, Position.ABSOLUTE);
        parseTemplate(mediaWrapper, template, parent.getControls());
        fireEvent(true, mediaWrapper);
        RootPanel.get().add(parent);
        resizeToFullScreen(lastMediaWrapper.getMediaObject(), Position.FIXED);
        resizeToFullScreen(view.asWidget(), Position.FIXED);
        resizeToFullScreen(widget, Position.ABSOLUTE);
    }
}
项目:empiria.player    文件:MultiPageController.java   
private void configureSwipe() {
    if (isSwipeDisabled()) {
        for (HandlerRegistration registration : touchHandlers) {
            registration.removeHandler();
        }
        touchHandlers.clear();
        setVisiblePageCount(1);
    } else {
        RootPanel rootPanel = rootPanelDelegate.getRootPanel();
        HasTouchHandlers touchHandler = touchRecognitionFactory.getTouchRecognition(rootPanel, false);
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_START)));
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_MOVE)));
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_END)));
        setVisiblePageCount(3);
    }
    panelsCache.setSwipeType(swipeType.get());
}
项目:gwt-rxjs-jsinterop    文件:OnPageTest.java   
@Override
public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get("main");
    final Button button = new Button("Click me");
    rootPanel.add(button);

    ObservableEx.fromKeyboardEvent(button.getElement(), "keydown")
            .map(event -> event.ctrlKey)
            .take(5)
            .subscribe(v -> log("ctrlKey " + v));

    ObservableEx.fromMouseEvent(button.getElement(), "click")
            .map(event -> event.clientX)
            .take(5)
            .subscribe(v -> log("clientX " + v));        
}
项目:errai-spring-boot-sample    文件:App.java   
@AfterInitialization
public void afterInitialization() {
    authenticationServiceCaller.call(new RemoteCallback<User>() {
        @Override
        public void callback(User user) {
            Label userLabel = new Label(
                    "User logged in: username=" + user.getIdentifier() + ", roles=" + user.getRoles());
            RootPanel.get().add(userLabel);
            SimplePanel panel = new SimplePanel();
            Anchor logoutLink = new Anchor("Spring Security Logout URL", GWT.getHostPageBaseURL() + "logout");
            panel.add(logoutLink);
            RootPanel.get().add(panel);
            initBtns();
        }
    }).getUser();
}
项目:unitimes    文件:TeachingRequestDetailPage.java   
public void showRequestDetail(Long id) {
    iAssignmentTable.clearTable(1);
    LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail());
    ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px");
    RPC.execute(new TeachingRequestDetailRequest(id), new AsyncCallback<TeachingRequestInfo>() {
        @Override
        public void onFailure(Throwable caught) {
            LoadingWidget.getInstance().hide();
            UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught);
            ToolBox.checkAccess(caught);
        }

        @Override
        public void onSuccess(TeachingRequestInfo result) {
            LoadingWidget.getInstance().hide();
            populate(result, null, null);
            GwtHint.hideHint();
            center();
            RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
        }
    });
}
项目:unitimes    文件:TeachingRequestDetailPage.java   
public void showInstructorDetail(Long id) {
    iAssignmentTable.clearTable(1);
    LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail());
    ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px");
    RPC.execute(new TeachingAssignmentsDetailRequest(id), new AsyncCallback<InstructorInfo>() {
        @Override
        public void onFailure(Throwable caught) {
            LoadingWidget.getInstance().hide();
            UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught);
            ToolBox.checkAccess(caught);
        }

        @Override
        public void onSuccess(InstructorInfo result) {
            LoadingWidget.getInstance().hide();
            populate(null, null, result);
            GwtHint.hideHint();
            center();
            RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
        }
    });
}
项目:unitimes    文件:AriaStatus.java   
public static AriaStatus getInstance() {
    if (sStatus == null) {
        RootPanel statusPanel = RootPanel.get("UniTimeGWT:AriaStatus");
        if (statusPanel != null && "1".equals(Window.Location.getParameter("aria"))) {
            sStatus = new AriaStatus(statusPanel.getElement(), false);
            sStatus.setStyleName("unitime-VisibleAriaStatus");
        } else {
            sStatus  = new AriaStatus(false);
            RootPanel.get().add(sStatus);
        }

        RootPanel.get().addDomHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent event) {
                if (event.getNativeEvent().getKeyCode() == 191 && (event.isControlKeyDown() || event.isAltKeyDown())) {
                    sStatus.setHTML(sStatus.getHTML());
                }
            }
        }, KeyUpEvent.getType());
    }
    return sStatus;
}
项目:unitimes    文件:Client.java   
public void initPageAsync(final String page) {
    GWT.runAsync(new RunAsyncCallback() {
        public void onSuccess() {
            init(page);
            LoadingWidget.getInstance().hide();
        }
        public void onFailure(Throwable reason) {
            Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
            error.setStyleName("unitime-ErrorMessage");
            RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
            if (loading != null) loading.setVisible(false);
            RootPanel.get("UniTimeGWT:Body").add(error);
            LoadingWidget.getInstance().hide();
            UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
        }
    });
}
项目:unitimes    文件:RoomSharingWidget.java   
public void insert(final RootPanel panel, boolean eventAvailability) {
    Long locationId = Long.valueOf(panel.getElement().getInnerHTML().trim());
    RPC.execute(RoomInterface.RoomSharingRequest.load(locationId, eventAvailability), new AsyncCallback<RoomSharingModel>() {
        @Override
        public void onFailure(Throwable caught) {
            UniTimeNotifications.error(MESSAGES.failedToLoadRoomAvailability(caught.getMessage()));
        }

        @Override
        public void onSuccess(RoomSharingModel result) {
            panel.getElement().setInnerText(null);
            setModel(result);
            panel.add(RoomSharingWidget.this);
            panel.setVisible(true);
        }
    });
}
项目:unitimes    文件:PeriodPreferencesWidget.java   
public void insert(final RootPanel panel, Long eventAvailability) {
    String[] ids = panel.getElement().getInnerHTML().trim().split(":");
    Long locationId = Long.valueOf(ids[0]);
    Long examTypeId = Long.valueOf(ids[1]);
    RPC.execute(RoomInterface.PeriodPreferenceRequest.load(locationId, examTypeId), new AsyncCallback<PeriodPreferenceModel>() {
        @Override
        public void onFailure(Throwable caught) {
            UniTimeNotifications.error(MESSAGES.failedToLoadPeriodPreferences(caught.getMessage()));
        }

        @Override
        public void onSuccess(PeriodPreferenceModel result) {
            panel.getElement().setInnerText(null);
            setModel(result);
            panel.add(PeriodPreferencesWidget.this);
            panel.setVisible(true);
        }
    });
}
项目:unitimes    文件:SolverAllocatedMemory.java   
public void insert(final RootPanel panel) {
    String id = panel.getElement().getInnerText();
    panel.getElement().setInnerText(null);
    panel.add(this);
    panel.setVisible(true);
    RPC.execute(new SolverAllocatedMemoryRpcRequest(id), new AsyncCallback<SolverAllocatedMemoryRpcResponse>() {
        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(SolverAllocatedMemoryRpcResponse result) {
            setWidget(new Label(result.getValue()));
        }
    });
}
项目:unitimes    文件:LoadingWidget.java   
public void show(String message, int warningDelayInMillis) {
    if (iCount == 0) {
        RootPanel.get().add(this, Window.getScrollLeft(), Window.getScrollTop());
        RootPanel.get().add(iImage, Window.getScrollLeft() + Window.getClientWidth() / 2, Window.getScrollTop() + Window.getClientHeight() / 2);
        iWarningTimer.schedule(warningDelayInMillis);
    }
    if (message != null) {
        boolean showing = (iCount > 0 && !iMessage.getText().isEmpty());
        iMessage.setHTML(message);
        if (!showing && !iMessage.getText().isEmpty()) {
            RootPanel.get().add(iMessage, Window.getScrollLeft() + Window.getClientWidth() / 2 - 225, Window.getScrollTop() + Window.getClientHeight() / 3);
        } else if (showing && iMessage.getText().isEmpty()) {
            RootPanel.get().remove(iMessage);
        }
        AriaStatus.getInstance().setText(message.replace("...", "."));
    }
    iCount ++;
}
项目:unitimes    文件:CourseNumbersSuggestBox.java   
public static AriaSuggestBox insert(RootPanel panel) {
    String config = panel.getElement().getAttribute("configuration");
    final String onchange = panel.getElement().getAttribute("onchange");
    AriaTextBox text = new AriaTextBox(panel.getElement().getFirstChildElement());
    text.getElement().setAttribute("autocomplete", "off");
    AriaSuggestBox box = new AriaSuggestBox(text, new CourseNumbersSuggestBox(config));
    if (onchange != null)
        box.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                ToolBox.eval(onchange);
            }
        });
    panel.add(box);
    return box;
}
项目:unitimes    文件:ApproveDialog.java   
public void show(List<EventMeetingRow> meetings, ApproveEventRpcRequest.Operation operation) {
    iTable.setValue(meetings);
    switch (operation) {
    case APPROVE: setText(MESSAGES.dialogApprove()); break;
    case REJECT: setText(MESSAGES.dialogReject()); break;
    case INQUIRE: setText(MESSAGES.dialogInquire()); break;
    case CANCEL: setText(MESSAGES.dialogCancel()); break;
    }
    iFooter.setEnabled("approve", operation == ApproveEventRpcRequest.Operation.APPROVE);
    iFooter.setEnabled("reject", operation == ApproveEventRpcRequest.Operation.REJECT);
    iFooter.setEnabled("inquire", operation == ApproveEventRpcRequest.Operation.INQUIRE);
    iFooter.setEnabled("cancel", operation == ApproveEventRpcRequest.Operation.CANCEL);
    iFileUpload.check();
    center();
    if (iStandardNotes.getItemCount() == 0)
        iNotes.setFocus(true);
    else
        iStandardNotes.setFocus(true);
    RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
}
项目:unitimes    文件:AddMeetingsDialog.java   
public void showDialog(Long eventId, List<MeetingConflictInterface> conflicts) {
    iStep = Math.max(1, (Window.getClientWidth() - 100) / 105);
    ToolBox.setMaxHeight(iScrollRooms.getElement().getStyle(), (Window.getClientHeight() - 100) + "px");
    ToolBox.setMaxHeight(iScrollDates.getElement().getStyle(), (Window.getClientHeight() - 100) + "px");
    int nrMonths = Math.max(1, Math.min(5, (Window.getClientWidth() - 100) / 225));
    iDates.setWidth((225 * nrMonths) + "px");
    iConflicts = conflicts;

    iResponse = null;
    iEventId = eventId;
    setWidget(iDatesForm);

    center();
    RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
    iDates.setFocus(true);
}
项目:unitimes    文件:StudentScheduleTable.java   
public void insert(final RootPanel panel) {
    String studentId = panel.getElement().getInnerText().trim();
    panel.getElement().setInnerText(null);
    panel.add(this);
    sSectioningService.lookupStudent(iOnline, studentId, new AsyncCallback<ClassAssignmentInterface.Student>() {
        @Override
        public void onSuccess(Student result) {
            if (result != null) {
                panel.setVisible(true);
                setStudent(result);
                if (SectioningCookie.getInstance().getEnrollmentCoursesDetails()) {
                    refresh();
                } else {
                    clear();
                    iHeader.clearMessage();
                    iHeader.setCollapsible(false);
                }
            }
        }
        @Override
        public void onFailure(Throwable caught) {}
    });
}
项目:unitimes    文件:UniTimeMenuBar.java   
private void attach(final RootPanel rootPanel) {
    RPC.execute(new MenuInterface.MenuRpcRequest(), new AsyncCallback<GwtRpcResponseList<MenuInterface>>() {
        @Override
        public void onSuccess(GwtRpcResponseList<MenuInterface> result) {
            initMenu(iMenu, result, 0);
            if (iSimple != null)
                rootPanel.add(iSimple);
            rootPanel.add(UniTimeMenuBar.this);
            if (iSimple != null)
                iSimple.setHeight(iMenu.getOffsetHeight() + "px");
        }
        @Override
        public void onFailure(Throwable caught) {
        }
    });
}
项目:unitimes    文件:ReservationTable.java   
public void insert(final RootPanel panel) {
    initCallbacks();
    iOfferingId = Long.valueOf(panel.getElement().getInnerText());
    if (ReservationCookie.getInstance().getReservationCoursesDetails()) {
        refresh();
    } else {
        clear(false);
        iHeader.clearMessage();
        iHeader.setCollapsible(false);
    }
    panel.getElement().setInnerText(null);
    panel.add(this);
    panel.setVisible(true);
    addReservationClickHandler(new ReservationClickHandler() {
        @Override
        public void onClick(ReservationClickedEvent evt) {
            ToolBox.open(GWT.getHostPageBaseURL() + "gwt.jsp?page=reservation&id=" + evt.getReservation().getId() + "&reservations=" + getReservationIds());
        }
    });
}
项目:sig-seguimiento-vehiculos    文件:LinksWidget.java   
private TextButton createLegendAnchor() {
    TextButton legendButton = new TextButton();
    legendButton.setIcon(ImageProvider.INSTANCE.mapLegend24());
    legendButton.setTitle(UIMessages.INSTANCE.mapLegendTitle());
    legendButton.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
            if (mapLegend != null && mapLegend.isVisible()) {
                mapLegend.getElement().<FxElement> cast().fadeToggle();
                RootPanel.get().remove(mapLegend);
            } else {
                mapLegend = new SimpleMapVerticalLegend(layerManager);
                RootPanel.get().add(mapLegend);
                mapLegend.getElement().<FxElement> cast().fadeToggle();
                mapLegend.setVisible(true);
            }
        }
    });
    return legendButton;
}
项目:sig-seguimiento-vehiculos    文件:ChangeStyleTool.java   
private void applyLengendVisibility(VectorLayer selectedLayer) {
    VectorStyleDef currentStyle = selectedLayer.getVectorStyle();

    if (currentStyle.isEnableLegend()) {
        if (legendPanel != null) {
            RootPanel.get().remove(legendPanel);                
        }

        legendPanel = new SimpleThemingVerticalLegend(selectedLayer,
                currentStyle.getColorThemingAttribute().getName());

        RootPanel.get().add(legendPanel);
        legendPanel.getElement().<FxElement> cast().fadeToggle();
        legendPanel.setVisible(true);
    } else {            
        hideLegendPanel();
    }
}
项目:sig-seguimiento-vehiculos    文件:App.java   
@PostConstruct
public void buildUI() {

    OpenLayers.setProxyHost("gwtOpenLayersProxy?targetURL=");
    RootLayoutPanel.get().add(geoMap.getMapWidget());
    RootPanel.get().add(actionBar);
    RootPanel.get().add(linksWidget);
    RootPanel.get().add(zoomStatusWidget);

    logger.info("Map initialize...");
    geoMapInitializer.initialize();
    rasterLayerInitializer.initialize();
    vectorLayerInitializer.initialize();
    widgetInitializer.initialize();
    eventListenerInitializer.initialize();

    showDisclaimer();

    RestClient.setJacksonMarshallingActive(true);
    RootPanel.get("splash").setVisible(false);
}
项目:WebConsole    文件:BrowserUtils.java   
public static int[] getSizeFromStyle(String style, boolean useText) {
    if (!probeElement.isAttached()) {
        RootPanel.get().add(probeElement);
    }

    if (useText) {
        probeElement.setHTML("M");
    } else {
        probeElement.setHTML("");
    }

    int[] values = new int[4];
    probeElement.getElement().addClassName(style);
    values[0] = probeElement.getElement().getOffsetWidth();
    values[1] = probeElement.getElement().getOffsetHeight();
    values[2] = probeElement.getElement().getClientWidth();
    values[3] = probeElement.getElement().getClientHeight();
    probeElement.getElement().removeClassName(style);
    return values;
}
项目:WebConsole    文件:ImageContainer.java   
private void onLoaded() {
    if (loadAttempted) return;

    nativeWidth = image.getWidth();
    nativeHeight = image.getHeight();
    exists = true;
    loadAttempted = true;
    if (!existCheckDone) {
        RootPanel.get().remove(image);
        existCheckDone = true;
    }
    for (ImageLoadedCallback loadedCallback : loadedCallbacks) {
        if (loadedCallback != null) {
            loadedCallback.onImageLoaded(this);
        }
    }
    loadedCallbacks.clear();
}
项目:LAS    文件:WindowBox.java   
@Override
protected void beginDragging(MouseDownEvent event) {
    int dm = -1;

    if (this.resizable && !this.minimized)
        dm = this.calcDragMode(event.getClientX(),event.getClientY());

    if (this.resizable && dm >= 0) {
        this.dragMode = dm;

        DOM.setCapture(getElement());

        this.dragX = event.getClientX();
        this.dragY = event.getClientY();

        updateCursor(dm,RootPanel.get().getElement());

    } else {
        super.beginDragging(event);
    }
}
项目:LAS    文件:WindowBox.java   
@Override
protected void endDragging(MouseUpEvent event) {
    if (this.dragMode >= 0 && this.resizable) {
        DOM.releaseCapture(getElement());

        this.dragX = event.getClientX() - this.dragX;
        this.dragY = event.getClientY() - this.dragY;

        this.dragMode = -1;
        this.updateCursor(this.dragMode);
        RootPanel.get().getElement().getStyle().setCursor(Cursor.AUTO);
    }
    else {
        super.endDragging(event);
    }
}
项目:gwt-material-table    文件:AbstractDataViewTest.java   
public void testAddCategoryBeforeAttached() throws Exception {
    // given
    T table = createTable();
    table.setUseCategories(true);
    AbstractDataView<Person> dataView = (AbstractDataView<Person>)table.getView();
    addSampleColumns(table);

    String categoryName = "Test Category";

    // when
    dataView.addCategory(categoryName);
    RootPanel.get().add(table);

    // then
    assertTrue(dataView.hasCategory(categoryName));

    CategoryComponent category = dataView.getCategory(categoryName);
    assertNotNull(category);
    assertTrue(category.isRendered());
    assertTrue(category.getWidget().isAttached());
}
项目:LAS    文件:ClimateAnalysis.java   
private void setBackground(int id) {
    for (int i = 0; i < panelIDs.length; i++) {
        RootPanel.get(panelIDs[i]).removeStyleName(highLightStyle);
        RootPanel.get(selectionIDs[i]).removeStyleName(selectionStyle);
    }
    if ( set.contains(0) && set.contains(1) && set.contains(2) && set.contains(3)) {
        RootPanel.get(panelIDs[4]).addStyleName(highLightStyle);
        RootPanel.get(selectionIDs[4]).addStyleName(selectionStyle);
    } else {
        if ( xSecondID.equals(xInitialId) ) {
            RootPanel.get("DatasetSelection").addStyleName(highLightStyle);
            RootPanel.get("DatasetWidget").addStyleName(selectionStyle);
        } else{ 
            if ( !set.contains(id) ) {
                RootPanel.get(panelIDs[id]).addStyleName(highLightStyle);
                RootPanel.get(selectionIDs[id]).addStyleName(selectionStyle);
            }
        }
    }
}
项目:gwt-material-table    文件:DataTableTestCase.java   
protected T attachTableWithOnLoad(boolean includeData) throws Exception {
    // given
    T table = createTable();

    table.addAttachHandler(event -> {
        // when
        try {
            addSampleColumns(table);
            if(includeData) {
                addSampleRows(table);
            }

        // then
        } catch (final AssertionError ae) {
            throw ae;
        } catch (final Throwable t) {
            throw new AssertionError("Could not load table in onLoad.", t);
        }
    });

    RootPanel.get().add(table);
    return table;
}
项目:LAS    文件:IESafeImage.java   
/**
 * Returns the original width when when using IE.
 * 
 * @see com.google.gwt.user.client.ui.Image#getWidth()
 */
@Override
public int getWidth() {
    int superWidth = super.getWidth();
    logger.log(Level.INFO, "superWidth:" + superWidth);
    logger.log(Level.INFO, "isAttached():" + isAttached());
    if ( (superWidth <= 0) ) {
        // If this is being run under IE the default answer may be 0 when it
        // shouldn't be, so return the height from a hidden and attached
        // temp image
        Image temp = new Image(this.getUrl());
        temp.getElement().getStyle().setVisibility(Visibility.HIDDEN);
        RootPanel.get().add(temp);
        logger.log(Level.WARNING, "temp.isAttached():" + temp.isAttached());
        int tempWidth = temp.getWidth();
        logger.log(Level.WARNING, "tempWidth:" + tempWidth);
        temp.removeFromParent();
        return tempWidth;
    }
    return superWidth;
}
项目:document-management-system    文件:Util.java   
/**
 * Download files exported as zip
 *
 * @author danilo
 */
@Deprecated
public static void downloadFiles(List<String> path, String params) {
    if (!params.equals("")) {
        params = "&" + params;
    }

    final Element downloadIframe = RootPanel.get("__download").getElement();
    String url = RPCService.DownloadServlet + "?export" + params;

    for (String p : path) {
        url += "&pathList=" + URL.encodeQueryString(p);
    }

    DOM.setElementAttribute(downloadIframe, "src", url);
}
项目:gwt-material-table    文件:AbstractDataViewTest.java   
public void testAddCategory() throws Exception {
    // given
    T table = createTable();
    table.setUseCategories(true);
    AbstractDataView<Person> dataView = (AbstractDataView<Person>)table.getView();
    addSampleColumns(table);

    RootPanel.get().add(table);
    String categoryName = "Test Category";

    // when
    assertFalse(dataView.hasCategory(categoryName));
    dataView.addCategory(categoryName);

    // then
    assertTrue(dataView.hasCategory(categoryName));

    CategoryComponent category = dataView.getCategory(categoryName);
    assertNotNull(category);
    assertTrue(category.isRendered());
    assertTrue(category.getWidget().isAttached());
}
项目:walkaround    文件:Walkaround.java   
/** Reveals the log div, and executes a task when done. */
// The async API for this method is intended to support two things: a cool
// spew animation, and also the potential to runAsync the whole LogPanel code.
private static void attachLogPanel() {
  Logs.get().addHandler(domLogger);
  final Panel logHolder = RootPanel.get("logHolder");
  logHolder.setVisible(true);

  // Need one layout and paint cycle after revealing it to start animation.
  // Use high priority to avoid potential starvation by other tasks if a
  // problem is occurring.
  SchedulerInstance.getHighPriorityTimer().scheduleDelayed(new Task() {
    @Override
    public void execute() {
      logHolder.add(domLogger);
      Style waveStyle = Document.get().getElementById(WAVEPANEL_PLACEHOLDER).getStyle();
      Style logStyle = logHolder.getElement().getStyle();
      logStyle.setHeight(250, Unit.PX);
      waveStyle.setBottom(250, Unit.PX);
    }
  }, 50);
}
项目:social-analytics    文件:SocialAnalytics.java   
@Override
public void onModuleLoad() {

    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    // Start ActivityManager for the twitter widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper= GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    RootPanel.get().add(appWidget);
    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();

}
项目:cuba    文件:CubaFileDownloaderConnector.java   
public void downloadFileById(String resourceId) {
    final String url = getResourceUrl(resourceId);
    if (url != null && !url.isEmpty()) {
        final IFrameElement iframe = Document.get().createIFrameElement();

        Style style = iframe.getStyle();
        style.setVisibility(Style.Visibility.HIDDEN);
        style.setHeight(0, Style.Unit.PX);
        style.setWidth(0, Style.Unit.PX);

        iframe.setFrameBorder(0);
        iframe.setTabIndex(-1);
        iframe.setSrc(url);
        RootPanel.getBodyElement().appendChild(iframe);

        Timer removeTimer = new Timer() {
            @Override
            public void run() {
                iframe.removeFromParent();
            }
        };
        removeTimer.schedule(60 * 1000);
    }
}
项目:gwt-uploader    文件:GwtUploaderDemo.java   
@Override
public void onModuleLoad() {
  uploaderPanels.put("TextButtonAndProgressText", new TextButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressText", new ImageButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressBar", new ImageButtonAndProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBar", new MultiUploadWithProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBarAndDragAndDrop",
                     new MultiUploadWithProgressBarAndDragAndDrop());

  for (Map.Entry<String, UploaderSample> entry : uploaderPanels.entrySet()) {
    final UploaderSample sample = entry.getValue();
    final Widget uploaderPanel = sample.getUploaderPanel();
    final Button btnViewSource = new Button("View Source");
    btnViewSource.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    btnViewSource.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        sourceCodePopup.showSourceCode(sample.getUploaderCode());
      }
    });
    VerticalPanel panel = new VerticalPanel();
    panel.add(uploaderPanel);
    panel.add(btnViewSource);
    RootPanel.get(entry.getKey()).add(panel);
  }
}
项目:Wiab.pro    文件:ErrorHandler.java   
@Override
public void onUncaughtException(Throwable e) {
  if (!hasFired) {
    hasFired = true;
    final ErrorIndicatorPresenter error =
        ErrorIndicatorPresenter.create(RootPanel.get("banner"));
    if (LogLevel.showErrors()) {
      getStackTraceAsync(e, new AsyncHolder.Accessor<SafeHtml>() {
        @Override
        public void use(SafeHtml stack) {
          error.addDetail(stack, null);
          REMOTE_LOG.severe(stack.asString().replace("<br>", "\n"));
        }
      });
    }
  }

  if (next != null) {
    next.onUncaughtException(e);
  }
}
项目:Wiab.pro    文件:WebClient.java   
private void setupVersionChecker() {
  versionChecker = new ClientVersionChecker(new ClientVersionChecker.Listener() {

    @Override
    public void onClientUpdated() {
      UpdateIndicatorWidget.create(RootPanel.get("banner"), new UpdateIndicatorWidget.Listener() {

        @Override
        public void refresh() {
          completeWave(new Command() {

            @Override
            public void execute() {
              Location.assign(GWT.getHostPageBaseURL());
            }
          });
        }
      });
    }
  }, LOG);
}
项目:Wiab.pro    文件:ImageThumbnailWidget.java   
private void cleanUp() {
  RootPanel.get().remove(doubleLoadedImage);

  final HandlerRegistration onLoadReg = onLoadHandlerRegistration;
  final HandlerRegistration onErrorReg = onErrorHandlerRegistration;

  // HACK(user): There is a bug in GWT which stops us from removing a listener in HOSTED
  // mode inside the invoke context.  Put the remove in a deferred command to avoid this
  // error
  ScheduleCommand.addCommand(new Scheduler.Task() {

    @Override
    public void execute() {
      onLoadReg.removeHandler();
      onErrorReg.removeHandler();
    }
  });

  onLoadHandlerRegistration = null;
  onErrorHandlerRegistration = null;

  completed = true;
}
项目:Wiab.pro    文件:SuggestionButton.java   
public SuggestionButton(final ContentElement element) {
  Widget clickButton =
      ButtonFactory.createIconClickButton(IconButtonStyle.LIGHTBULB, TOOLTIP,
      new ClickButtonListener() {
        @Override
        public void onClick() {
          HasSuggestions suggestion =
              element.getProperty(SuggestionRenderer.HAS_SUGGESTIONS_PROP);
          element.getSuggestionsManager().showSuggestionsFor(suggestion);
        }
      });
  clickButton.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
  // Logically attach it to the root panel to listen to events, but then
  // manually move the dom to the desired location.
  RootPanel.get().add(clickButton);
  this.element = clickButton.getElement();
  NodeManager.setTransparency(this.element, Skip.DEEP);
  DomHelper.makeUnselectable(this.element);
  this.element.setAttribute("contentEditable", "false");
}