List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:app.dnd.drag.DraggableCellDecorator.java
License:Apache License
/** * Construct a new {@link IconCellDecorator}. The icon and the content will be * middle aligned by default./* w ww . ja v a2 s. com*/ * * @param dragSource - drag source * @param dragController - drag controller * @param cell the cell to decorate */ public DraggableCellDecorator(DragSource dragSource, DragController dragController, Cell<C> cell) { this(dragSource, dragController, DNDResources.INSTANCE, cell, HasVerticalAlignment.ALIGN_MIDDLE, DEFAULT_SPACING); }
From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationSearchResultComposite.java
License:EUPL
public ImageAnnotationSearchResultComposite(String searchTerm) { initWidget(compositePanel);// w ww .j a va 2 s .co m this.searchTerm = searchTerm; this.setStyleName("imageAnnotation-searchresult-composite"); compositePanel.add(resultTable); // the search result table resultTable.setStyleName("sortableTable"); resultTable.setBorderWidth(0); resultTable.setCellPadding(1); resultTable.setCellSpacing(1); resultTable.addColumnHeader(Application.getConstants().annotationCreator(), 0); resultTable.addColumnHeader(Application.getConstants().annotationCreationDate(), 1); resultTable.addColumnHeader(Application.getConstants().annotationImage(), 2); resultTable.addColumnHeader(Application.getConstants().annotationTitle(), 3); resultTable.addColumnHeader(Application.getConstants().annotationText(), 4); RowFormatter rowFormatter = resultTable.getRowFormatter(); rowFormatter.setStyleName(0, "tableHeader"); CellFormatter cellFormatter = resultTable.getCellFormatter(); for (int colIndex = 0; colIndex < 5; colIndex++) { cellFormatter.setStyleName(0, colIndex, "headerStyle"); cellFormatter.setAlignment(0, colIndex, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); } resultTable.setValue(1, 0, Application.getConstants().searching()); // do the search search(); }
From source file:bingo.client.BingoGrid.java
License:Open Source License
private void initGrid() { cells = new BingoCell[ROW][COL]; this.setCellPadding(5); String cellKey = ""; for (int row = 0; row < ROW; ++row) for (int col = 0; col < COL; ++col) { cellKey = "cell" + row + col; // Getting the picture ImageResource imageResource = getImageResource(row, col); // Getting the text String cellString = strings.map().get(cellKey); BingoCell bingoCell = new BingoCell(imageResource.getSafeUri(), cellString, ""); // Building the panel this.setWidget(row, col, bingoCell); cells[row][col] = bingoCell; this.getCellFormatter().setStyleName(row, col, "cell-noselected"); this.getCellFormatter().setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_CENTER); this.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_MIDDLE); this.getCellFormatter().setWidth(row, col, CELL_WIDTH); this.getCellFormatter().setHeight(row, col, CELL_HEIGHT); }/*from w ww. jav a 2 s. co m*/ }
From source file:burrito.client.sitelet.SiteletDragAndDropPanel.java
License:Apache License
public SiteletDragAndDropPanel(final String containerName) { super();/*from w ww . jav a 2 s . co m*/ widgetCreator.setContainerName(containerName); Hyperlink addSitelet = new Hyperlink(labels.addSitelet(), "-1"); wrapper.add(addSitelet); saveOrderButton = new Button(labels.saveOrder(), new ClickHandler() { @Override public void onClick(ClickEvent event) { service.saveSiteletOrder(containerName, currentOrder, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { InfoMessagePopup popup = new InfoMessagePopup(); popup.setTextAndShow(labels.orderSaved()); orderChangedPanel.setVisible(false); } @Override public void onFailure(Throwable caught) { throw new RuntimeException("Failed to save order", caught); } }); } }); orderChangedPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); orderChangedPanel.add(new Label(labels.orderChanged())); orderChangedPanel.add(new HTML(" ")); orderChangedPanel.add(saveOrderButton); orderChangedPanel.setVisible(false); service.getSitelets(containerName, new AsyncCallback<List<SiteletDescription>>() { @Override public void onSuccess(final List<SiteletDescription> result) { currentModel = result; render(); } @Override public void onFailure(Throwable caught) { throw new RuntimeException("Failed to load sitelets for container " + containerName, caught); } }); wrapper.add(siteletsContainer); wrapper.add(orderChangedPanel); initWidget(wrapper); }
From source file:burrito.client.widgets.form.EditForm.java
License:Apache License
public EditForm() { save.addStyleName("k5-EditForm-button-save"); cancel.addStyleName("k5-EditForm-button-cancel"); SimplePanel mainWrapper = new SimplePanel(); mainWrapper.add(main);//from www .j av a2 s . c o m dock.add(mainWrapper, DockPanel.CENTER); buttonWrapper = new SimplePanel(); SimplePanel buttonWrapperInner = new SimplePanel(); buttonWrapper.add(buttonWrapperInner); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); buttonWrapperInner.addStyleName("k5-EditForm-buttons"); // start with save button disabled save.setEnabled(false); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { save(); } }); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveCancelListener.onCancel(); } }); hp.add(save); hp.add(extraButtonsPanel); hp.add(cancel); hp.add(infoMessage); buttonWrapperInner.setWidget(hp); dock.add(buttonWrapper, DockPanel.SOUTH); wrapper.add(dock); wrapper.add(loading); wrapper.showWidget(0); initWidget(wrapper); addStyleName("k5-EditForm"); mainWrapper.addStyleName("k5-EditForm-main"); }
From source file:burrito.client.widgets.panels.table.PageController.java
License:Apache License
/** * Creates a new pagecontroller//from w w w .ja va 2 s.co m * * @param showPageLabel * @param maxPagesShown * If not <code>null</code> then this will be the maximum number * of pages shown in the page controller. */ public PageController(boolean showPageLabel) { HorizontalPanel wrapper = new HorizontalPanel(); wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); if (showPageLabel) { Label label = new Label(messages.page()); label.addStyleName("k5-PageController-label"); wrapper.add(label); } next = new PushButton(new Image(GWT.getModuleBaseURL() + "images/page-next.png?v=2")); previous = new PushButton(new Image(GWT.getModuleBaseURL() + "images/page-previous.png?v=2")); next.getUpDisabledFace().setImage(new Image(GWT.getModuleBaseURL() + "images/page-next-disabled.png?v=2")); previous.getUpDisabledFace() .setImage(new Image(GWT.getModuleBaseURL() + "images/page-previous-disabled.png?v=2")); next.addStyleName("k5-PageController-nextButton"); previous.addStyleName("k5-PageController-previousButton"); currentPageLabel = createCurrentPageAnchor(); currentPageLabel.addStyleName("k5-PageController-link-selected"); next.setEnabled(false); previous.setEnabled(false); next.setTitle(messages.next()); previous.setTitle(messages.previous()); wrapper.add(previous); wrapper.add(currentPageLabel); wrapper.add(next); next.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (PageControllerHandler handler : handlers) { handler.loadPage(currentPageZeroIndexed + 1); } } }); previous.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { for (PageControllerHandler handler : handlers) { handler.loadPage(currentPageZeroIndexed - 1); } } }); initWidget(wrapper); addStyleName("k5-PageController"); setVisible(false); }
From source file:burrito.client.widgets.panels.table.Table.java
License:Apache License
/** * Adds a batch action to this table. A batch action is performed on * selected rows in the table./* w ww. java2 s. co m*/ * * @param batchAction */ public void addBatchAction(final BatchAction<T> batchAction) { batchJobs.add(new VerticalSpacer(10)); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); final Button b = new Button(batchAction.getButtonText()); ClickHandler ch = new ClickHandler() { @Override public void onClick(ClickEvent event) { final List<T> selected = getSelectedRows(); if (selected == null || selected.isEmpty()) { return; } batchAction.performAction(selected, new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { b.setEnabled(true); b.removeStyleName("loading"); infoPopup.setTextAndShow(batchAction.getSuccessText(selected)); load(pageController.getCurrentPage()); } @Override public void onFailure(Throwable caught) { b.setEnabled(true); b.removeStyleName("loading"); throw new RuntimeException(caught); } }); b.setEnabled(false); b.addStyleName("loading"); } }; b.addClickHandler(ch); hp.add(b); hp.add(new Label(batchAction.getDescription())); batchJobs.add(hp); }
From source file:cc.alcina.framework.gwt.client.ClientNotificationsImpl.java
License:Apache License
@Override public void showDialog(String captionHTML, Widget captionWidget, String msg, MessageType messageType, List<Button> extraButtons, String containerStyle) { ensureImages();//from w w w . j a va 2s .co m HorizontalAlignmentConstant align = messageType == MessageType.ERROR ? HasHorizontalAlignment.ALIGN_LEFT : HasHorizontalAlignment.ALIGN_CENTER; if (dialogBox != null) { dialogBox.hide(); } String title = CommonUtils.friendlyConstant(messageType); dialogBox = new GlassDialogBox(); dialogBox.setAnimationEnabled(dialogAnimationEnabled); AbstractImagePrototype aip = null; String text = ""; switch (messageType) { case INFO: aip = AbstractImagePrototype.create(images.info()); text = "Information"; break; case WARN: aip = AbstractImagePrototype.create(images.warning()); text = "Warning"; break; case ERROR: aip = AbstractImagePrototype.create(images.error()); text = "Problem notification"; break; } dialogBox.setText(text); FlexTable ft = new FlexTable(); containerStyle = containerStyle != null ? containerStyle : (messageType == MessageType.ERROR || !CommonUtils.isNullOrEmpty(msg)) ? "medium" : "narrow"; ft.setCellSpacing(4); ft.setStyleName("alcina-Notification"); ft.addStyleName(containerStyle); FlexCellFormatter cf = (FlexCellFormatter) ft.getCellFormatter(); ft.setWidget(0, 0, aip.createImage()); cf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); cf.setWidth(0, 0, "40px"); FlowPanel fp = new FlowPanel(); fp.setStyleName("text"); Widget capWidget = captionHTML != null ? new HTML(captionHTML) : captionWidget; if (captionHTML != null) { capWidget.setStyleName("caption"); } fp.add(capWidget); if (!CommonUtils.isNullOrEmpty(msg)) { Link nh = new Link("View detail"); nh.addStyleName("pad-5"); dialogHtml = new HTML("<span class='logboxpre'>" + msg.replace("\n", "<br>") + "</span>", true); final ScrollPanel sp = new ScrollPanel(dialogHtml); sp.setStyleName("logbox"); sp.setVisible(containerStyle.equals("wide")); nh.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sp.setVisible(!sp.isVisible()); } }); if (LooseContext.getBoolean(ClientNotifications.CONTEXT_AUTOSHOW_DIALOG_DETAIL)) { sp.setVisible(true); } fp.add(nh); fp.add(sp); } ft.setWidget(0, 1, fp); cf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(8); Button closeButton = new Button("Close"); hp.add(closeButton); if (extraButtons != null) { for (Button b : extraButtons) { hp.add(b); } } ft.setWidget(1, 0, hp); cf.setColSpan(1, 0, 2); cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBox.setWidget(ft); dialogBox.center(); dialogBox.show(); Scheduler.get().scheduleDeferred(() -> closeButton.setFocus(true)); }
From source file:cl.uai.client.marks.RubricMark.java
License:Open Source License
/** * Creates a new RubricMark at a specific position in a page * //from ww w .j av a 2s . c o m * @param posx X coordinate in the page * @param posy Y coordinate in the page * @param pageno page number (from 1 to N) * @param rubricLevel the rubric level indicating criterion and level in the rubric */ public RubricMark(int id, int posx, int posy, int pageno, int markerid, int lvlid, long timecreated, int criterionid, String markername, String rawtext) { super(id, posx, posy, pageno, markerid, timecreated, criterionid, markername, rawtext); feedback = new ArrayList<FeedbackObject>(); // Rubric marks have format 2 this.format = 2; this.iconType = IconType.TH; this.addStyleName(Resources.INSTANCE.css().rubricmark()); this.setLevelId(lvlid); // Collaborative buttons if (EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_MARKER_TRAINING && EMarkingConfiguration.isChatEnabled()) { collaborativeMarks = new HorizontalPanel(); like = new LikeMark(); like.setMark(this); like.setValue(0); collaborativeMarks.add(like); dislike = new DisLikeMark(); dislike.setMark(this); dislike.setValue(0); collaborativeMarks.add(dislike); quote = new QuoteMark(); quote.setMark(this); quote.setValue(0); collaborativeMarks.add(quote); discussion = new DiscussionMark(); discussion.setMark(this); discussion.setValue(0); collaborativeMarks.add(discussion); //TODO Date time = new Date(timecreated * 1000L); discussion.addMessage(time.toString(), markername, rawtext, markerid); collaborativeMarks.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); collaborativeMarks.addStyleName(Resources.INSTANCE.css().tablecollaborativebuttons()); // The mark dont belongs me if (markerid != EMarkingConfiguration.getMarkerId()) { like.setCanClick(true); dislike.setCanClick(true); quote.setCanClick(true); //discussion.setCanClick(true); } else { like.removeStyleName(Resources.INSTANCE.css().likeIcon()); like.addStyleName(Resources.INSTANCE.css().mycolloborativeicon()); dislike.removeStyleName(Resources.INSTANCE.css().likeIcon()); dislike.addStyleName(Resources.INSTANCE.css().mycolloborativeicon()); quote.removeStyleName(Resources.INSTANCE.css().likeIcon()); quote.addStyleName(Resources.INSTANCE.css().mycolloborativeicon()); } // get counter for collaborative buttons String url = "ids=" + MarkingInterface.getDraftId() + "&commentid=" + this.getId(); AjaxRequest.ajaxRequest("action=getvaluescollaborativebuttons&" + url, new AsyncCallback<AjaxData>() { @Override public void onFailure(Throwable caught) { logger.warning("Error values collaboratives buttons"); hideCollaborativeButtons(); } @Override public void onSuccess(AjaxData result) { List<Map<String, String>> valuesCollaborativesButtons = AjaxRequest.getValuesFromResult(result); for (Map<String, String> value : valuesCollaborativesButtons) { int markerid = Integer.parseInt(value.get("markerid")); int type = Integer.parseInt(value.get("type")); String markername = value.get("markername"); String date = value.get("date"); String text = value.get("text"); switch (type) { case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_LIKE: like.addValue(1); like.setFormat(markerid, markername); like.setMarkHTML(); break; case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_DISLIKE: dislike.addValue(1); dislike.setFormat(markerid, markername); dislike.setMarkHTML(); break; case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_QUOTE: quote.addValue(1); quote.setMarkHTML(); quote.setFormat(markerid, markername); quote.setMarkHTML(); break; case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_DISCUSSION: discussion.addValue(1); discussion.setMarkHTML(); discussion.setFormat(markerid, markername); discussion.setMarkHTML(); String[] parts = date.split(" "); String[] hourMinute = parts[1].split(":"); String realDate = hourMinute[0] + ":" + hourMinute[1] + "    " + parts[0]; discussion.addMessage(realDate, markername, text, markerid); break; } } } }); like.setMarkHTML(); dislike.setMarkHTML(); quote.setMarkHTML(); if (getMarkername() != null) { discussion.instanceDialog(); } discussion.setMarkHTML(); } }
From source file:cl.uai.client.rubric.RubricPanel.java
License:Open Source License
/** * Creates the rubric panel/* w ww. j a v a 2s . c om*/ */ public RubricPanel(boolean isPopup) { this.popupInterface = isPopup; mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().rubricpanel()); // Adds the title rubricTitle = new Label(); rubricTitle.addStyleName(Resources.INSTANCE.css().rubrictitle()); // Adds the checkbox rubricFilter = new ListBox(); rubricFilter.addItem(MarkingInterface.messages.ShowAll(), "all"); rubricFilter.addItem(MarkingInterface.messages.ShowMarkingPending(), "unmarked"); rubricFilter.addItem(MarkingInterface.messages.ShowRegradePending(), "regrade"); // rubricFilter.addItem(MarkingInterface.messages.HideRubric(), "hide"); rubricFilter.addStyleName(Resources.INSTANCE.css().rubricfilterselect()); rubricFilter.setSelectedIndex(0); String cookieFilter = Cookies.getCookie("emarking_rubricfilter"); if (cookieFilter != null) { if (cookieFilter.equals("unmarked")) { rubricFilter.setSelectedIndex(1); } else if (cookieFilter.equals("regrade")) { rubricFilter.setSelectedIndex(2); } } rubricFilter.addChangeHandler(new RubricFilterListBoxValueChangeHandler()); // An horizontal panel holds title and checkbox hpanelTitle = new HorizontalPanel(); hpanelTitle.addStyleName(Resources.INSTANCE.css().rubrictitlepanel()); hpanelTitle.add(rubricTitle); hpanelTitle.setCellHorizontalAlignment(rubricTitle, HasHorizontalAlignment.ALIGN_LEFT); hpanelTitle.add(rubricFilter); hpanelTitle.setCellHorizontalAlignment(rubricFilter, HasHorizontalAlignment.ALIGN_RIGHT); hpanelTitle.setCellVerticalAlignment(rubricFilter, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.add(hpanelTitle); generalFeedbackInterface = new GeneralFeedbackInterface(); // Adds the scroll panel containing the rubric table rubricTable = new VerticalPanel(); rubricTable.addStyleName(Resources.INSTANCE.css().rubrictable()); scrollRubric = new ScrollPanel(); if (isPopupInterface()) { scrollRubric.add(rubricTable); mainPanel.add(scrollRubric); } else { mainPanel.add(rubricTable); } initWidget(mainPanel); }