List of usage examples for com.google.gwt.user.client.ui CheckBox CheckBox
protected CheckBox(Element elem)
From source file:com.ikon.frontend.client.widget.security.SecurityPopup.java
License:Open Source License
/** * Security popup/*from ww w .j a va 2 s . c o m*/ */ public SecurityPopup() { // Establishes auto-close when click outside super(false, true); status = new Status(); vPanel = new VerticalPanel(); sp = new SimplePanel(); securityPanel = new SecurityPanel(); recursive = new CheckBox(Main.i18n("security.recursive")); close = new Button(Main.i18n("button.close"), new ClickHandler() { @Override public void onClick(ClickEvent event) { Main.get().mainPanel.desktop.browser.tabMultiple.securityRefresh(); hide(); } }); change = new Button(Main.i18n("button.change"), new ClickHandler() { @Override public void onClick(ClickEvent event) { final boolean recursiveChecked = recursive.getValue(); if (!recursiveChecked) { Main.get().securityPopup.status.setFlag_update(); } List<Map<String, Integer>> userGrants = securityPanel.securityUser.getNewGrants(); List<Map<String, Integer>> roleGrants = securityPanel.securityRole.getNewGrants(); Map<String, Integer> addUsers = userGrants.get(0); Map<String, Integer> revokeUsers = userGrants.get(1); Map<String, Integer> addRoles = roleGrants.get(0); Map<String, Integer> revokeRoles = roleGrants.get(1); authService.changeSecurity(path, addUsers, revokeUsers, addRoles, revokeRoles, recursiveChecked, new AsyncCallback<Object>() { @Override public void onSuccess(Object result) { if (!recursiveChecked) { Main.get().securityPopup.status.unsetFlag_update(); Main.get().mainPanel.desktop.browser.tabMultiple.securityRefresh(); } } @Override public void onFailure(Throwable caught) { if (!recursiveChecked) { Main.get().securityPopup.status.unsetFlag_update(); } Main.get().showError("changeSecurity", caught); } }); if (recursiveChecked) { Timer timer = new Timer() { @Override public void run() { Main.get().mainPanel.desktop.browser.tabMultiple.securityRefresh(); } }; timer.schedule(200); } hide(); } }); hPanel = new HorizontalPanel(); hPanel.add(close); sp.setHeight("4"); vPanel.add(sp); vPanel.add(securityPanel); vPanel.add(recursive); vPanel.add(hPanel); vPanel.add(Util.vSpace("5")); vPanel.setCellHeight(sp, "4"); vPanel.setCellHeight(hPanel, "25"); vPanel.setCellHorizontalAlignment(securityPanel, VerticalPanel.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER); vPanel.setCellVerticalAlignment(hPanel, VerticalPanel.ALIGN_MIDDLE); vPanel.setWidth(String.valueOf(width)); close.setStyleName("okm-NoButton"); change.setStyleName("okm-ChangeButton"); status.setStyleName("okm-StatusPopup"); super.hide(); setWidget(vPanel); }
From source file:com.ikon.frontend.client.widget.upload.FancyFileUpload.java
License:Open Source License
/** * FancyFileUpload.// w w w. j a v a2s .c o m */ public FancyFileUpload() { // Create a new upload display widget uploadItem = new UploadDisplay(); // Add the new widget to the panel. mainPanel.add(uploadItem); // Adds error panel, whem user select notify but not select any user errorNotify = new HTML(Main.i18n("fileupload.label.must.select.users")); errorNotify.setWidth("370"); errorNotify.setVisible(false); errorNotify.setStyleName("fancyfileupload-failed"); mainPanel.add(errorNotify); // Adds version comment versionHTMLBR = new HTML("<br/>"); mainPanel.add(versionHTMLBR); versionComment = new TextArea(); versionComment.setWidth("375"); versionComment.setHeight("50"); versionComment.setName("comment"); versionComment.setStyleName("okm-TextArea"); versionCommentText = new HTML(Main.i18n("fileupload.label.comment")); // TODO This is a workaround for a Firefox 2 bug // http://code.google.com/p/google-web-toolkit/issues/detail?id=891 // Table for solve some visualization problems versionCommentScrollPanel = new ScrollPanel(versionComment); versionCommentScrollPanel.setAlwaysShowScrollBars(false); versionCommentScrollPanel.setSize("100%", "100%"); vVersionCommentPanel.add(versionCommentText); vVersionCommentPanel.add(versionCommentScrollPanel); mainPanel.add(vVersionCommentPanel); // Adds unzip file importZip = new CheckBox(Main.i18n("fileupload.label.importZip")); importZip.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (importZip.getValue()) { notifyToUser.setValue(false); vNotifyPanel.setVisible(false); } } }); importZip.setName("importZip"); hUnzipPanel = new HorizontalPanel(); hUnzipPanel.add(importZip); mainPanel.add(new HTML("<br/>")); mainPanel.add(hUnzipPanel); // Adds the notify checkbox users = new TextBox(); users.setName("users"); users.setVisible(false); roles = new TextBox(); roles.setName("roles"); roles.setVisible(false); notifyToUser = new CheckBox(Main.i18n("fileupload.label.users.notify")); notifyToUser.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (notifyToUser.getValue()) { vNotifyPanel.setVisible(true); importZip.setValue(false); // TODO:Solves minor bug with IE if (Util.getUserAgent().startsWith("ie")) { notifyPanel.tabPanel.setWidth("374"); notifyPanel.tabPanel.setWidth("375"); notifyPanel.correcIEBug(); } } else { errorNotify.setVisible(false); vNotifyPanel.setVisible(false); } } }); notifyToUser.setName("notify"); hNotifyPanel = new HorizontalPanel(); hNotifyPanel.add(notifyToUser); mainPanel.add(hNotifyPanel); mainPanel.add(new HTML("<br/>")); // The notify user tables message = new TextArea(); commentTXT = new HTML(Main.i18n("fileupload.label.notify.comment")); message.setName("message"); message.setSize("375", "60"); message.setStyleName("okm-TextArea"); vNotifyPanel = new VerticalPanel(); vNotifyPanel.add(commentTXT); // TODO This is a workaround for a Firefox 2 bug // http://code.google.com/p/google-web-toolkit/issues/detail?id=891 messageScroll = new ScrollPanel(message); messageScroll.setAlwaysShowScrollBars(false); vNotifyPanel.add(messageScroll); vNotifyPanel.add(new HTML("<br/>")); vNotifyPanel.add(notifyPanel); vNotifyPanel.add(new HTML("<br/>")); mainPanel.add(users); mainPanel.add(roles); mainPanel.add(vNotifyPanel); // Set align to panels mainPanel.setCellHorizontalAlignment(hNotifyPanel, HorizontalPanel.ALIGN_LEFT); mainPanel.setCellHorizontalAlignment(hUnzipPanel, HorizontalPanel.ALIGN_LEFT); mainPanel.setCellHorizontalAlignment(vNotifyPanel, HorizontalPanel.ALIGN_CENTER); mainPanel.setCellHorizontalAlignment(vVersionCommentPanel, HorizontalPanel.ALIGN_CENTER); // Initialize users getAllUsers(); // Initialize the widget. initWidget(mainPanel); }
From source file:com.mcherm.zithiacharsheet.client.SettableBooleanField.java
License:Apache License
public SettableBooleanField(String text, final SettableBooleanValue value) { final CheckBox checkBox = new CheckBox(text); checkBox.setValue(value.getValue()); disposer.observe(value, new Observer() { public void onChange() { checkBox.setValue(value.getValue()); }//from w w w .ja v a 2 s . co m }); checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { value.setValue(event.getValue()); } }); this.add(checkBox); }
From source file:com.metadot.book.connectr.client.FriendList.java
License:Apache License
private void displayFriends(List<FriendSummaryDTO> friends) { // first sort the friends list alphabetically on name sortFriendSummaryDTO(friends);// w w w.j a va 2s.c o m friendsTable.clear(); int i = 0; for (final FriendSummaryDTO friend : friends) { CheckBox checkBoxName = new CheckBox(truncateLongName(friend.getDisplayName())); final Image propertyImg = new Image(GlobalResources.RESOURCE.propertyButton()); propertyImg.setStyleName("pointer"); propertyImg.addClickHandler(new ShowFriendPopupPanel(friend, propertyImg)); friendsTable.setWidget(i, 0, checkBoxName); friendsTable.setWidget(i, 1, propertyImg); friendsTable.getCellFormatter().addStyleName(i, 0, "friendNameInList"); i++; } }
From source file:com.metadot.book.connectr.client.view.FriendListView.java
License:Apache License
private void displayFriends(List<String> friends) { int i = 0;/* w w w .ja va 2 s . c o m*/ friendsTable.clear(); if (friends == null || friends.size() == 0) { loadingLabel.setText("No friends."); return; } loadingLabel.setVisible(false); for (final String friend : friends) { CheckBox checkBoxName = new CheckBox(truncateLongName(friend)); checkBoxName.setValue(true); final Image propertyButton = new Image(GlobalResources.RESOURCE.propertyButton()); propertyButton.setStyleName("pointer"); friendsTable.setWidget(i, 0, checkBoxName); friendsTable.setWidget(i, 1, propertyButton); friendsTable.getCellFormatter().addStyleName(i, 0, "friendNameInList"); i++; } }
From source file:com.mvp4g.example.client.widgets.Tasks.java
License:Apache License
public void addTask(String task) { CheckBox cb = new CheckBox(task); cb.setStyleName(style.item()); panel.add(cb); }
From source file:com.nitrous.gwt.earth.client.demo.Api1009FeatureTestDemo.java
License:Apache License
/** * The Google earth API has loaded, start the application *//*from w w w . java2s.co m*/ private void onApiLoaded() { // construct the UI widget GoogleEarthWidget earth = new GoogleEarthWidget(); // register a listener to be notified when the earth plug-in has loaded earth.addPluginReadyListener(new GEPluginReadyListener() { public void pluginReady(GEPlugin ge) { gePlugin = ge; // show map content once the plugin has loaded loadMapContent(); } public void pluginInitFailure() { // failure! Window.alert("Failed to initialize Google Earth Plug-in"); } }); // tour visibility visibilityButton = new Button("Toggle Tour Control Visibility"); visibilityButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean isVisible = gePlugin.getTourPlayer().getControl().isVisible(); gePlugin.getTourPlayer().getControl().setVisibile(!isVisible); } }); // Get tour speed showSpeedButton = new Button("Get Tour Speed"); showSpeedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert("Tour speed = " + gePlugin.getTourPlayer().getCurrentSpeed()); } }); // Increase tour speed speedIncreaseButton = new Button("Speed++"); speedIncreaseButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gePlugin.getTourPlayer().setCurrentSpeed(gePlugin.getTourPlayer().getCurrentSpeed() + 1); } }); // Decrease tour speed speedDecreaseButton = new Button("Speed--"); speedDecreaseButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { float speed = gePlugin.getTourPlayer().getCurrentSpeed(); speed = speed - 1; if (speed < 0) { speed = 0; } gePlugin.getTourPlayer().setCurrentSpeed(speed); } }); // Toggle loop loopCheck = new CheckBox("Loop"); loopCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { gePlugin.getTourPlayer().setLoop(event.getValue()); } }); // get loop isLoopButton = new Button("Is Loop?"); isLoopButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert("Loop = " + gePlugin.getTourPlayer().getLoop()); } }); HorizontalPanel topPanel = new HorizontalPanel(); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); topPanel.add(visibilityButton); topPanel.add(showSpeedButton); topPanel.add(speedIncreaseButton); topPanel.add(speedDecreaseButton); topPanel.add(isLoopButton); topPanel.add(loopCheck); DockLayoutPanel layout = new DockLayoutPanel(Unit.PX); layout.addNorth(topPanel, 40D); layout.add(earth); RootLayoutPanel.get().add(layout); // disable the API testing buttons until the tour has been loaded enableButtons(false); // begin loading the Google Earth Plug-in earth.init(); }
From source file:com.nitrous.gwt.earth.client.demo.FetchKmlInteractiveCheckboxes.java
License:Apache License
/** * The Google earth API has loaded, start the application *///from w w w . j a v a 2s.c o m private void onApiLoaded() { // construct the UI widget earth = new GoogleEarthWidget(); // register a listener to be notified when the earth plug-in has loaded earth.addPluginReadyListener(new GEPluginReadyListener() { public void pluginReady(GEPlugin ge) { // show map content once the plugin has loaded loadMapContent(); } public void pluginInitFailure() { // failure! Window.alert("Failed to initialize Google Earth Plug-in"); } }); currentKmlObjects = new HashMap<String, KmlObject>(); checkBoxes = new HashMap<String, CheckBox>(); red = new CheckBox("Red Placemarks"); red.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { toggleKml("red"); } }); checkBoxes.put("red", red); yellow = new CheckBox("Yellow Placemarks"); yellow.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { toggleKml("yellow"); } }); checkBoxes.put("yellow", yellow); green = new CheckBox("Green Placemarks"); green.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { toggleKml("green"); } }); checkBoxes.put("green", green); HorizontalPanel header = new HorizontalPanel(); header.setSpacing(5); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); header.add(new HTML("<H1>Toggle KML Files:</H1>")); VerticalPanel checkBoxes = new VerticalPanel(); checkBoxes.setSpacing(5); checkBoxes.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); checkBoxes.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); checkBoxes.add(red); checkBoxes.add(yellow); checkBoxes.add(green); header.add(checkBoxes); DockLayoutPanel layout = new DockLayoutPanel(Unit.PX); layout.addNorth(header, 100); layout.add(earth); RootLayoutPanel.get().add(layout); // begin loading the Google Earth Plug-in earth.init(); }
From source file:com.objetdirect.tatami.demo.client.GfxDemo.java
License:Open Source License
/** * Shows a popup to select a color for the background or the stroke. * The popup contains a TabPanel with 3 tab, a <code>ColorChooser</code>, * a <code>Slider</code> to change the opacity of the <code>Color</code>, * some <code>Pattern</code> to apply *///from w w w. ja va 2s .c om private void showPopupColor(Widget sender) { final PopupPanel popupColor = new PopupPanel(true); popupColor.addStyleName("GfxDemo-popupColor"); TabPanel tabPanel = new TabPanel(); FlowPanel colPanel = new FlowPanel(); final CheckBox checkFill = new CheckBox("Background"); checkFill.setChecked(true); colPanel.add(checkFill); final ColorChooser colorChooser = new ColorChooser(); colPanel.add(colorChooser); tabPanel.add(colPanel, new Label("Color")); ChangeListener colorChange = new ChangeListener() { public void onChange(Widget sender) { String color = colorChooser.getColor(); Color colorSelected = Color.getColor(color); if (checkFill.isChecked()) { currentFillColor = colorSelected; DOM.setStyleAttribute(fill.getElement(), "backgroundColor", color); //currentFillColor.setAlpha(opacity.getValue()); if (current != null) { current.setFillColor(currentFillColor); } } else { currentStrokeColor = colorSelected; lastStrokeColor = currentStrokeColor; DOM.setStyleAttribute(fill.getElement(), "borderColor", color); if (current != null) { current.setStroke(currentStrokeColor, 1); } } } }; colorChooser.addChangeListener(colorChange); FlowPanel patternContainer = new FlowPanel(); patternContainer.add(createImagePattern("gfx/none.gif")); patternContainer.add(createImagePattern("littleNero.png")); patternContainer.add(createImagePattern("littleTrajan.png")); patternContainer.add(createImagePattern("cubic.jpg")); patternContainer.add(createImagePattern("logo_ft.gif")); patternContainer.add(createImagePattern("od-logo.jpg")); tabPanel.add(patternContainer, new Label("Pattern")); tabPanel.add(this.opacity, new Label("Opacity")); tabPanel.selectTab(0); popupColor.add(tabPanel); popupColor.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop()); popupColor.show(); }
From source file:com.openkm.frontend.client.widget.massive.ConvertPopup.java
License:Open Source License
/** * ConvertPopup//from www .jav a 2 s .c o m */ public ConvertPopup() { // Establishes auto-close when click outside super(false, true); setText(Main.i18n("convert.label")); // Status status = new Status(this); status.setStyleName("okm-StatusPopup"); vPanel = new VerticalPanel(); saveCheck = new CheckBox(Main.i18n("convert.save")); saveCheck.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (saveCheck.getValue()) { downloadCheck.setValue(false); } evaluateExecuteButton(); } }); downloadCheck = new CheckBox(Main.i18n("convert.download")); downloadCheck.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (downloadCheck.getValue()) { saveCheck.setValue(false); } evaluateExecuteButton(); } }); formatText = new HTML(Main.i18n("convert.format")); formats = new ListBox(); formats.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { evaluateExecuteButton(); } }); formats.setStyleName("okm-Input"); cancelbutton = new Button(Main.i18n("button.cancel")); cancelbutton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); cancelbutton.setStyleName("okm-NoButton"); executeButton = new Button(Main.i18n("button.execute")); executeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (downloadCheck.getValue()) { Util.downloadFilePdf(doc.getUuid()); } else if (saveCheck.getValue()) { String format = formats.getValue(formats.getSelectedIndex()); if (format.equals(GWTConvertConstants.TO_PDF)) { status.setFlagConvert(); documentService.convertToPdf(doc.getPath(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { Main.get().mainPanel.desktop.browser.fileBrowser.refreshOnlyFileBrowser(); status.unsetFlagConvert(); hide(); } @Override public void onFailure(Throwable caught) { Main.get().showError("convertToPdf", caught); status.unsetFlagConvert(); } }); } } } }); executeButton.setStyleName("okm-YesButton"); HorizontalPanel hCheckPanel = new HorizontalPanel(); hCheckPanel.add(saveCheck); hCheckPanel.add(Util.hSpace("5")); hCheckPanel.add(downloadCheck); hCheckPanel.add(Util.hSpace("5")); hCheckPanel.setStyleName("okm-NoWrap"); hCheckPanel.setCellVerticalAlignment(saveCheck, HasAlignment.ALIGN_MIDDLE); hCheckPanel.setCellVerticalAlignment(downloadCheck, HasAlignment.ALIGN_MIDDLE); HorizontalPanel hFormatPanel = new HorizontalPanel(); hFormatPanel.add(Util.hSpace("5")); hFormatPanel.add(formatText); hFormatPanel.add(Util.hSpace("5")); hFormatPanel.add(formats); hFormatPanel.add(Util.hSpace("5")); hFormatPanel.setCellVerticalAlignment(formatText, HasAlignment.ALIGN_MIDDLE); hFormatPanel.setCellVerticalAlignment(formats, HasAlignment.ALIGN_MIDDLE); HorizontalPanel hButtonPanel = new HorizontalPanel(); hButtonPanel.add(cancelbutton); hButtonPanel.add(Util.hSpace("5")); hButtonPanel.add(executeButton); vPanel.add(hCheckPanel); vPanel.add(Util.vSpace("5")); vPanel.add(hFormatPanel); vPanel.add(Util.vSpace("5")); vPanel.add(hButtonPanel); vPanel.add(Util.vSpace("5")); vPanel.setCellHorizontalAlignment(hButtonPanel, HasAlignment.ALIGN_CENTER); vPanel.setSize("100%", "20"); super.hide(); setWidget(vPanel); }