List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable
public FlexTable()
From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java
License:Apache License
private Widget createControlPanel(final DebugEventListener eventListener) { BasicPanel outer = new BasicPanel(); FlexTable table = new FlexTable(); outer.add(table);//from w w w .j a va2 s .c o m // debug output table.setHTML(0, 0, "Debug output "); table.setWidget(0, 1, new Button("enable", new ClickHandler() { public void onClick(ClickEvent event) { Debug.enable(); } })); table.setWidget(0, 2, new Button("disable", new ClickHandler() { public void onClick(ClickEvent event) { Debug.disable(); } })); table.setHTML(1, 0, "Debug console "); table.setWidget(1, 1, new Button("enable", new ClickHandler() { public void onClick(ClickEvent event) { DebugConsole.getInstance().enable(); } })); table.setWidget(1, 2, new Button("disable", new ClickHandler() { public void onClick(ClickEvent event) { DebugConsole.getInstance().disable(); } })); table.setHTML(2, 0, "Event tracing "); table.setWidget(2, 1, new Button("enable", new ClickHandler() { public void onClick(ClickEvent event) { eventListener.enable(true); Debug.println("You can trace any event. Some events are ignored by default"); } })); table.setWidget(2, 2, new Button("disable", new ClickHandler() { public void onClick(ClickEvent event) { eventListener.enable(false); } })); table.setWidget(3, 0, createCheckBoxes()); ((FlexCellFormatter) table.getCellFormatter()).setColSpan(3, 0, 3); return outer; }
From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing //------------------ hue = 0;//from ww w. java 2 s. com saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; HorizontalPanel panel = new HorizontalPanel(); FlexTable table = new FlexTable(); // Add the large slider map slidermap = new SliderMap(this); panel.add(slidermap); panel.setCellWidth(slidermap, "258px"); panel.setCellHeight(slidermap, "258px"); // Add the small slider bar sliderbar = new SliderBar(this); panel.add(sliderbar); panel.setCellWidth(sliderbar, "40px"); panel.setCellHeight(sliderbar, "258px"); // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); colorpreview.setWidth("50px"); colorpreview.setHeight("50px"); DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); // Radio buttons rbHue = new RadioButton("color", "H:"); rbHue.addClickHandler(this); rbSaturation = new RadioButton("color", "S:"); rbSaturation.addClickHandler(this); rbBrightness = new RadioButton("color", "V:"); rbBrightness.addClickHandler(this); rbRed = new RadioButton("color", "R:"); rbRed.addClickHandler(this); rbGreen = new RadioButton("color", "G:"); rbGreen.addClickHandler(this); rbBlue = new RadioButton("color", "B:"); rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable table.setWidget(0, 0, colorpreview); table.getFlexCellFormatter().setColSpan(0, 0, 3); table.setWidget(1, 0, rbHue); table.setWidget(1, 1, tbHue); table.setWidget(1, 2, new HTML("°")); table.setWidget(2, 0, rbSaturation); table.setWidget(2, 1, tbSaturation); table.setText(2, 2, "%"); table.setWidget(3, 0, rbBrightness); table.setWidget(3, 1, tbBrightness); table.setText(3, 2, "%"); table.setWidget(4, 0, rbRed); table.setWidget(4, 1, tbRed); table.setWidget(5, 0, rbGreen); table.setWidget(5, 1, tbGreen); table.setWidget(6, 0, rbBlue); table.setWidget(6, 1, tbBlue); table.setText(7, 0, "#:"); table.setWidget(7, 1, tbHexColor); table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); // First event onClick(rbSaturation); initWidget(panel); }
From source file:ca.aeso.evq.client.widgets.DatePicker.java
License:Apache License
/** * Constructor of the DatePicker class./*www .ja v a 2s . com*/ * */ public DatePicker() { super(true); // hide dialogue box when clicked outside dateTable = new LocaleCalendarUtils(false); dateTable.specialDate(LocaleCalendarUtils.TODAY).setTag(STYLE_TODAY); dateTable.specialDate(LocaleCalendarUtils.SELECTED).setTag(STYLE_SELECTED); grid = new FlexTable(); grid.setWidth("100%"); grid.setStyleName(STYLE_GRID); panel.addStyleName(STYLE_DATE_PICKER); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); drawControlPane(); panel.add(control); // grid operations addDaysOfWeek(); initialGrid(); gridUpdate(); panel.add(grid); // today label today = dateTable.todayCell(); today.setValue(ACTION_TODAY); today.addStyleName(STYLE_CONTROL_TODAY); today.addClickListener(this); enableTodayButton(); super.setWidget(panel); }
From source file:ca.nanometrics.gflot.client.PlotWithOverview.java
License:Open Source License
private Widget createUi() { FlexTable mainPanel = new FlexTable(); mainPanel.setWidget(0, 0, windowPlot); mainPanel.setWidget(1, 0, overviewPlot); overviewPlot.setHeight(DEFAULT_OVERVIEW_HEIGHT); return mainPanel; }
From source file:ca.qc.cegepoutaouais.tge.pige.client.ui.dialog.MyAccountDialog.java
License:Open Source License
private void createTagManagementTab() { TabItem tabItem = new TabItem(messages.myTags()); tabItem.setStyleAttribute("padding", "3px"); tabPanel.add(tabItem);/*from www.j a va 2s . c o m*/ tagFactory = BeanModelLookup.get().getFactory(Tag.class); tagStore = new ListStore<BeanModel>(); addTagTF = new TextField<String>(); addTagTF.setWidth(362); addTagTF.addKeyListener(new KeyListener() { @Override public void componentKeyUp(ComponentEvent event) { if (event.getKeyCode() == KeyCodes.KEY_ENTER) { addNewTag(); } } }); addTagBtn = new Button(messages.add()); addTagBtn.setWidth("100px"); addTagBtn.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.addIcon())); addTagBtn.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent event) { addNewTag(); } }); tagLst = new ListField(); tagLst.setHeight(300); tagLst.setWidth(466); tagLst.setStore(tagStore); tagLst.getListView().getSelectionModel().setSelectionMode(SelectionMode.SINGLE); tagLst.setDisplayField("name"); tagLst.addKeyListener(new KeyListener() { @Override public void componentKeyUp(ComponentEvent event) { if (event.getKeyCode() == KeyCodes.KEY_DELETE) { deleteTag(); } } }); Menu contextMenu = new Menu(); contextMenu.add(new HeaderMenuItem(messages.tagMenu())); MenuItem deleteTagBtn = new MenuItem(messages.delete()); deleteTagBtn.addSelectionListener(new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent event) { deleteTag(); } }); contextMenu.add(deleteTagBtn); tagLst.setContextMenu(contextMenu); UserServiceAsync rpcService = Registry.get(PIGE.USER_SERVICE); rpcService.getAllTag(new AsyncCallback<Set<Tag>>() { @Override public void onSuccess(Set<Tag> tagSet) { for (Tag t : tagSet) { tagStore.add(tagFactory.createModel(t)); } } @Override public void onFailure(Throwable caught) { PIGE.handleException(caught); } }); FlexTable table = new FlexTable(); table.setWidget(0, 0, addTagTF); table.setWidget(0, 1, addTagBtn); table.setWidget(1, 0, tagLst); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.setWidth("466px"); table.getFlexCellFormatter().setWidth(0, 0, "100%"); tabItem.add(table); }
From source file:ca.qc.cegepoutaouais.tge.pige.client.ui.dialog.RoleCEVDialog.java
License:Open Source License
private void buildUI() { setLayout(new RowLayout()); setModal(true);/*from w ww.j a v a 2s. co m*/ setDraggable(true); setCollapsible(false); setClosable(true); setAutoHide(false); setBodyStyle("padding: 3px"); setWidth(465); table = new FlexTable(); nameLbl = new Html(messages.name()); descriptionLbl = new LabelField(messages.description()); manageRoleLbl = new LabelField(messages.manageRole()); manageUserLbl = new LabelField(messages.manageUser()); manageLoanLbl = new LabelField(messages.manageLoan()); manageMessageLbl = new LabelField(messages.manageMessage()); canLoanLbl = new LabelField(messages.canLoan()); browseInventoryLbl = new LabelField(messages.browseInventory()); manageInventoryLbl = new LabelField(messages.manageInventory()); adminInventoryLbl = new LabelField(messages.adminInventory()); appManagementLbl = new LabelField(messages.appManagement()); requireRoleManagerLbl = new LabelField("[Assignation] " + messages.requireRoleManagement()); requiredFieldLbl = new Html(messages.requiredField()); nameLbl.addStyleName("common-form-label"); descriptionLbl.addStyleName("common-form-label"); manageRoleLbl.addStyleName("common-form-label"); manageUserLbl.addStyleName("common-form-label"); manageLoanLbl.addStyleName("common-form-label"); appManagementLbl.addStyleName("common-form-label"); manageMessageLbl.addStyleName("common-form-label"); manageInventoryLbl.addStyleName("common-form-label"); canLoanLbl.addStyleName("common-form-label"); browseInventoryLbl.addStyleName("common-form-label"); adminInventoryLbl.addStyleName("common-form-label"); requireRoleManagerLbl.addStyleName("common-form-label"); requiredFieldLbl.addStyleName("common-label-required-field-note"); KeyListener keyListener = new KeyListener() { @Override public void componentKeyUp(ComponentEvent event) { validate(); } }; nameTF = new TextField(); nameTF.setWidth(235); nameTF.addKeyListener(keyListener); nameTF.setMaxLength(30); nameTF.setEmptyText(messages.requiredField()); nameTF.setAllowBlank(Boolean.FALSE); nameTF.setMaxLength(30); descriptionTA = new TextArea(); descriptionTA.setWidth(235); descriptionTA.setHeight(75); descriptionTA.setMaxLength(1000); manageRoleCBx = new CheckBox(); manageUserCBx = new CheckBox(); manageLoanCBx = new CheckBox(); appManagementCBx = new CheckBox(); manageMessageCBx = new CheckBox(); manageInventoryCBx = new CheckBox(); canLoanCBx = new CheckBox(); browseInventoryCBx = new CheckBox(); //adminInventoryCBx = new CheckBox(); requireRoleManagerCBx = new CheckBox(); FlexCellFormatter fcf = table.getFlexCellFormatter(); int r = 0; table.setWidget(r, 0, nameLbl); table.setWidget(r++, 1, nameTF); table.setWidget(r, 0, descriptionLbl); table.setWidget(r++, 1, descriptionTA); table.setWidget(r, 0, manageRoleLbl); table.setWidget(r++, 1, manageRoleCBx); table.setWidget(r, 0, manageUserLbl); table.setWidget(r++, 1, manageUserCBx); table.setWidget(r, 0, manageLoanLbl); table.setWidget(r++, 1, manageLoanCBx); table.setWidget(r, 0, manageMessageLbl); table.setWidget(r++, 1, manageMessageCBx); table.setWidget(r, 0, canLoanLbl); table.setWidget(r++, 1, canLoanCBx); table.setWidget(r, 0, browseInventoryLbl); table.setWidget(r++, 1, browseInventoryCBx); table.setWidget(r, 0, manageInventoryLbl); table.setWidget(r++, 1, manageInventoryCBx); table.setWidget(r, 0, adminInventoryLbl); //table.setWidget(r++, 1, adminInventoryCBx); table.setWidget(r, 0, appManagementLbl); table.setWidget(r++, 1, appManagementCBx); table.setWidget(r, 0, requireRoleManagerLbl); table.setWidget(r++, 1, requireRoleManagerCBx); fcf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(5, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(6, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(7, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(8, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(9, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(10, 1, HasHorizontalAlignment.ALIGN_LEFT); fcf.setHorizontalAlignment(11, 1, HasHorizontalAlignment.ALIGN_LEFT); add(table); }
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();/* w ww.j a va 2s . c o 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:cc.alcina.framework.gwt.client.gwittir.widget.BoundTableExt.java
License:Open Source License
protected FlexTable createTableImpl() { return new FlexTable(); }
From source file:cc.alcina.framework.gwt.client.gwittir.widget.RadioButtonList.java
License:Apache License
private void render() { fp.clear();// w w w .j ava 2 s .co m checkMap.clear(); table = new FlexTable(); int x = 0, y = 0; for (T o : getValues()) { String displayHtml = renderer.render(o); if (iconRenderer != null) { String imgHtml = AbstractImagePrototype.create(iconRenderer.render(o)).getHTML(); displayHtml = CommonUtils.formatJ( "<span class='radio-button-icon'>%s</span><span class='radio-button-icon-label'>%s</span>", imgHtml, displayHtml); } CheckBox radioButton = createCheckBox(displayHtml); checkMap.put(o, radioButton); table.setWidget(y, x++, radioButton); if (x == getColumnCount()) { x = 0; y++; } radioButton.addClickHandler(this); } fp.add(table); }
From source file:cc.alcina.framework.gwt.client.widget.dialog.LoginDisplayer.java
License:Apache License
public LoginDisplayer() { dialogBox = new GlassDialogBox(); dialogBox.setText("Login"); dialogBox.setAnimationEnabled(true); mainPanel = new FlowPanel(); mainPanel.setStyleName("alcina-Login"); mainPanel.ensureDebugId(AlcinaDebugIds.LOGIN_FORM); this.introWidget = new FlowPanel(); introWidget.setVisible(false);/*w w w.j a v a2s .co m*/ mainPanel.add(introWidget); introWidget.setStyleName("intro"); cancelButton = new Button("Cancel"); okButton = new Button("Login"); okButton.ensureDebugId(AlcinaDebugIds.LOGIN_SUBMIT); table = new FlexTable(); table.setWidth("100%"); table.setCellSpacing(2); this.usernameLabel = new Label("Username: "); table.setWidget(0, 0, usernameLabel); nameBox = new TextBox(); WidgetUtils.disableTextBoxHelpers(nameBox); nameBox.ensureDebugId(AlcinaDebugIds.LOGIN_USERNAME); table.setWidget(0, 1, nameBox); table.setWidget(1, 0, new Label("Password: ")); pwdBox = new PasswordTextBox(); WidgetUtils.disableTextBoxHelpers(pwdBox); pwdBox.ensureDebugId(AlcinaDebugIds.LOGIN_PASSWORD); table.setWidget(1, 1, pwdBox); pwdBox.addKeyPressHandler(new EnterAsClickKeyboardListener(pwdBox, okButton)); nameBox.addKeyPressHandler(new EnterAsClickKeyboardListener(nameBox, okButton)); rememberMeBox = new CheckBox(); rememberMeBox.setValue(true); table.setWidget(2, 0, rememberMeBox); table.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.setWidget(2, 1, new Label("Remember me on this computer")); statusLabel = new Label("Logging in"); statusLabel.setVisible(false); table.setWidget(4, 1, statusLabel); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); hPanel.setSpacing(5); hPanel.add(okButton); okButton.addStyleName("marginRight10"); hPanel.add(cancelButton); table.setWidget(3, 1, hPanel); mainPanel.add(table); dialogBox.setWidget(mainPanel); }