List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellHorizontalAlignment
public void setCellHorizontalAlignment(IsWidget w, HorizontalAlignmentConstant align)
From source file:asquare.gwt.debug.client.DebugConsole.java
License:Apache License
/** * Creates the console, installs the enabler key listener. * The console is not yet attached to the DOM. *//*from w w w. j a v a 2s . c om*/ protected DebugConsole() { super(false, false); setStyleName("tk-DebugConsole"); DOM.setStyleAttribute(getElement(), "border", "solid black 1px"); DOM.setStyleAttribute(getElement(), "background", "white"); setHTML("<div style='margin: 2px; padding: 3px; background-color: rgb(195, 217, 255); font-weight: bold; font-size: smaller; cursor: default;'>Debug Console</div>"); m_content.setWordWrap(false); DOM.setStyleAttribute(m_content.getElement(), "margin", "2px"); DOM.setStyleAttribute(m_content.getElement(), "padding", "3px"); VerticalPanel outer = new VerticalPanel(); ScrollPanel scrollPanel = new ScrollPanel(m_content); scrollPanel.setAlwaysShowScrollBars(true); scrollPanel.setSize("40em", "20em"); outer.add(scrollPanel); HorizontalPanel controls = new HorizontalPanel(); DOM.setStyleAttribute(controls.getElement(), "margin", "2px"); controls.setWidth("100%"); outer.add(controls); HorizontalPanel controlsLeft = new HorizontalPanel(); controls.add(controlsLeft); controls.setCellHorizontalAlignment(controlsLeft, HorizontalPanel.ALIGN_LEFT); HorizontalPanel controlsRight = new HorizontalPanel(); controls.add(controlsRight); controls.setCellHorizontalAlignment(controlsRight, HorizontalPanel.ALIGN_RIGHT); final Button toggleDebugButton = new Button("Toggle Debug"); DOM.setElementProperty(toggleDebugButton.getElement(), "title", "Toggles output of debug statements"); controlsLeft.add(toggleDebugButton); updateDisableButtonText(); DOM.setElementProperty(m_disableButton.getElement(), "title", "Prevents this console from appearing when debug statements are printed"); controlsLeft.add(m_disableButton); final Button clearButton = new Button("Clear"); DOM.setElementProperty(clearButton.getElement(), "title", "Clears all messages in the console"); controlsRight.add(clearButton); final Button hideButton = new Button("Hide"); DOM.setStyleAttribute(hideButton.getElement(), "textAlign", "right"); controlsRight.add(hideButton); setWidget(outer); m_left = Window.getClientWidth() / 2 - 640 / 2; m_top = Window.getClientHeight() / 2; m_enabler.install(); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (sender == clearButton) { clearMessages(); } else if (sender == hideButton) { hide(); } else if (sender == m_disableButton) { disable(); } else if (sender == toggleDebugButton) { if (Debug.isEnabled()) { Debug.disable(); } else { Debug.enable(); } } else { assert false; } } }; toggleDebugButton.addClickHandler(handler); m_disableButton.addClickHandler(handler); clearButton.addClickHandler(handler); hideButton.addClickHandler(handler); sinkEvents(Event.ONMOUSEDOWN); preventSelectionInIE(getElement()); }
From source file:cl.uai.client.page.EditMarkDialog.java
License:Open Source License
/** * Creates a comment dialog at a specific position * /*from w ww .j av a2 s . co m*/ * @param posx Top position for the dialog * @param posy Left position for the dialog * @param level An optional rubric level in case we are editing one */ public EditMarkDialog(int posx, int posy, int level, int regradeid) { super(true, false); this.regradeId = regradeid; this.levelId = level; Level lvl = MarkingInterface.submissionData.getLevelById(levelId); if (EMarkingConfiguration.getKeywords() != null && EMarkingConfiguration.getKeywords().length() > 0) { logger.fine("Keywords: " + EMarkingConfiguration.getKeywords()); } if (!EMarkingConfiguration.getKeywords().equals("") && (level > 0 || regradeid > 0)) { feedbackArray = new ArrayList<FeedbackObject>(); feedbackPanel = new FeedbackInterface(); feedbackPanel.setParent(this); } else { simplePanel = true; } superPanel = new HorizontalPanel(); superPanel.addStyleName(Resources.INSTANCE.css().feedbackdialog()); feedbackForStudent = new VerticalPanel(); feedbackForStudent.addStyleName(Resources.INSTANCE.css().feedbackforstudent()); feedbackSummary = new ScrollPanel(feedbackForStudent); feedbackSummary.addStyleName(Resources.INSTANCE.css().feedbacksummary()); mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialog()); // Adds the CSS style and other settings this.addStyleName(Resources.INSTANCE.css().commentdialog()); this.setAnimationEnabled(true); this.setGlassEnabled(true); bonusTxt = new TextBox(); bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslist()); this.levelsList = new ListBox(); this.levelsList.addStyleName(Resources.INSTANCE.css().levelslist()); this.levelsList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int levelid = Integer.parseInt(levelsList.getValue(levelsList.getSelectedIndex())); levelId = levelid; Level lvl = MarkingInterface.submissionData.getLevelById(levelId); setBonus(lvl.getBonus()); } }); // If there's a rubric level we should edit a Mark // otherwise we are just editing its comment if (this.levelId == 0) { this.setHTML(MarkingInterface.messages.AddEditComment()); } else { this.setHTML(MarkingInterface.messages.AddEditMark() + "<br/>" + lvl.getCriterion().getDescription()); } // Position the dialog if (simplePanel) { this.setPopupPosition(posx, posy); } else { // The Dialog is more big, so we need to fix the position this.setPopupPosition((int) (Window.getClientWidth() * 0.08), (int) (Window.getClientHeight() * 0.15)); } if (this.levelId > 0) { loadLevelsList(); HorizontalPanel hpanelLevels = new HorizontalPanel(); hpanelLevels.setWidth("100%"); Label messages = new Label(MarkingInterface.messages.Level()); hpanelLevels.add(messages); hpanelLevels.add(levelsList); hpanelLevels.setCellHorizontalAlignment(levelsList, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelLevels); mainPanel.setCellHorizontalAlignment(hpanelLevels, HasHorizontalAlignment.ALIGN_RIGHT); } // Save button Button btnSave = new Button(MarkingInterface.messages.Save()); btnSave.addStyleName(Resources.INSTANCE.css().btnsave()); btnSave.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (levelId > 0 && !bonusIsValid()) { Window.alert(MarkingInterface.messages.InvalidBonusValue()); return; } cancelled = false; hide(); } }); // Cancel button Button btnCancel = new Button(MarkingInterface.messages.Cancel()); btnSave.addStyleName(Resources.INSTANCE.css().btncancel()); btnCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { cancelled = true; hide(); } }); // The comment text box TextArea txt = new TextArea(); txt.setVisibleLines(5); txt.getElement().getStyle().setMarginBottom(5, Unit.PT); txtComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt); txtComment.setAutoSelectEnabled(false); txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestbox()); HorizontalPanel hpanelComment = new HorizontalPanel(); hpanelComment.setWidth("100%"); hpanelComment.add(new Label(MarkingInterface.messages.Comment())); hpanelComment.add(txtComment); hpanelComment.setCellHorizontalAlignment(txtComment, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelComment); mainPanel.setCellHorizontalAlignment(hpanelComment, HasHorizontalAlignment.ALIGN_RIGHT); // If the rubric level is not null then create the bonus list and add it to the dialog if (this.levelId > 0) { setBonus(lvl.getBonus()); HorizontalPanel hpanelBonus = new HorizontalPanel(); hpanelBonus.setWidth("100%"); hpanelBonus.add(new Label(MarkingInterface.messages.SetBonus())); hpanelBonus.add(bonusTxt); hpanelBonus.setCellHorizontalAlignment(bonusTxt, HasHorizontalAlignment.ALIGN_RIGHT); if (EMarkingConfiguration.isFormativeFeedbackOnly()) { hpanelBonus.setVisible(false); } mainPanel.add(hpanelBonus); mainPanel.setCellHorizontalAlignment(hpanelBonus, HasHorizontalAlignment.ALIGN_RIGHT); } // The regrade comment text box txt = new TextArea(); txt.setVisibleLines(5); txt.getElement().getStyle().setMarginBottom(5, Unit.PT); txtRegradeComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt); if (this.regradeId > 0) { mainPanel.add(new HTML("<hr>")); mainPanel.add(new Label(MarkingInterface.messages.Regrade())); // Add the textbox HorizontalPanel hpanelRegradeComment = new HorizontalPanel(); hpanelRegradeComment.setWidth("100%"); hpanelRegradeComment.add(new Label(MarkingInterface.messages.RegradeComment())); hpanelRegradeComment.add(txtRegradeComment); hpanelRegradeComment.setCellHorizontalAlignment(txtRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelRegradeComment); mainPanel.setCellHorizontalAlignment(hpanelRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT); } // Add buttons HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(2); hpanel.setWidth("100%"); hpanel.add(btnSave); hpanel.add(btnCancel); hpanel.setCellWidth(btnSave, "100%"); hpanel.setCellWidth(btnCancel, "0px"); hpanel.setCellHorizontalAlignment(btnCancel, HasHorizontalAlignment.ALIGN_RIGHT); hpanel.setCellHorizontalAlignment(btnSave, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanel); mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT); if (simplePanel) { // No feedback this.setWidget(mainPanel); } else { // Remove CSS Style mainPanel.removeStyleName(Resources.INSTANCE.css().editmarkdialog()); mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialogWithFeedback()); bonusTxt.removeStyleName(Resources.INSTANCE.css().bonuslist()); bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslistWithFeedback()); this.levelsList.removeStyleName(Resources.INSTANCE.css().levelslist()); this.levelsList.addStyleName(Resources.INSTANCE.css().levelslistWithFeedback()); txtComment.removeStyleName(Resources.INSTANCE.css().editmarksuggestbox()); txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestboxWithFeedback()); // Add feedback panel mainPanel.add(new HTML("<h4>Feedback</h4>")); mainPanel.add(feedbackSummary); superPanel.add(mainPanel); superPanel.add(feedbackPanel); this.setWidget(superPanel); } }
From source file:cl.uai.client.page.RequestRegradeDialog.java
License:Open Source License
/** * Creates a comment dialog at a specific position *//*w ww . j a va 2 s.c o m*/ public RequestRegradeDialog() { super(true, false); this.addStyleName(Resources.INSTANCE.css().requestregradedialog()); this.mainPanel = new VerticalPanel(); this.mainPanel.setWidth("100%"); motive = new ListBox(); motive.setWidth("390px"); motive.addItem(MarkingInterface.messages.Select(), "0"); for (int motiveId : EMarkingConfiguration.getRegradeMotives().keySet()) { String motiveName = EMarkingConfiguration.getRegradeMotives().get(motiveId); motive.addItem(motiveName, Integer.toString(motiveId)); } HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.add(new Label(MarkingInterface.messages.Motive())); hpanel.add(motive); hpanel.setCellHorizontalAlignment(motive, HasAlignment.ALIGN_RIGHT); this.mainPanel.add(hpanel); comment = new TextArea(); comment.setVisibleLines(10); comment.setWidth("380px"); comment.setHeight("150px"); hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.add(new Label(MarkingInterface.messages.CommentForMarker())); hpanel.add(comment); hpanel.setCellHorizontalAlignment(comment, HasAlignment.ALIGN_RIGHT); this.mainPanel.add(hpanel); // Adds the CSS style and other settings this.addStyleName(Resources.INSTANCE.css().commentdialog()); this.setAnimationEnabled(true); this.setGlassEnabled(true); this.setHTML(MarkingInterface.messages.RequestRegrade()); // Save button Button btnSave = new Button(MarkingInterface.messages.Save()); btnSave.addStyleName(Resources.INSTANCE.css().btnsave()); btnSave.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (comment.getText().length() > 500) { Window.alert(MarkingInterface.messages.RequestMaximumLength(comment.getText().length())); return; } else if (motive.isItemSelected(0)) { Window.alert(MarkingInterface.messages.MotiveIsMandatory()); return; } else { cancelled = false; hide(); } } }); // Cancel button Button btnCancel = new Button(MarkingInterface.messages.Cancel()); btnSave.addStyleName(Resources.INSTANCE.css().btncancel()); btnCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { cancelled = true; hide(); } }); // Add buttons hpanel = new HorizontalPanel(); hpanel.add(btnSave); hpanel.add(btnCancel); mainPanel.add(hpanel); mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT); this.setWidget(mainPanel); }
From source file:com.apress.progwt.client.college.gui.CollegeEntry.java
License:Apache License
public CollegeEntry(User user, Application application, ServiceCache serviceCache, MyRankings myRankings) { this.application = application; this.serviceCache = serviceCache; this.user = user; this.myRankings = myRankings; collegeNameLabel = new Label(application.getSchool().getName()); collegeNameLabel.setStylePrimaryName("TC-CollegeLabel"); rankLabel = new Label(); rankLabel.setStylePrimaryName("TC-CollegeEntry-RankLabel"); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(rankLabel);/*from ww w . j av a 2s .c om*/ mainPanel.add(collegeNameLabel); mainPanel.setCellWidth(rankLabel, "30px"); DisclosurePanel disclosurePanel = new DisclosurePanel(" "); disclosurePanel.add(getInfoPanel()); mainPanel.add(disclosurePanel); mainPanel.setCellHorizontalAlignment(disclosurePanel, HorizontalPanel.ALIGN_RIGHT); mainPanel.setStylePrimaryName("TC-CollegeEntry"); initWidget(mainPanel); }
From source file:com.audata.client.AuDoc.java
License:Open Source License
/** * Builds the menu bar panel// ww w . j a v a2 s . c om * @return HorizontalPanel containing the menu bar */ private HorizontalPanel buildMenu() { HorizontalPanel menu = new HorizontalPanel(); menu.addStyleName("menu"); menu.setWidth("100%"); menu.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); menu.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM); menu.setSpacing(4); CaptionButton cb = new CaptionButton(); cb.setImageUrl("images/48x48/home.gif"); cb.setCaptionText(LANG.home_Text()); cb.setOrientation(DockPanel.SOUTH); cb.addClickListener(new MenuClickListener(this, AuDoc.SECTION_HOME)); cb.setTitle(LANG.home_title_Text()); menu.add(cb); CaptionButton cb_1 = new CaptionButton(); cb_1.setImageUrl("images/48x48/search.gif"); cb_1.setCaptionText(LANG.search_Text()); cb_1.setOrientation(DockPanel.SOUTH); cb_1.addClickListener(new MenuClickListener(this, AuDoc.SECTION_SEARCH)); cb_1.setTitle(LANG.search_title_Text()); menu.add(cb_1); CaptionButton cb_2 = new CaptionButton(); cb_2.addCaptionStyleName("nowrap"); cb_2.setOrientation(DockPanel.SOUTH); cb_2.setImageUrl("images/48x48/newrec.gif"); cb_2.setCaptionText(LANG.newrec_Text()); cb_2.addClickListener(new MenuClickListener(this, AuDoc.SECTION_NEW)); cb_2.setTitle(LANG.newrec_title_Text()); menu.add(cb_2); CaptionButton cb_3 = new CaptionButton(); cb_3.setImageUrl("images/48x48/reports.gif"); cb_3.setCaptionText(LANG.report_Text()); cb_3.setOrientation(DockPanel.SOUTH); cb_3.addClickListener(new MenuClickListener(this, AuDoc.SECTION_REPORT)); cb_3.setTitle(LANG.report_title_Text()); menu.add(cb_3); CaptionButton cb_4 = new CaptionButton(); cb_4.setImageUrl("images/48x48/checkout.gif"); cb_4.setCaptionText(LANG.rapid_title_Text()); cb_4.setOrientation(DockPanel.SOUTH); cb_4.addClickListener(new MenuClickListener(this, AuDoc.SECTION_RAPID)); cb_4.setTitle(LANG.rapid_title_Text()); menu.add(cb_4); this.adminButton = new CaptionButton(); this.adminButton.setImageUrl("images/48x48/admin.gif"); this.adminButton.setCaptionText(LANG.admin_Text()); this.adminButton.setOrientation(DockPanel.SOUTH); this.adminButton.setVisible(false); this.adminButton.addClickListener(new MenuClickListener(this, AuDoc.SECTION_ADMIN)); this.adminButton.setTitle(LANG.admin_title_Text()); menu.add(this.adminButton); menu.setCellWidth(this.adminButton, "100%"); menu.setCellHorizontalAlignment(this.adminButton, HasAlignment.ALIGN_RIGHT); return menu; }
From source file:com.audata.client.record.RecordListPanel.java
License:Open Source License
public RecordListPanel(String subtitle, JSONArray records, String method, JSONArray params, String uuid, String criteria) {/* w w w . j av a 2 s . co m*/ this.main = new VerticalPanel(); this.count = 0; this.subtitle = subtitle; this.method = method; this.params = params; this.uuid = uuid; this.setSize("100%", "100%"); this.main.setSize("100%", "100%"); this.main.setSpacing(4); HorizontalPanel title = new HorizontalPanel(); title.setSpacing(4); title.setWidth("100%"); Label l = new Label(LANG.records_Text()); l.addStyleName("audoc-sectionTitle"); title.add(l); title.setCellHorizontalAlignment(l, HasAlignment.ALIGN_LEFT); this.countLabel = new Label(this.subtitle + "\n " + LANG.rec_count_Text() + ": " + this.count); this.countLabel.addStyleName("audoc-sectionSubTitle"); title.add(this.countLabel); title.setCellHorizontalAlignment(this.countLabel, HasAlignment.ALIGN_RIGHT); this.main.add(title); this.getCount(); if (criteria != null) { Label critLabel = new Label(LANG.criteria_Text() + ": [" + criteria + "]"); critLabel.setWidth("100%"); critLabel.addStyleName("audoc-criteria"); this.main.add(critLabel); } HorizontalPanel hp = new HorizontalPanel(); this.main.add(hp); hp.setVerticalAlignment(HasAlignment.ALIGN_TOP); hp.setSize("100%", "100%"); hp.setSpacing(4); VerticalPanel vp = new VerticalPanel(); //vp.setSpacing(4); vp.setSize("100%", "100%"); vp.add(this.buildMenu()); String template = "<span class=\"audoc-record-title\">#0 [#1]</span><br/>" + "<span class=\"audoc-record-class\">#2</span><br/>" + "<span class=\"audoc-record-cot\">" + LANG.with_Text() + ": #3<span>"; this.rList = new HTMLButtonList("images/48x48/rectypes.gif", template, true); this.rList.addStyleName("audoc-recList"); vp.add(this.rList); this.rList.setSize("100%", "90%"); vp.setCellHeight(this.rList, "100%"); hp.add(vp); this.addRecords(records); Panel cPanel = this.buildCommands(); hp.add(cPanel); //cPanel.setWidth("150px"); hp.setCellWidth(cPanel, "250px"); hp.setCellWidth(this.rList, "100%"); this.add(main); this.addKeyboardListener(this); }
From source file:com.audata.client.search.SearchPanel.java
License:Open Source License
public SearchPanel(AuDoc audoc, ArrayList criteria) { this.audoc = audoc; if (criteria != null) { this.searchTerms = criteria; } else {/* w ww .j a v a 2 s.co m*/ if (AuDoc.state.containsKey("Search")) { this.searchTerms = (ArrayList) AuDoc.state.getItem("Search"); } else { this.searchTerms = new ArrayList(); } } this.setSize("100%", "100%"); this.setSpacing(4); Label title = new Label(LANG.search_Text()); title.addStyleName("audoc-sectionTitle"); this.add(title); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(4); hp.setSize("100%", "100%"); this.fieldsTree = new Tree(); this.fieldsTree.addTreeListener(this); //this.fieldsTree.setSize("100%", "100%"); this.fieldsTree.setHeight("90%"); this.fieldsTree.addStyleName("audoc-fieldTree"); hp.add(this.fieldsTree); this.buildSections(); this.getUDFs(); this.addStdFields(); VerticalPanel form = new VerticalPanel(); form.addStyleName("audoc-searchForm"); //form.setSize("100%","100%"); form.setWidth("250px"); form.setSpacing(4); HorizontalPanel fieldRow = new HorizontalPanel(); fieldRow.setSpacing(4); Label fieldLabel = new Label(LANG.field_Text()); this.fieldName = new Label(); this.fieldName.addStyleName("bold"); fieldRow.add(fieldLabel); fieldRow.add(this.fieldName); fieldRow.setCellWidth(fieldLabel, "100px"); fieldRow.setCellHorizontalAlignment(fieldLabel, HasAlignment.ALIGN_LEFT); form.add(fieldRow); this.valuePanel = new HorizontalPanel(); this.valuePanel.setSpacing(4); Label valueLabel = new Label(LANG.criteria_Text()); TextBox value = new TextBox(); this.valuePanel.add(valueLabel); this.valuePanel.add(value); this.valuePanel.setCellWidth(valueLabel, "100px"); this.valuePanel.setCellHorizontalAlignment(valueLabel, HasAlignment.ALIGN_LEFT); form.add(this.valuePanel); HorizontalPanel andOr = new HorizontalPanel(); andOr.setSpacing(4); this.and = new RadioButton("andOr", LANG.and_Text()); this.and.setChecked(true); this.or = new RadioButton("andOr", LANG.or_Text()); andOr.add(this.and); andOr.add(this.or); form.add(andOr); HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(4); this.add = new Button(LANG.add_Text()); this.add.addClickListener(this); buttons.add(this.add); this.clear = new Button(LANG.clear_Text()); this.clear.addClickListener(this); buttons.add(this.clear); form.add(buttons); this.criteria = new ListBox(); this.criteria.setVisibleItemCount(10); this.criteria.setWidth("100%"); form.add(this.criteria); HorizontalPanel buttons2 = new HorizontalPanel(); buttons2.setSpacing(4); this.search = new Button(LANG.search_Text()); this.search.addClickListener(this); buttons2.add(this.search); this.save = new Button(LANG.save_Text()); this.save.addClickListener(this); buttons2.add(this.save); form.add(buttons2); hp.add(form); hp.setCellHeight(this.fieldsTree, "100%"); this.add(hp); this.paintCriteria(); }
From source file:com.audata.client.trays.TrayDialog.java
License:Open Source License
public TrayDialog(ArrayList records) { this.setText(LANG.add_to_tray_Text()); this.records = records; String template = "<span class=\"traylist-title\">#0</span>"; this.trays = new HTMLButtonList("images/48x48/tray.gif", template, false); this.trays.addStyleName("audoc-trays"); this.addBut = new Button(LANG.add_Text()); this.addBut.addClickListener(this); this.cancel = new Button(LANG.cancel_Text()); this.cancel.addClickListener(this); this.newText = new TextBox(); this.newBut = new Button(LANG.new_Text()); this.newBut.addClickListener(this); this.getTrays(); VerticalPanel main = new VerticalPanel(); main.setSpacing(3);/*from w w w . ja v a2s .c o m*/ main.add(this.trays); HorizontalPanel p = new HorizontalPanel(); p.add(new Label("New tray:")); p.setSpacing(3); p.add(this.newText); p.add(this.newBut); p.setCellHorizontalAlignment(this.addBut, HasAlignment.ALIGN_RIGHT); main.add(p); HorizontalPanel p2 = new HorizontalPanel(); p2.setSpacing(3); p2.add(this.addBut); p2.add(this.cancel); main.add(p2); main.setCellHorizontalAlignment(p2, HasAlignment.ALIGN_RIGHT); this.setWidget(main); }
From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleSiteManager.java
public void openEditor(final Editor e) { // store which tab is which instanceId openedEditors.add(e);/*ww w . j a v a 2 s .c o m*/ HorizontalPanel panel = new HorizontalPanel(); Label close = new Label(" "); close.setStyleName("close"); close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent paramClickEvent) { Platform.getInstance().getEditorRegistry().closeEditor(e.getEditorId(), e.getInstanceId()); } }); Label title = new Label(e.getTitle()); title.setStyleName("tabTitle"); Label leftImg = new Label(""); leftImg.setStyleName("leftImg"); Label rightImg = new Label(""); rightImg.setStyleName("rightImg"); panel.add(leftImg); panel.add(title); panel.add(close); panel.add(rightImg); panel.setCellHorizontalAlignment(leftImg, HorizontalPanel.ALIGN_RIGHT); panel.setCellHorizontalAlignment(title, HorizontalPanel.ALIGN_RIGHT); panel.setCellHorizontalAlignment(close, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(rightImg, HorizontalPanel.ALIGN_RIGHT); ScrollPanel sp = new ScrollPanel(e.asWidget()); editor.add(sp); // editor.add(e.asWidget(), g); // show editor panels only if there is at least one editor opened. if (!openedEditors.isEmpty()) { editor.setVisible(true); } }
From source file:com.chinarewards.gwt.license.client.ui.DialogBox.java
/** * Creates an empty dialog box specifying its "auto-hide" property. It * should not be shown until its child widget has been added using * {@link #add(Widget)}./*from www . j av a2s . c om*/ * * @param autoHide * <code>true</code> if the dialog should be automatically hidden * when the user clicks outside of it * @param modal * <code>true</code> if keyboard and mouse events for widgets not * contained by the dialog should be ignored */ public DialogBox(boolean autoHide, boolean modal) { super(autoHide, modal); // Add the caption to the top row of the decorator panel. We need to // logically adopt the caption so we can catch mouse events. Element td = getCellElement(0, 1); HorizontalPanel panel = new HorizontalPanel(); /** * About the icon to close the window. */ // <div class="close-wrap"><span class="box-title-sep"></span><span class="box-close" onclick="this.parentNode.parentNode.parentNode.style.display='none'"></span></div> cross = new Span(); cross.setStyleName("box-close"); CrossHandler crossHandler = new CrossHandler(); cross.addClickHandler(crossHandler); cross.addMouseDownHandler(crossHandler); cross.addMouseOverHandler(crossHandler); cross.addMouseOutHandler(crossHandler); // Label left = new Label(""); // left.setStyleName("left"); // Label right = new Label(""); // right.setStyleName("right"); // panel.add(left); panel.add(captionHtml); panel.add(cross); // panel.add(right); // panel.setCellWidth(left, "10px"); // panel.setCellHorizontalAlignment(left, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(captionHtml, HorizontalPanel.ALIGN_LEFT); panel.setCellHorizontalAlignment(cross, HorizontalPanel.ALIGN_RIGHT); // panel.setCellHorizontalAlignment(right, HorizontalPanel.ALIGN_RIGHT); panel.setWidth("100%"); caption.add(panel); DOM.appendChild(td, caption.getElement()); adopt(caption); caption.setStyleName("Caption"); // Set the style name setStyleName(DEFAULT_STYLENAME); windowWidth = Window.getClientWidth(); clientLeft = Document.get().getBodyOffsetLeft(); clientTop = Document.get().getBodyOffsetTop(); MouseHandler mouseHandler = new MouseHandler(); addDomHandler(mouseHandler, MouseDownEvent.getType()); addDomHandler(mouseHandler, MouseUpEvent.getType()); addDomHandler(mouseHandler, MouseMoveEvent.getType()); addDomHandler(mouseHandler, MouseOverEvent.getType()); addDomHandler(mouseHandler, MouseOutEvent.getType()); }