List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationTreeNode.java
License:EUPL
protected HorizontalPanel createHeader() { HorizontalPanel headerPanel = new HorizontalPanel(); headerPanel.setStyleName("imageAnnotation-header"); Image avatar = new Image(annotation.getCreatedBy().getGravatarURL()); avatar.setStyleName("imageAnnotation-header-avatar"); headerPanel.add(avatar);//from w w w. ja v a2s . c o m Label userLabel = new Label(annotation.getCreatedBy().getUsername()); userLabel.setStyleName("imageAnnotation-header-user"); userLabel.getElement().setAttribute("property", "dc:creator"); headerPanel.add(userLabel); Label dateLabel = new Label("(" + DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT) .format(annotation.getLastModified()) + ")"); dateLabel.setStyleName("imageAnnotation-header-date"); headerPanel.add(dateLabel); PushButton feedIcon = new PushButton(new Image("images/feed-icon-14x14.png")); feedIcon.setStyleName("imageAnnotation-header-feedicon"); feedIcon.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.open(YUMACoreProperties.getFeedUrl() + "replies/" + annotation.getId(), "_self", ""); } }); headerPanel.add(feedIcon); return headerPanel; }
From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationTreeNode.java
License:EUPL
private Panel createActions() { HorizontalPanel actionsPanel = new HorizontalPanel(); btnReply = new PushButton(YUMACoreProperties.getConstants().reply()); btnReply.setStyleName("imageAnnotation-action"); btnReply.addClickHandler(new AnnotateClickHandler(panel, null, this, false)); btnReply.setEnabled(!User.get().isAnonymous()); actionsPanel.add(btnReply);/*from ww w . j av a 2s . c o m*/ btnReplyFragment = new PushButton(YUMACoreProperties.getConstants().replyWithFragment()); btnReplyFragment.setStyleName("imageAnnotation-action"); btnReplyFragment.addClickHandler(new AnnotateClickHandler(panel, null, this, true)); btnReplyFragment.setEnabled(!User.get().isAnonymous()); actionsPanel.add(btnReplyFragment); btnEdit = new PushButton(YUMACoreProperties.getConstants().edit()); btnEdit.setStyleName("imageAnnotation-action"); btnEdit.setEnabled(User.get().equals(annotation.getCreatedBy()) && !annotation.hasReplies()); btnEdit.addClickHandler(new AnnotateClickHandler(panel, this, parent, annotation.hasFragment())); actionsPanel.add(btnEdit); btnDelete = new PushButton(YUMACoreProperties.getConstants().delete()); btnDelete.setStyleName("imageAnnotation-action"); btnDelete.setEnabled(User.get().equals(annotation.getCreatedBy()) && !annotation.hasReplies()); btnDelete.addClickHandler(new DeleteClickHandler(panel, this, parent)); actionsPanel.add(btnDelete); actionsPanel.setStyleName("imageAnnotation-actions"); return actionsPanel; }
From source file:at.ait.dme.yuma.suite.apps.map.client.explore.SearchPanel.java
License:EUPL
public SearchPanel(TileBasedImageViewer imageComposite) { this.searchLayer = imageComposite.getSearchLayer(); I18NConstants i18n = YUMACoreProperties.getConstants(); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setStyleName("explore-PlaceSearch"); Label searchLabel = new Label(i18n.searchLabel()); searchBox = new TextBox(); Button searchBtn = new Button(i18n.searchButton(), new ClickHandler() { @Override// w w w. j a v a 2s . co m public void onClick(ClickEvent event) { doAsyncGeocoding(); } }); hPanel.add(searchLabel); hPanel.add(searchBox); hPanel.add(searchBtn); this.add(hPanel); }
From source file:at.ait.dme.yuma.suite.apps.map.client.georeferencing.ControlPointEditForm.java
License:EUPL
public ControlPointEditForm(AnnotationPanel panel, AnnotationTreeNode annotation, ControlPointLayer controlPointLayer) { super(panel, annotation, null); // Reference to control point layer this.controlPointLayer = controlPointLayer; // Place name (will be geo-coded) HorizontalPanel placeNamePanel = new HorizontalPanel(); Label placeNameLabel = new Label("Place: "); placeNameLabel.setStyleName("cp-Editor-Label"); placeNamePanel.add(placeNameLabel);//from w w w. j av a 2s . c o m placeName = new TextBox(); placeName.setStyleName("cp-Editor-Field"); placeName.addKeyDownHandler(new AbstractKeyboardHandler(1000) { @Override public void onSpace() { doAsyncGeocoding(placeName.getText()); } @Override public void onIdle() { doAsyncGeocoding(placeName.getText()); } }); placeNamePanel.add(placeName); // Lon (determined automatically - field disabled) HorizontalPanel lonPanel = new HorizontalPanel(); Label lonLabel = new Label("Lon: "); lonLabel.setStyleName("cp-Editor-Label"); lonPanel.add(lonLabel); lon = new TextBox(); lon.setEnabled(false); lon.setStyleName("cp-Editor-Field"); lonPanel.add(lon); // Lat (determined automatically - field disabled) HorizontalPanel latPanel = new HorizontalPanel(); Label latLabel = new Label("Lat: "); latLabel.setStyleName("cp-Editor-Label"); latPanel.add(latLabel); lat = new TextBox(); lat.setEnabled(false); lat.setStyleName("cp-Editor-Field"); latPanel.add(lat); // X/Y (determined automatically - field disabled) HorizontalPanel xyPanel = new HorizontalPanel(); Label xyLabel = new Label("X/Y: "); xyLabel.setStyleName("cp-Editor-Label"); xyPanel.add(xyLabel); xy = new TextBox(); xy.setEnabled(false); xy.setStyleName("cp-Editor-Field"); xyPanel.add(xy); if (annotation != null) { placeName.setText(annotation.getTitle()); GeoPoint p = (GeoPoint) ((ImageFragment) annotation.getAnnotation().getFragment()).getShape(); lon.setText(Double.toString(p.getLng())); lat.setText(Double.toString(p.getLat())); setXY(p.getX(), p.getY()); } // Assemble the main FlowPanel FlowPanel form = new FlowPanel(); form.setStyleName("cp-Editor"); form.add(placeNamePanel); form.add(lonPanel); form.add(latPanel); form.add(xyPanel); form.add(createButtonsPanel(panel, annotation)); form.setStyleName("imageAnnotation-form"); initWidget(form); controlPointLayer.setControlPointForm(this); if (annotation != null) { controlPointLayer.showActiveFragmentPanel((ImageAnnotation) annotation.getAnnotation(), false); } else { controlPointLayer.showActiveFragmentPanel(null, false); } }
From source file:at.ait.dme.yuma.suite.apps.map.client.georeferencing.ControlPointEditForm.java
License:EUPL
private HorizontalPanel createButtonsPanel(AnnotationPanel panel, AnnotationTreeNode annotation) { HorizontalPanel buttonsPanel = new HorizontalPanel(); PushButton saveButton = new PushButton(YUMACoreProperties.getConstants().save()); if (annotation == null) { saveButton.addClickHandler(new SaveClickHandler(panel, null, this)); } else {/*from w w w. ja va2s .c om*/ saveButton.addClickHandler(new UpdateClickHandler(panel, annotation, null, this)); } saveButton.setStyleName("imageAnnotation-form-button"); buttonsPanel.add(saveButton); PushButton cancelButton = new PushButton(YUMACoreProperties.getConstants().cancel()); cancelButton.setStyleName("imageAnnotation-form-button"); cancelButton.addClickHandler(new CancelClickHandler(panel, annotation)); buttonsPanel.add(cancelButton); return buttonsPanel; }
From source file:at.ait.dme.yuma.suite.apps.map.client.georeferencing.ControlPointPanel.java
License:EUPL
@Override protected Widget createHeader() { // The parent header panel FlowPanel header = new FlowPanel(); // 'Help geo-Reference' label Label addAnnotationLabel = new Label(YUMACoreProperties.getConstants().helpGeoreference()); addAnnotationLabel.setStyleName("imageAnnotation-add-annotation"); header.add(addAnnotationLabel);/* ww w. j a v a 2s .co m*/ // 'Help' link HTML help = new HTML( "<a target=\"_blank\" href=\"userguide_" + LocaleInfo.getCurrentLocale().getLocaleName() + ".html\">" + YUMACoreProperties.getConstants().help() + "</a>"); help.setStyleName("imageAnnotation-help"); header.add(help); // Instructions text Label addAnnotationHint = new Label(YUMACoreProperties.getConstants().helpGeoreferenceHint()); addAnnotationHint.setStyleName("imageAnnotation-add-annotation-hint"); header.add(addAnnotationHint); // Button panel HorizontalPanel buttons = new HorizontalPanel(); // 'Create Control Point' button createButton = new PushButton(YUMACoreProperties.getConstants().actionCreateCP()); createButton.setStyleName("imageAnnotation-button"); createButton.addClickHandler(new AnnotateClickHandler(this, null, null, false)); createButton.setEnabled(!User.get().isAnonymous()); buttons.add(createButton); if (YUMACoreProperties.getObjectURI().startsWith("http://georeferencer")) createButton.setEnabled(false); header.add(buttons); // Placeholder for the annotation form header.add(editFormPanel); return header; }
From source file:au.com.gworks.gwt.petstore.client.ShoppingView.java
License:Apache License
public ShoppingView() { horizontalPanel = new HorizontalPanel(); initWidget(horizontalPanel);//from w w w . j a v a 2 s. c o m productAisle = new OutlookBar(); horizontalPanel.add(productAisle); productShelf = new CardDeck(); horizontalPanel.add(productShelf); setStyleName("ps-ProductAisleView"); }
From source file:au.com.gworks.gwt.petstore.client.WelcomeView.java
License:Apache License
public WelcomeView() { container = new VerticalPanel(); initWidget(container);/*from w w w. j a v a 2 s . co m*/ groupBarContainer = new EastWestHorizPanels(); container.add(groupBarContainer); groupBarContainer.setStyleName("ps-ewp-mainGroupSections"); Label title = new Label("Welcome"); groupBarContainer.getWest().add(title); title.setStyleName("ps-ewp-mainGroupSections-txt"); welcomeLabel = new Label("gwt-Petstore"); welcomeLabel.setStyleName("ps-text-large"); container.add(welcomeLabel); authorLabel = new Label("by Ashin Wimalajeewa & Dimax Pradi"); authorLabel.setStyleName("ps-text-medium"); container.add(authorLabel); descLabel = new HTML(); container.add(descLabel); poweredByLabel = new Label("Powered by"); poweredByLabel.setStyleName("ps-text-large"); container.add(poweredByLabel); gwtLibs = new HorizontalPanel(); container.add(gwtLibs); Label gems = new Label("javaongems"); gems.setStyleName("ps-text-large"); Label gwtSl = new Label("gwt-widgets Server Library"); gwtSl.setStyleName("ps-text-large"); gwtLibs.add(gems); gwtLibs.add(gwtSl); mainLibs = new HorizontalPanel(); mainLibs.setVisible(false); container.add(mainLibs); gwtImg = new Image(); mainLibs.add(gwtImg); gwtImg.setUrl("powerByGwt.png"); springImg = new Image(); mainLibs.add(springImg); springImg.setUrl("poweredBySpring.gif"); ibatisImg = new Image(); mainLibs.add(ibatisImg); ibatisImg.setUrl("poweredByIBatis.gif"); }
From source file:bingo.client.Bingo.java
License:Open Source License
/** * This is the entry point method.//from w ww . j a v a 2s . c om */ public void onModuleLoad() { Label titleLabel = new Label(); titleLabel.setText(strings.title()); RootPanel.get("title").add(titleLabel); // This is the general notification text box RootPanel.get("message").add(message); // Cheking if the user has already an user id final String cookie = Cookies.getCookie(COOKIE_ID); // Validating the cookie bingoService.statusUserId(cookie, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); Cookies.removeCookie(COOKIE_ID); } @Override public void onSuccess(Integer status) { // TODO: Control the logged status (I should not get a user if s/he is already logged) if (status.intValue() == BingoService.NO_LOGGED || status.intValue() == BingoService.LOGGED) { bingoService.getUserId(new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(strings.errorUserCreation()); } @Override public void onSuccess(String result) { userId = result; } }); message.setHTML(""); // Showing image to enter ImageResource imageResource = BingoResources.INSTANCE.entry(); Image entryImage = new Image(imageResource.getSafeUri()); RootPanel.get("buttons").add(entryImage); // Selecting behavior (admin / voter) HorizontalPanel entryPoint = new HorizontalPanel(); entryPoint.setStyleName("mainSelectorPanel"); entryPoint.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); entryPoint.setSpacing(50); // // CREATING A BINGO // VerticalPanel leftPanel = new VerticalPanel(); leftPanel.setStyleName("selectorPanel"); Label leftPanelTitle = new Label(); leftPanelTitle.setStyleName("selectorPanelTitle"); leftPanelTitle.setText(strings.leftPanelTitle()); leftPanel.add(leftPanelTitle); leftPanel.setCellHorizontalAlignment(leftPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid leftSubPanel = new Grid(2, 2); leftSubPanel.setWidget(0, 0, new Label(strings.createBingoName())); final TextBox bingoNameBox = new TextBox(); leftSubPanel.setWidget(0, 1, bingoNameBox); leftSubPanel.setWidget(1, 0, new Label(strings.createBingoPassword())); final PasswordTextBox bingoPasswordBox = new PasswordTextBox(); leftSubPanel.setWidget(1, 1, bingoPasswordBox); leftPanel.add(leftSubPanel); final Button createButton = new Button("Create"); createButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { bingoService.createBingo(userId, bingoNameBox.getText(), bingoPasswordBox.getText(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(final String gameId) { final BingoGrid bingoGrid = new BingoGrid(); initAdminGrid(userId, bingoGrid, false); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageCreation()); // Setting the cookie Date expirationDate = new Date(); expirationDate.setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } }); leftPanel.add(createButton); leftPanel.setCellHorizontalAlignment(createButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(leftPanel); // // JOINING // VerticalPanel rightPanel = new VerticalPanel(); rightPanel.setStyleName("selectorPanel"); Label rightPanelTitle = new Label(); rightPanelTitle.setStyleName("selectorPanelTitle"); rightPanelTitle.setText(strings.rightPanelTitle()); rightPanel.add(rightPanelTitle); rightPanel.setCellHorizontalAlignment(rightPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid rightSubPanel = new Grid(2, 2); rightSubPanel.setWidget(0, 0, new Label(strings.joinToBingoName())); final ListBox joinExistingBingoBox = new ListBox(); bingoService.getBingos(new AsyncCallback<String[][]>() { @Override public void onFailure(Throwable caught) { joinExistingBingoBox.addItem(strings.noBingos()); } @Override public void onSuccess(String[][] result) { if (result == null) { joinExistingBingoBox.addItem(strings.noBingos()); } else { for (int i = 0; i < result.length; i++) { String gameName = result[i][0]; String gameId = result[i][1]; joinExistingBingoBox.addItem(gameName, gameId); } } } }); rightSubPanel.setWidget(0, 1, joinExistingBingoBox); rightSubPanel.setWidget(1, 0, new Label(strings.joinToBingoPassword())); final PasswordTextBox joinBingoPasswordBox = new PasswordTextBox(); rightSubPanel.setWidget(1, 1, joinBingoPasswordBox); rightPanel.add(rightSubPanel); final Button joinButton = new Button("Join"); joinButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int index = joinExistingBingoBox.getSelectedIndex(); if (index < 0) message.setText(strings.noSelectedItem()); else { final String gameId = joinExistingBingoBox.getValue(index); if (gameId == null) message.setText(strings.noSelectedItem()); else { bingoService.joinBingo(userId, gameId, joinBingoPasswordBox.getText(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Void result) { final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageJoin()); // Setting the cookie Date expirationDate = new Date(); expirationDate .setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } } } }); rightPanel.add(joinButton); rightPanel.setCellHorizontalAlignment(joinButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(rightPanel); RootPanel.get("bingoTable").add(entryPoint); } else if (status.intValue() == BingoService.ADMIN) { message.setText("Detected cookie: " + cookie + " as admin"); userId = cookie; bingoService.statusBingo(userId, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Integer result) { int status = result.intValue(); final BingoGrid bingoGrid = new BingoGrid(); if (status == BingoService.RUNNING) { initAdminGrid(userId, bingoGrid, false); message.setText(strings.welcomeMessageCreation()); } else if (status == BingoService.FINISHED) { initAdminGrid(userId, bingoGrid, true); message.setText(strings.finishMessage()); } RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } }); } else if (status.intValue() == BingoService.PARTICIPANT) { message.setText("Detected cookie: " + cookie + " as participant"); userId = cookie; final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); updateUserGrid(bingoGrid, null); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } } }); }
From source file:bingo.client.Bingo.java
License:Open Source License
private void initAdminGrid(final String userId, final BingoGrid bingoGrid, final boolean hasFinished) { final Timer timer = new Timer() { int totalParticipants = 0; @Override/*from ww w . ja v a 2s. c o m*/ public void run() { bingoService.getTotalParticipants(userId, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(Integer result) { totalParticipants = result.intValue(); } }); bingoService.getVotes(userId, new AsyncCallback<int[][]>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(int[][] result) { if (result == null) { result = new int[BingoGrid.ROW][BingoGrid.COL]; for (int i = 0; i < BingoGrid.ROW; i++) for (int j = 0; j < BingoGrid.COL; j++) result[i][j] = 0; } for (int row = 0; row < BingoGrid.ROW; ++row) for (int col = 0; col < BingoGrid.COL; ++col) { bingoGrid.setVoteString(row, col, String.valueOf(result[row][col]), String.valueOf(totalParticipants)); } } }); } }; // If the game is not finished, repeat; if so, run once if (!hasFinished) timer.scheduleRepeating(ADMIN_TIMER); else timer.run(); HorizontalPanel panel = new HorizontalPanel(); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); final Button finishButton = new Button(); // If the game is not finished, allow finishing it; if so, allow download data if (!hasFinished) finishButton.setText(strings.finishBingo()); else finishButton.setText(strings.download()); finishButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!hasFinished) bingoService.finishBingo(userId, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Void result) { message.setText(strings.finishedBingo()); finishButton.setText(strings.download()); timer.cancel(); } }); bingoService.getVotes(userId, new AsyncCallback<int[][]>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(int[][] result) { // Create a popup dialog box final DialogBox box = new DialogBox(); box.setText(strings.info()); box.setAnimationEnabled(true); final Button boxAcceptButton = new Button(strings.accept()); boxAcceptButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }); Label boxLabel = new Label(); boxLabel.setText(strings.finishMessage()); HTML voteData = new HTML(); if (result == null) { result = new int[BingoGrid.ROW][BingoGrid.COL]; for (int i = 0; i < BingoGrid.ROW; i++) for (int j = 0; j < BingoGrid.COL; j++) result[i][j] = 0; } String cellKey = ""; String cellString = ""; String voteDataString = ""; for (int row = 0; row < BingoGrid.ROW; ++row) for (int col = 0; col < BingoGrid.COL; ++col) { cellKey = "cell" + row + col; cellString = strings.map().get(cellKey); voteDataString += " " + cellString + " = " + result[row][col] + "<br>"; } voteData.setHTML(voteDataString); voteData.addStyleName("boxData"); VerticalPanel boxPanel = new VerticalPanel(); boxPanel.addStyleName("boxPanel"); boxPanel.add(boxLabel); boxPanel.add(voteData); HorizontalPanel buttonsPanel = new HorizontalPanel(); buttonsPanel.add(boxAcceptButton); boxPanel.add(buttonsPanel); boxPanel.setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER); box.setWidget(boxPanel); box.center(); } }); } }); panel.add(finishButton); final Button terminateButton = new Button(strings.terminateButton()); terminateButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // Create a popup dialog box final DialogBox box = new DialogBox(); box.setText(strings.warning()); box.setAnimationEnabled(true); final Button boxCancelButton = new Button(strings.cancel()); boxCancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }); final Button boxAcceptButton = new Button(strings.accept()); boxAcceptButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { bingoService.terminateBingo(userId, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Void result) { message.setText(strings.terminatedBingo()); timer.cancel(); } }); box.hide(); } }); final Label boxLabel = new Label(); boxLabel.setText(strings.terminateMessage()); VerticalPanel boxPanel = new VerticalPanel(); boxPanel.addStyleName("boxPanel"); boxPanel.add(boxLabel); HorizontalPanel buttonsPanel = new HorizontalPanel(); buttonsPanel.add(boxCancelButton); buttonsPanel.add(boxAcceptButton); boxPanel.add(buttonsPanel); box.setWidget(boxPanel); box.center(); } }); panel.add(terminateButton); RootPanel.get("buttons").clear(); RootPanel.get("buttons").add(panel); }