List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:edu.ycp.cs.netcoder.client.CourseAndProblemView.java
License:Open Source License
private void doResize() { getLayoutPanel().setWidgetTopHeight(problemDescriptionWidget, LayoutConstants.TOP_BAR_HEIGHT_PX, Unit.PX, LayoutConstants.CP_PROBLEM_DESC_HEIGHT_PX, Unit.PX); int availHeight = Window.getClientHeight() - LayoutConstants.TOP_BAR_HEIGHT_PX - LayoutConstants.CP_STATUS_AND_BUTTON_BAR_HEIGHT_PX - LayoutConstants.CP_PROBLEM_DESC_HEIGHT_PX; if (courseTree != null) { getLayoutPanel().setWidgetLeftWidth(courseTree, 0, Unit.PX, LayoutConstants.CP_COURSE_TREE_WIDTH_PX, Unit.PX);/*from w ww. j av a 2s. c o m*/ getLayoutPanel().setWidgetTopHeight(courseTree, LayoutConstants.TOP_BAR_HEIGHT_PX + LayoutConstants.CP_PROBLEM_DESC_HEIGHT_PX, Unit.PX, availHeight, Unit.PX); } getLayoutPanel().setWidgetRightWidth(table, 0, Unit.PX, Window.getClientWidth() - LayoutConstants.CP_COURSE_TREE_WIDTH_PX - 8, Unit.PX); getLayoutPanel().setWidgetTopHeight(table, LayoutConstants.TOP_BAR_HEIGHT_PX + LayoutConstants.CP_PROBLEM_DESC_HEIGHT_PX, Unit.PX, availHeight, Unit.PX); getLayoutPanel().setWidgetBottomHeight(statusAndButtonBar, 0, Unit.PX, LayoutConstants.CP_STATUS_AND_BUTTON_BAR_HEIGHT_PX, Unit.PX); }
From source file:es.deusto.weblab.client.experiments.controlapp.ui.ControlAppExperiment.java
License:Open Source License
@Override public void start(final int time, String initialConfiguration) { final JSONObject value = JSONParser.parseStrict(initialConfiguration).isObject(); final String baseURL = value.get("url").isString().stringValue(); System.out.println("Control app URL=" + baseURL); final String width = this.configurationRetriever.getProperty(EXTERNAL_WIDTH, "" + Window.getClientWidth()); final String height = this.configurationRetriever.getProperty(EXTERNAL_HEIGHT, "" + Window.getClientHeight()); final long startTime = System.currentTimeMillis(); switch (getLinkPresentation()) { case iframe:/*from www. j a v a 2 s . c o m*/ final String iframeUrl = baseURL.replace("TIME_REMAINING", "" + time); final HTML html = new HTML("<iframe src='" + iframeUrl + "' width='" + width + "' height='" + height + "px' frameborder='0'/>"); putWidget(html); break; case popup: final VerticalPanel vp = new VerticalPanel(); final Button popupButton = new Button(i18n.remoteSystem()); popupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final long now = System.currentTimeMillis(); final long elapsed = now - startTime; final long nowTime = 1000 * time - elapsed; final String popupUrl = baseURL.replace("TIME_REMAINING", "" + (nowTime / 1000)); Window.open(popupUrl, "_blank", "resizable=yes,scrollbars=yes,dependent=yes,width=" + width + ",height=" + height + ",top=0"); } }); vp.add(popupButton); putWidget(vp); break; case redirection: String redirectionUrl = baseURL.replace("TIME_REMAINING", "" + time); this.boardController.disableFinishOnClose(); final Anchor anch = new Anchor(i18n.remoteSystem(), redirectionUrl); putWidget(anch); Location.replace(redirectionUrl); break; } }
From source file:es.deusto.weblab.client.lab.ui.themes.es.deusto.weblab.defaultweb.AllowedExperimentsWindow.java
License:Open Source License
private void loadExperimentsTable() { int INTENDED_COLUMNS = (80 * Window.getClientWidth() / 100) / 250; if (INTENDED_COLUMNS == 0) INTENDED_COLUMNS = 1;/*from w ww . j a v a 2 s. c om*/ final int COLUMNS = this.experimentsAllowed.size() > INTENDED_COLUMNS ? INTENDED_COLUMNS : this.experimentsAllowed.size(); this.experimentsTable.resize(this.experimentsAllowed.size() / COLUMNS + 1, COLUMNS); final List<String> categories = new Vector<String>(this.experimentsAllowed.keySet()); Collections.sort(categories); for (int i = 0; i < categories.size(); ++i) { final String category = categories.get(i); final List<ExperimentAllowed> categoryExperiments = new Vector<ExperimentAllowed>( this.experimentsAllowed.get(category).keySet()); Collections.sort(categoryExperiments); final Grid categoryGrid = new Grid(); categoryGrid.resize(categoryExperiments.size(), 2); categoryGrid.setWidth("100%"); for (int j = 0; j < categoryExperiments.size(); ++j) { final ExperimentAllowed experiment = categoryExperiments.get(j); ExperimentClickListener listener = new ExperimentClickListener(experiment); final Anchor nameLink = new Anchor(experiment.getExperiment().getName()); nameLink.addClickHandler(listener); IConfigurationRetriever retriever = this.experimentsAllowed.get(category).get(experiment); String picture = retriever.getProperty("experiment.picture", ""); if (picture.isEmpty()) picture = retriever.getProperty("experiments.default_picture", ""); if (picture.startsWith("/")) picture = GWT.getModuleBaseURL() + picture; final Image img = new Image(picture); img.setHeight("40px"); img.setStyleName("web-allowedexperiments-image"); img.addClickHandler(listener); categoryGrid.setWidget(j, 0, nameLink); categoryGrid.setWidget(j, 1, new SimplePanel(img)); categoryGrid.getCellFormatter().setHorizontalAlignment(j, 1, HasHorizontalAlignment.ALIGN_CENTER); } final DisclosurePanel categoryPanel = new DisclosurePanel(category); categoryPanel.add(categoryGrid); categoryPanel.setAnimationEnabled(true); categoryPanel.setOpen(true); categoryPanel.setWidth("250px"); categoryPanel.addStyleName("experiment-list-category-panel"); final SimplePanel decoratedCategoryPanel = new SimplePanel(categoryPanel); decoratedCategoryPanel.setWidth("250px"); decoratedCategoryPanel.addStyleName("experiment-list-category-container"); this.experimentsTable.setWidget(i / COLUMNS, i % COLUMNS, decoratedCategoryPanel); this.experimentsTable.getCellFormatter().setVerticalAlignment(i / COLUMNS, i % COLUMNS, HasVerticalAlignment.ALIGN_TOP); } }
From source file:fr.fg.client.core.ally.AllyDialog.java
License:Open Source License
public void onWindowResized(int width, int height) { int clientWidth = Window.getClientWidth(); highres = clientWidth > 1024;//from www . j av a 2s .c o m if (currentClientWidth > 1024 && clientWidth <= 1024) { viewsPane.setPixelWidth(550); messagesList.setPixelSize(550, (messagesList.getSelectedIndex() != -1 ? 70 : 280)); messageScrollPane.setPixelSize(550, 182); horizontalSeparator.setWidth("550px"); separator.setPixelWidth(310 - writeBt.getPixelWidth() - allReadBt.getPixelWidth()); descriptionScrollPane.setPixelSize(550, 280); productsScrollPane.setPixelSize(550, 280); settingsLayout.setPixelSize(550, 280); separator2.setPixelWidth(185); layout.update(); updateUI(); if (isVisible()) centerOnScreen(); } else if (currentClientWidth <= 1024 && clientWidth > 1024) { viewsPane.setPixelWidth(550 + HIGH_RES_EXTRA_WIDTH); messagesList.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, (messagesList.getSelectedIndex() != -1 ? 70 + (highres ? HIGH_RES_EXTRA_HEIGHT / 2 : 0) : 280 + (highres ? HIGH_RES_EXTRA_HEIGHT : 0))); messageScrollPane.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 182 + (highres ? HIGH_RES_EXTRA_HEIGHT / 2 : 0)); horizontalSeparator.setWidth((550 + HIGH_RES_EXTRA_WIDTH) + "px"); separator.setPixelWidth( 310 + HIGH_RES_EXTRA_WIDTH - writeBt.getPixelWidth() - allReadBt.getPixelWidth()); descriptionScrollPane.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 280 + HIGH_RES_EXTRA_HEIGHT); productsScrollPane.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 280 + HIGH_RES_EXTRA_HEIGHT); settingsLayout.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 280 + HIGH_RES_EXTRA_HEIGHT); separator2.setPixelWidth(185 + HIGH_RES_EXTRA_WIDTH / 2); layout.update(); updateUI(); if (isVisible()) centerOnScreen(); } currentClientWidth = clientWidth; }
From source file:fr.fg.client.core.AreaContainer.java
License:Open Source License
public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEWHEEL: if (currentArea == null) return; int wheelDelta = DOM.eventGetMouseWheelVelocityY(event); Point view = new Point(map.getView()); if (wheelDelta < 0) { if (map.getZoom() < 1) { view.addX((int) Math.floor(mouseX / (map.getZoom()))); view.addY((int) Math.floor(mouseY / (map.getZoom()))); map.setZoom(map.getZoom() * 2); map.centerView(view);/*from www . j a v a 2 s . co m*/ } } else if (wheelDelta > 0) { if (map.getZoom() > .125) { view.addX((int) (Window.getClientWidth() / (2 * map.getZoom()))); view.addY((int) (Window.getClientHeight() / (2 * map.getZoom()))); map.setZoom(map.getZoom() / 2); map.centerView(view); } else { Client.getInstance().getGalaxyMap().show(GalaxyMap.MODE_DEFAULT); } } DOM.eventPreventDefault(event); DOM.eventCancelBubble(event, true); break; } }
From source file:fr.fg.client.core.Chat.java
License:Open Source License
public void updateSize() { int clientWidth = Window.getClientWidth(); int width, height; if (clientWidth <= 1024) { width = Math.min(clientWidth - 470, 500); height = 91;//from ww w . ja v a2s. c om } else { width = Math.min(clientWidth - 508, 560); height = 117; } scrollPane.setPixelSize(width, height); chatBar.setWidth(width + "px"); writeMessageField.setPixelWidth(width - 31); scrollDown(); }
From source file:fr.fg.client.core.Client.java
License:Open Source License
public void load() { SoundManager.getInstance().configSound(Sounds.SMALL_SHOT1, 16, false); SoundManager.getInstance().configSound(Sounds.SMALL_SHOT2, 16, false); SoundManager.getInstance().configSound(Sounds.IMPACT, 70, false); SoundManager.getInstance().configSound(Sounds.EXPLOSION, 100, false); SoundManager.getInstance().configSound(Sounds.AVERAGE_SHOT1, 21, false); SoundManager.getInstance().configSound(Sounds.AVERAGE_SHOT2, 30, false); SoundManager.getInstance().configSound(Sounds.AVERAGE_SHOT2, 30, false); SoundManager.getInstance().configSound(Sounds.MISCLICK, 80, false); SoundManager.getInstance().configSound(Sounds.HYPERSPACE, 100, false); SoundManager.getInstance().configSound(Sounds.ENGINE, 100, false); SoundManager.getInstance().configMusic(Sounds.MUSIC1, 55); SoundManager.getInstance().configMusic(Sounds.MUSIC2, 55); SoundManager.getInstance().configMusic(Sounds.MUSIC3, 55); SoundManager.getInstance().configMusic(Sounds.MUSIC4, 55); dialogStates = new ArrayList<DialogState>(); fullScreen = false;/*from w w w . j a v a 2 s.c om*/ currentClientWidth = Window.getClientWidth(); // Carte areaContainer = new AreaContainer(); if (Window.getClientWidth() < 1024) RootPanel.get().addStyleName("lowres"); // Panel pour les graphismes en plein cran fullScreenPanel = new AbsolutePanel(); fullScreenPanel.getElement().setId("extra"); fullScreenPanel.getElement().setAttribute("unselectable", "on"); fullScreenPanel.setVisible(false); // Astuce du jour tipOfTheDay = new HTMLPanel("") { @Override public void onBrowserEvent(Event event) { switch (event.getTypeInt()) { case Event.ONCLICK: // Change le tooltip quand on clique dessus DynamicMessages messages = (DynamicMessages) GWT.create(DynamicMessages.class); tipOfTheDay.getElement().setInnerHTML( "<div class=\"icon\"></div>" + messages.getString("tip" + (int) (15 * Math.random()))); break; } } }; tipOfTheDay.getElement().setId("tipOfTheDay"); tipOfTheDay.getElement().setAttribute("unselectable", "on"); tipOfTheDay.sinkEvents(Event.ONCLICK); // Changelog changelog = new HTMLPanel(""); changelog.getElement().setAttribute("unselectable", "on"); changelog.getElement().setId("changelog"); changelogContainer = new JSScrollPane(); changelogContainer.getElement().setId("changelog-container"); changelogContainer.setView(changelog); changelogContainer.setPixelSize(270, OpenJWT.getClientHeight()); // Logo du jeu logo = new BaseWidget(); logo.getElement().setId("logo"); logo.getElement().setAttribute("unselectable", "on"); // Arrt du serveur serverShutdown = new HTMLPanel(""); serverShutdown.getElement().setId("serverShutdown"); serverShutdown.getElement().setAttribute("unselectable", "on"); // Fentre de connexion loginDialog = new LoginDialog(this); Window.addWindowResizeListener(this); Window.addWindowCloseListener(this); setStatus("Rcupration des donnes..."); if (Location.getHref().contains("battle")) { HashMap<String, String> params = new HashMap<String, String>(); params.put("hash", Location.getHref().substring(Location.getHref().lastIndexOf("/") + 1)); new Action("getreportbyhash", params, new ActionCallbackAdapter() { public void onSuccess(AnswerData data) { hideLoading(); RootPanel.get().add(areaContainer); RootPanel.get().add(fullScreenPanel); BattleReport battleReport = new BattleReport(true); battleReport.cacheReport(data.getReport()); battleReport.showReport(data.getReport().getId()); } }); } else { new Action("initialization", Action.NO_PARAMETERS, this); } }
From source file:fr.fg.client.core.Client.java
License:Open Source License
public void onSuccess(AnswerData data) { StateData state = data.getState();/* www . j av a2 s . c om*/ switch (state.getState()) { case StateData.STATE_OFFLINE: // Joueur dconnect LoginDialog dialog = getLoginDialog(); // Liste des serveurs ArrayList<ServerData> servers = new ArrayList<ServerData>(); for (int i = 0; i < state.getServersCount(); i++) servers.add(state.getServerAt(i)); dialog.setServers(servers, state.getCurrentServerIndex()); DynamicMessages messages = (DynamicMessages) GWT.create(DynamicMessages.class); StaticMessages staticMessages = (StaticMessages) GWT.create(StaticMessages.class); // Astuce du jour tipOfTheDay.getElement().setInnerHTML( "<div class=\"icon\"></div>" + messages.getString("tip" + (int) (9 * Math.random()))); String changelogHTML = "<div class=\"title\">Journal des modifications</div>"; for (int i = 0; i < state.getChangelogsCount(); i++) { ChangelogData changelog = state.getChangelogAt(i); changelogHTML += "<div class=\"entry\">" + "<div class=\"date\">" + DateTimeFormat .getFormat(staticMessages.dateTimeFormat()).format(new Date(1000l * changelog.getDate())) + "</div>" + changelog.getText() + "</div>"; } changelog.getElement().setInnerHTML(changelogHTML); changelogContainer.update(); hideLoading(); RootPanel.get().add(areaContainer); areaContainer.setNebula((int) (AreaContainer.NEBULAS_COUNT * Math.random()) + 1, true); dialog.setVisible(true); // Lien direct pour le parainage String currentUrl = Window.Location.getHref(); int urlSearchIndex = currentUrl.indexOf("#par_:"); if (urlSearchIndex != -1) { String urlSponsorName = currentUrl.substring(urlSearchIndex + 6, currentUrl.indexOf(":par")) .replace("/", ""); String oldSponsorName = urlSponsorName; do { oldSponsorName = urlSponsorName; urlSponsorName = urlSponsorName.replace("%20", " "); } while (oldSponsorName != urlSponsorName); dialog.activateSponsor(urlSponsorName); Window.Location.replace(currentUrl.substring(0, urlSearchIndex + 1)); } RootPanel.get().add(tipOfTheDay); RootPanel.get().add(changelogContainer); RootPanel.get().add(logo); setServerShutdown(state.getServerShutdown()); break; case StateData.STATE_ONLINE: // Sauvegarde le thme de l'utilisateur dans un cookie // (dure d'un an) Cookies.setCookie("theme", state.getOptions().getTheme(), new Date(1000l * Utilities.getCurrentTime() + 31536000000l)); // Recharge la page si le thme de l'utilisateur ne correspond pas // au thme affich if (!Config.isDebug() && !state.getOptions().getTheme().equals(Config.getTheme())) { Window.Location.reload(); return; } // Chargement des options Settings.setGridVisible(state.getOptions().isGridVisible()); Settings.setBrightness(state.getOptions().getBrightness()); Settings.setFleetsSkin(state.getOptions().getFleetsSkin()); Settings.setPlayerId(state.getPlayerId()); Settings.setPlayerLogin(state.getPlayerLogin()); Settings.setSecurityKey(state.getSecurityKey()); Settings.setPremium(state.isPremium()); Settings.setRights(state.getRights()); Settings.setEkey(state.getEkey()); Settings.setTimeUnit(state.getTimeUnit()); Settings.setCensorshipActive(state.getOptions().isCensorshipActive()); Settings.setConnectionOptimized(state.getOptions().isConnectionOptimized()); Settings.setFleetPrefix(state.getOptions().getFleetPrefix()); Settings.setFleetSuffix(state.getOptions().getFleetSuffix()); SoundManager.getInstance().setGeneralVolume(state.getOptions().getGeneralVolume()); SoundManager.getInstance().setSoundVolume(state.getOptions().getSoundVolume()); SoundManager.getInstance().setMusicVolume(state.getOptions().getMusicVolume()); Config.setGraphicsQuality(state.getOptions().getGraphicsQuality()); Cookies.setCookie("login", state.getPlayerLogin(), new Date(1000l * Utilities.getCurrentTime() + 31536000000l)); // Initialise les diffrents composants de l'interface int miniMapSize = Window.getClientWidth() < 1024 ? 120 : 160; miniMap = new MiniMap(new Dimension(miniMapSize, miniMapSize), areaContainer.getMap()); areaContainer.addMiniMap(miniMap); actionManager = new ActionManager(areaContainer); resourcesManager = new ResourcesManager(); researchManager = new ResearchManager(); productsManager = new ProductsManager(); progressBar = new ProgressBar(); chat = new Chat(); empireControlPanel = new EmpireControlPanel(); empireView = new EmpireView(); namePanel = new NamePanel(); selectionInfo = new SelectionInfo(); toolBar = new ToolBar(); missionPanel = new MissionPanel(); allyDialog = new AllyDialog(); lagometer = new Lagometer(); tutorial = new Tutorial(); advancementDialog = new AdvancementDialog(); playerTacticsDialog = new PlayerTacticsDialog(researchManager); contractDialog = new ContractDialog(); bugReportDialog = new BugReportDialog(); codexDialog = new CodexDialog(); if (Settings.isModerator()) { administrationPanelDialog = new AdministrationPanelDialog(); } // Zik-mu String[] playlist = new String[Sounds.MUSICS.length]; for (int i = 0; i < playlist.length; i++) playlist[i] = Sounds.MUSICS[i]; for (int i = playlist.length; i > 1; i--) { int a = i - 1; int b = (int) (Math.random() * i); String tmp = playlist[a]; playlist[a] = playlist[b]; playlist[b] = tmp; } SoundManager.getInstance().setPlaylist(playlist); SoundManager.getInstance().playMusic(0); if (loginDialog.isVisible()) { loginDialog.setVisible(false); RootPanel.get().remove(tipOfTheDay); RootPanel.get().remove(changelogContainer); RootPanel.get().remove(logo); } else if (firstSystemDialog != null && firstSystemDialog.isVisible()) { firstSystemDialog.setVisible(false); firstSystemDialog = null; } else { hideLoading(); RootPanel.get().add(areaContainer); } // Ajoute les composants de l'interface la page RootPanel.get().add(miniMap); RootPanel.get().add(progressBar); RootPanel.get().add(chat); RootPanel.get().add(empireControlPanel); RootPanel.get().add(empireView); RootPanel.get().add(namePanel); RootPanel.get().add(toolBar); RootPanel.get().add(fullScreenPanel); RootPanel.get().add(selectionInfo); RootPanel.get().add(missionPanel); RootPanel.get().add(lagometer); // Initialisation des composants productsManager.addProductsListener(allyDialog); productsManager.setProducts(state.getProducts()); allyDialog.setAlly(state.getAlly()); areaContainer.setArea(new IndexedAreaData(state.getArea()), new Point(state.getViewX(), state.getViewY())); areaContainer.getMap().setGridVisible(Settings.isGridVisible()); researchManager.setResearches(state.getResearch()); Client.getInstance().getProgressBar() .setPlayerGeneratorsCount(state.getPlayerGenerators().getGeneratorsCount()); ArrayList<PlayerStarSystemData> systems = new ArrayList<PlayerStarSystemData>(); for (int i = 0; i < state.getPlayerSystems().getSystemsCount(); i++) systems.add(state.getPlayerSystems().getSystemAt(i)); ArrayList<PlayerFleetData> fleets = new ArrayList<PlayerFleetData>(); for (int i = 0; i < state.getPlayerFleets().getFleetsCount(); i++) fleets.add(state.getPlayerFleets().getFleetAt(i)); ArrayList<PlayerGeneratorData> generators = new ArrayList<PlayerGeneratorData>(); for (int i = 0; i < state.getPlayerGenerators().getGeneratorsCount(); i++) generators.add(state.getPlayerGenerators().getGeneratorAt(i)); empireView.setData(systems, fleets, generators); resourcesManager.setSystems(systems); chat.addMessage("info", "", "", "Bienvenue sur Fallen Galaxy !", null, null, null, null, (Integer) null, (Integer) null); chat.addMessage("info", "", "", "Il y a actuellement " + state.getOnlinePlayers() + (state.getOnlinePlayers() > 1 ? " joueurs connects." : " joueur connect.") + (state.getLastConnection().length() > 0 ? " Dernire " + "connexion le " + state.getLastConnection() + "." : ""), null, null, null, null, (Integer) null, (Integer) null); HashMap<String, String> params = new HashMap<String, String>(); params.put("type", "chat"); new Action("messages/getmotd", params, UpdateManager.UPDATE_CALLBACK); missionPanel.setMissionStates(state.getContractsStates()); contractDialog.setContracts(state.getPlayerContracts()); progressBar.setPlayerData(state.getXp(), state.getColonizationPoints()); chat.setChannels(state.getChatChannels()); tutorial.setLessonDone((long) state.getTutorial()); advancementDialog.setAdvancements(state.getAdvancements()); playerTacticsDialog.setPlayerTactics(state.getTactics()); if (state.getUnreadMessages() > 0) getMessenger().setUnreadMessages(state.getUnreadMessages()); if (state.hasNewEvents()) getEventsDialog().setNewEvents(state.hasNewEvents()); if (state.getAlly().getId() != 0) { int unreadNews = 0; for (int i = 0; i < state.getAlly().getNewsCount(); i++) { AllyNewsData allyNews = state.getAlly().getNewsAt(i); if (!allyNews.isRead()) unreadNews++; } allyDialog.setUnreadNews(unreadNews); } EventManager.addEventHook(this); // Dmarre la gestion des mises jour en temps rel UpdateManager.start(); AwayManager.start(); setServerShutdown(state.getServerShutdown()); break; case StateData.STATE_ALREADY_ONLINE: // Joueur dj connect Settings.setSecurityKey(state.getSecurityKey()); setStatus("Vous tes dj connect."); break; case StateData.STATE_NO_SYSTEM: Settings.setSecurityKey(state.getSecurityKey()); if (loginDialog.isVisible()) { loginDialog.setVisible(false); RootPanel.get().remove(tipOfTheDay); RootPanel.get().remove(changelogContainer); RootPanel.get().remove(logo); } else { RootPanel.get().add(areaContainer); areaContainer.setNebula((int) (AreaContainer.NEBULAS_COUNT * Math.random() + 1), true); } firstSystemDialog = new FirstSystemDialog(this); firstSystemDialog.setVisible(true); setServerShutdown(state.getServerShutdown()); break; } }
From source file:fr.fg.client.core.Client.java
License:Open Source License
public void onWindowResized(int width, int height) { if (chat != null) chat.updateSize();// ww w .j av a 2 s . c o m int clientWidth = Window.getClientWidth(); int clientHeight = Window.getClientHeight(); if (currentClientWidth > 1024 && clientWidth <= 1024) { RootPanel.get().addStyleName("lowres"); if (miniMap != null) miniMap.setSize(new Dimension(120, 120)); } else if (currentClientWidth <= 1024 && clientWidth > 1024) { RootPanel.get().removeStyleName("lowres"); if (miniMap != null) miniMap.setSize(new Dimension(160, 160)); } currentClientWidth = clientWidth; changelogContainer.setPixelHeight(clientHeight); changelogContainer.update(); if (areaContainer != null) areaContainer.getMap().setBounds(new Dimension(clientWidth, clientHeight)); }
From source file:fr.fg.client.core.EmpireView.java
License:Open Source License
private int computeMaxRowsCount() { int clientWidth = Window.getClientWidth(); return (OpenJWT.getClientHeight() - (clientWidth <= 1024 ? 160 : 230)) / 40; }