Search in sources :

Example 61 with ChangeEvent

use of com.google.gwt.event.dom.client.ChangeEvent in project perun by CESNET.

the class GroupApplicationsTabItem method draw.

public Widget draw() {
    // request
    final GetApplicationsForGroup applicationsRequest = new GetApplicationsForGroup(group.getId());
    final JsonCallbackEvents refreshEvent = JsonCallbackEvents.refreshTableEvents(applicationsRequest);
    this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": " + "applications");
    // MAIN PANEL
    VerticalPanel firstTabPanel = new VerticalPanel();
    firstTabPanel.setSize("100%", "100%");
    // HORIZONTAL MENU
    TabMenu menu = new TabMenu();
    menu.addWidget(UiElements.getRefreshButton(this));
    firstTabPanel.add(menu);
    firstTabPanel.setCellHeight(menu, "30px");
    /*
		// verify button
		final CustomButton verify = TabMenu.getPredefinedButton(ButtonType.VERIFY, ButtonTranslation.INSTANCE.verifyApplication());
		verify.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(verify));
							request.verifyApplication(list.get(i).getId());
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(verify, refreshEvent));
							request.verifyApplication(list.get(i).getId());
						}
					}
				}
			}
		});

		// accept button
		final CustomButton approve = TabMenu.getPredefinedButton(ButtonType.APPROVE, ButtonTranslation.INSTANCE.approveApplication());
		approve.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(approve));
							request.approveApplication(list.get(i));
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(approve, refreshEvent));
							request.approveApplication(list.get(i));
						}
					}
				}
			}
		});

		//reject button
		final CustomButton reject = TabMenu.getPredefinedButton(ButtonType.REJECT, ButtonTranslation.INSTANCE.rejectApplication());
		reject.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				final ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					// confirm content
					FlexTable content = new FlexTable();
					content.setCellSpacing(10);
					content.setHTML(0, 0, "Please specify reason of rejection to let user know why was application rejected.");
					content.getFlexCellFormatter().setColSpan(0, 0, 2);
					final TextArea reason = new TextArea();
					reason.setSize("300px", "150px");
					content.setHTML(1, 0, "<strong>Reason: </strong>");
					content.setWidget(1, 1, reason);

					Confirm c = new Confirm("Specify reason", content, new ClickHandler(){
						public void onClick(ClickEvent event) {

							for (int i=0; i<list.size(); i++) {
								if (i != list.size()-1) {
									HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(reject));
									request.rejectApplication(list.get(i).getId(), reason.getText());
								} else {
									// refresh table on last call
									HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(reject, refreshEvent));
									request.rejectApplication(list.get(i).getId(), reason.getText());
								}
							}

						}
					}, true);
					c.show();
				}
			}
		});

		// delete button
		final CustomButton delete = TabMenu.getPredefinedButton(ButtonType.DELETE, ButtonTranslation.INSTANCE.deleteApplication());
		delete.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(delete));
							request.deleteApplication(list.get(i).getId());
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(delete, refreshEvent));
							request.deleteApplication(list.get(i).getId());
						}
					}
				}
			}
		});

		menu.addWidget(verify);
		menu.addWidget(approve);
		menu.addWidget(reject);
		menu.addWidget(delete);
		*/
    // FILTER
    menu.addWidget(new HTML("<strong>State: </strong>"));
    // state
    final ListBox stateListBox = new ListBox();
    stateListBox.addItem(WidgetTranslation.INSTANCE.listboxAll(), "");
    stateListBox.addItem(ObjectTranslation.INSTANCE.applicationStateNew(), "NEW");
    stateListBox.addItem(ObjectTranslation.INSTANCE.applicationStateVerified(), "VERIFIED");
    stateListBox.addItem("Pending", "NEW,VERIFIED");
    stateListBox.addItem(ObjectTranslation.INSTANCE.applicationStateApproved(), "APPROVED");
    stateListBox.addItem(ObjectTranslation.INSTANCE.applicationStateRejected(), "REJECTED");
    stateListBox.setSelectedIndex(selectedIndex);
    menu.addWidget(stateListBox);
    stateListBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            selectedIndex = stateListBox.getSelectedIndex();
            applicationsRequest.setState(stateListBox.getValue(stateListBox.getSelectedIndex()));
            applicationsRequest.clearTable();
            applicationsRequest.retrieveData();
        }
    });
    // FILTER 2
    menu.addWidget(new HTML("<strong>Submitted&nbsp;by: </strong>"));
    menu.addFilterWidget(new ExtendedSuggestBox(applicationsRequest.getOracle()), new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            applicationsRequest.filterTable(text);
        }
    }, ButtonTranslation.INSTANCE.filterApplications());
    // TABLE
    applicationsRequest.setState(stateListBox.getValue(stateListBox.getSelectedIndex()));
    CellTable<Application> table = applicationsRequest.getTable(new FieldUpdater<Application, String>() {

        public void update(int index, Application object, String value) {
            session.getTabManager().addTabToCurrentTab(new ApplicationDetailTabItem(object), true);
        }
    });
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(sp, 100);
    firstTabPanel.add(sp);
    /*
		verify.setEnabled(false);
		approve.setEnabled(false);
		reject.setEnabled(false);
		delete.setEnabled(false);

		if (session.isGroupAdmin(groupId) || session.isVoAdmin(group.getVoId()))  {

			JsonUtils.addTableManagedButton(applicationsRequest, table, approve);
			JsonUtils.addTableManagedButton(applicationsRequest, table, reject);
			JsonUtils.addTableManagedButton(applicationsRequest, table, delete);

			if (session.isPerunAdmin()) {

				JsonUtils.addTableManagedButton(applicationsRequest, table, verify);

			}

		} else {



		}

		*/
    applicationsRequest.setCheckable(false);
    this.contentWidget.setWidget(firstTabPanel);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) GetApplicationsForGroup(cz.metacentrum.perun.webgui.json.registrarManager.GetApplicationsForGroup) ApplicationDetailTabItem(cz.metacentrum.perun.webgui.tabs.registrartabs.ApplicationDetailTabItem) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) Application(cz.metacentrum.perun.webgui.model.Application) HandleApplication(cz.metacentrum.perun.webgui.json.registrarManager.HandleApplication)

Example 62 with ChangeEvent

use of com.google.gwt.event.dom.client.ChangeEvent in project perun by CESNET.

the class FacilityHostsSettingsTabItem method draw.

public Widget draw() {
    titleWidget.setText(Utils.getStrippedStringWithEllipsis(facility.getName()) + ": Hosts settings");
    // main panel
    VerticalPanel firstTabPanel = new VerticalPanel();
    firstTabPanel.setSize("100%", "100%");
    final GetAttributesV2 attrs = new GetAttributesV2();
    final ListBoxWithObjects<Host> listbox = new ListBoxWithObjects<Host>();
    // refresh attributes for hosts
    listbox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (listbox.getSelectedObject() != null) {
                lastSelectedHostId = listbox.getSelectedObject().getId();
                attrs.getHostAttributes(lastSelectedHostId);
                attrs.retrieveData();
            } else {
                lastSelectedHostId = 0;
            }
        }
    });
    // retrieve hosts
    final GetHosts hosts = new GetHosts(facilityId, new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            listbox.clear();
            ArrayList<Host> result = JsonUtils.jsoAsList(jso);
            if (result != null && !result.isEmpty()) {
                for (Host h : result) {
                    listbox.addItem(h);
                    if (h.getId() == lastSelectedHostId) {
                        listbox.setSelected(h, true);
                    }
                }
                if (lastSelectedHostId == 0) {
                    lastSelectedHostId = listbox.getSelectedObject().getId();
                }
                attrs.getHostAttributes(lastSelectedHostId);
                attrs.retrieveData();
            }
        }

        @Override
        public void onError(PerunError error) {
            listbox.clear();
            listbox.addItem("Error while loading");
        }

        @Override
        public void onLoadingStart() {
            listbox.clear();
            listbox.addItem("Loading...");
        }
    });
    hosts.retrieveData();
    final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(attrs);
    // menu
    TabMenu menu = new TabMenu();
    // Save changes button
    final CustomButton saveChangesButton = TabMenu.getPredefinedButton(ButtonType.SAVE, ButtonTranslation.INSTANCE.saveChangesInAttributes());
    final JsonCallbackEvents saveChangesButtonEvent = JsonCallbackEvents.disableButtonEvents(saveChangesButton, events);
    saveChangesButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            ArrayList<Attribute> list = attrs.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {
                Map<String, Integer> ids = new HashMap<String, Integer>();
                ids.put("host", lastSelectedHostId);
                SetAttributes request = new SetAttributes(saveChangesButtonEvent);
                request.setAttributes(ids, list);
            }
        }
    });
    // Remove attr button
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeAttributes());
    final JsonCallbackEvents removeButtonEvent = JsonCallbackEvents.disableButtonEvents(removeButton, events);
    removeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            ArrayList<Attribute> list = attrs.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {
                Map<String, Integer> ids = new HashMap<String, Integer>();
                ids.put("host", lastSelectedHostId);
                RemoveAttributes request = new RemoveAttributes(removeButtonEvent);
                request.removeAttributes(ids, list);
            }
        }
    });
    menu.addWidget(UiElements.getRefreshButton(this));
    menu.addWidget(saveChangesButton);
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.setNewAttributes(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Map<String, Integer> ids = new HashMap<String, Integer>();
            ids.put("host", lastSelectedHostId);
            session.getTabManager().addTabToCurrentTab(new SetNewAttributeTabItem(ids, attrs.getList()), true);
        }
    }));
    menu.addWidget(removeButton);
    menu.addWidget(new HTML("<strong>Select host:</strong>"));
    menu.addWidget(listbox);
    // attrs table
    CellTable<Attribute> table = attrs.getEmptyTable();
    // add a class to the table and wrap it into scroll panel
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    // add menu and the table to the main panel
    firstTabPanel.add(menu);
    firstTabPanel.setCellHeight(menu, "30px");
    firstTabPanel.add(sp);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(firstTabPanel);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) HashMap(java.util.HashMap) Attribute(cz.metacentrum.perun.webgui.model.Attribute) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) SetAttributes(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributes) GetHosts(cz.metacentrum.perun.webgui.json.facilitiesManager.GetHosts) ListBoxWithObjects(cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) SetNewAttributeTabItem(cz.metacentrum.perun.webgui.tabs.attributestabs.SetNewAttributeTabItem) GetAttributesV2(cz.metacentrum.perun.webgui.json.attributesManager.GetAttributesV2) Host(cz.metacentrum.perun.webgui.model.Host) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) PerunError(cz.metacentrum.perun.webgui.model.PerunError) HashMap(java.util.HashMap) Map(java.util.Map) RemoveAttributes(cz.metacentrum.perun.webgui.json.attributesManager.RemoveAttributes)

Example 63 with ChangeEvent

use of com.google.gwt.event.dom.client.ChangeEvent in project perun by CESNET.

the class FacilityAllowedGroupsTabItem method draw.

public Widget draw() {
    // set title
    titleWidget.setText(Utils.getStrippedStringWithEllipsis(facility.getName()) + ": Allowed Groups");
    final ListBoxWithObjects<VirtualOrganization> vosListbox = new ListBoxWithObjects<VirtualOrganization>();
    final ListBoxWithObjects<Service> servicesListbox = new ListBoxWithObjects<Service>();
    final GetAllowedGroups jsonCallback = new GetAllowedGroups(facilityId);
    jsonCallback.setCheckable(false);
    // content
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    menu.addWidget(UiElements.getRefreshButton(this));
    menu.addWidget(new HTML("<strong>Filter by VO:</strong>"));
    menu.addWidget(vosListbox);
    menu.addWidget(new HTML("<strong>Filter by service:</strong>"));
    menu.addWidget(servicesListbox);
    // get the table
    final GetAllowedVos vosCall = new GetAllowedVos(facilityId, new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            vosListbox.clear();
            vosListbox.removeAllOption();
            vosListbox.addAllItems(new TableSorter<VirtualOrganization>().sortByName(JsonUtils.<VirtualOrganization>jsoAsList(jso)));
            vosListbox.addAllOption();
            if (lastSelectedVoId == 0) {
                vosListbox.setSelectedIndex(0);
            } else {
                for (VirtualOrganization vo : vosListbox.getAllObjects()) {
                    if (vo.getId() == lastSelectedVoId) {
                        vosListbox.setSelected(vo, true);
                        break;
                    }
                }
            }
            jsonCallback.setVos(vosListbox.getAllObjects());
            vosCallDone = true;
        }

        public void onLoadingStart() {
            vosListbox.removeAllOption();
            vosListbox.clear();
            vosListbox.addItem("Loading...");
            vosCallDone = false;
        }

        public void onError(PerunError error) {
            vosListbox.clear();
            vosListbox.removeAllOption();
            vosListbox.addItem("Error while loading");
            vosCallDone = false;
        }
    });
    vosCall.retrieveData();
    GetFacilityAssignedServices servCall = new GetFacilityAssignedServices(facilityId, new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            servicesListbox.clear();
            servicesListbox.removeAllOption();
            servicesListbox.addAllItems(new TableSorter<Service>().sortByName(JsonUtils.<Service>jsoAsList(jso)));
            servicesListbox.addAllOption();
            if (servicesListbox.isEmpty()) {
                servicesListbox.addItem("No service available on facility");
            }
            if (lastSelectedServiceId == 0) {
                // choose all
                servicesListbox.setSelectedIndex(0);
            } else {
                for (Service s : servicesListbox.getAllObjects()) {
                    if (s.getId() == lastSelectedServiceId) {
                        servicesListbox.setSelected(s, true);
                        break;
                    }
                }
            }
            callDone = true;
        }

        public void onLoadingStart() {
            servicesListbox.removeAllOption();
            servicesListbox.clear();
            servicesListbox.addItem("Loading...");
            callDone = false;
        }

        public void onError(PerunError error) {
            servicesListbox.clear();
            servicesListbox.removeAllOption();
            servicesListbox.addItem("Error while loading");
            callDone = false;
        }
    });
    servCall.retrieveData();
    Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() {

        @Override
        public boolean execute() {
            if (vosCallDone && callDone) {
                jsonCallback.setVoId(lastSelectedVoId);
                jsonCallback.setServiceId(lastSelectedServiceId);
                jsonCallback.retrieveData();
                return false;
            } else {
                return true;
            }
        }
    }, 200);
    vosListbox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            if (vosListbox.getSelectedIndex() > 0) {
                jsonCallback.setVoId(vosListbox.getSelectedObject().getId());
                lastSelectedVoId = vosListbox.getSelectedObject().getId();
            } else {
                jsonCallback.setVoId(0);
                lastSelectedVoId = 0;
            }
            jsonCallback.retrieveData();
        }
    });
    servicesListbox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            if (servicesListbox.getSelectedIndex() > 0) {
                jsonCallback.setServiceId(servicesListbox.getSelectedObject().getId());
                lastSelectedServiceId = servicesListbox.getSelectedObject().getId();
            } else {
                jsonCallback.setServiceId(0);
                lastSelectedServiceId = 0;
            }
            jsonCallback.retrieveData();
        }
    });
    CellTable<Group> table = jsonCallback.getEmptyTable(new FieldUpdater<Group, String>() {

        @Override
        public void update(int i, Group group, String s) {
            if (session.isVoAdmin(group.getVoId()) || session.isGroupAdmin(group.getId())) {
                session.getTabManager().addTab(new GroupDetailTabItem(group));
            } else {
                // show alert
                UiElements.generateInfo("You are not VO / Group manager of this group", "You MUST be VO manager or Group manager of group: <strong>" + group.getName() + "</strong> to view it's details.");
            }
        }
    });
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    vp.add(sp);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : GetAllowedGroups(cz.metacentrum.perun.webgui.json.facilitiesManager.GetAllowedGroups) JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Scheduler(com.google.gwt.core.client.Scheduler) ListBoxWithObjects(cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) GetAllowedVos(cz.metacentrum.perun.webgui.json.facilitiesManager.GetAllowedVos) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) GetFacilityAssignedServices(cz.metacentrum.perun.webgui.json.servicesManager.GetFacilityAssignedServices) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) GroupDetailTabItem(cz.metacentrum.perun.webgui.tabs.groupstabs.GroupDetailTabItem) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 64 with ChangeEvent

use of com.google.gwt.event.dom.client.ChangeEvent in project zxing by zxing.

the class Generator method setupLeftPanel.

void setupLeftPanel() {
    topPanel.setHTML(2, 0, "<span id=\"errorMessageID\" class=\"" + StylesDefs.ERROR_MESSAGE + "\"></span>");
    // fills up the list of generators
    for (GeneratorSource generator : generators) {
        genList.addItem(generator.getName());
        setGridStyle(generator.getWidget());
    }
    sizeList.addItem("Small", "120");
    sizeList.addItem("Medium", "230");
    sizeList.addItem("Large", "350");
    sizeList.setSelectedIndex(2);
    ecLevelList.addItem("L");
    ecLevelList.addItem("M");
    ecLevelList.addItem("Q");
    ecLevelList.addItem("H");
    ecLevelList.setSelectedIndex(0);
    encodingList.addItem("UTF-8");
    encodingList.addItem("ISO-8859-1");
    encodingList.addItem("Shift_JIS");
    encodingList.setSelectedIndex(0);
    // updates the second row of the table with the content of the selected generator
    genList.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent Event) {
            int i = genList.getSelectedIndex();
            setWidget(i);
        }
    });
    // grid for the generator picker
    HTMLTable selectionTable = new Grid(1, 2);
    selectionTable.setText(0, 0, "Contents");
    selectionTable.setWidget(0, 1, genList);
    setGridStyle(selectionTable);
    topPanel.setWidget(0, 0, selectionTable);
    // grid for the generate button
    HTMLTable generateGrid = new Grid(1, 2);
    setGridStyle(generateGrid);
    Button generateButton = new Button("Generate &rarr;");
    generateButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            generate();
        }
    });
    generateGrid.setWidget(0, 1, generateButton);
    topPanel.setWidget(4, 0, generateGrid);
    HTMLTable configTable = new Grid(3, 2);
    configTable.setText(0, 0, "Barcode size");
    configTable.setWidget(0, 1, sizeList);
    configTable.setText(1, 0, "Error correction");
    configTable.setWidget(1, 1, ecLevelList);
    configTable.setText(2, 0, "Character encoding");
    configTable.setWidget(2, 1, encodingList);
    setGridStyle(configTable);
    topPanel.setWidget(3, 0, configTable);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(com.google.gwt.user.client.ui.Button) Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HTMLTable(com.google.gwt.user.client.ui.HTMLTable)

Example 65 with ChangeEvent

use of com.google.gwt.event.dom.client.ChangeEvent in project gerrit by GerritCodeReview.

the class ProjectInfoScreen method initProjectOptions.

private void initProjectOptions() {
    grid.addHeader(new SmallHeading(AdminConstants.I.headingProjectOptions()));
    state = new ListBox();
    for (ProjectState stateValue : ProjectState.values()) {
        state.addItem(Util.toLongString(stateValue), stateValue.name());
    }
    saveEnabler.listenTo(state);
    grid.add(AdminConstants.I.headingProjectState(), state);
    submitType = new ListBox();
    for (final SubmitType type : SubmitType.values()) {
        submitType.addItem(Util.toLongString(type), type.name());
    }
    submitType.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            setEnabledForUseContentMerge();
        }
    });
    saveEnabler.listenTo(submitType);
    grid.add(AdminConstants.I.headingProjectSubmitType(), submitType);
    contentMerge = newInheritedBooleanBox();
    saveEnabler.listenTo(contentMerge);
    grid.add(AdminConstants.I.useContentMerge(), contentMerge);
    newChangeForAllNotInTarget = newInheritedBooleanBox();
    saveEnabler.listenTo(newChangeForAllNotInTarget);
    grid.add(AdminConstants.I.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
    requireChangeID = newInheritedBooleanBox();
    saveEnabler.listenTo(requireChangeID);
    grid.addHtml(AdminConstants.I.requireChangeID(), requireChangeID);
    if (Gerrit.info().receive().enableSignedPush()) {
        enableSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(enableSignedPush);
        grid.add(AdminConstants.I.enableSignedPush(), enableSignedPush);
        requireSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(requireSignedPush);
        grid.add(AdminConstants.I.requireSignedPush(), requireSignedPush);
    }
    rejectImplicitMerges = newInheritedBooleanBox();
    saveEnabler.listenTo(rejectImplicitMerges);
    grid.addHtml(AdminConstants.I.rejectImplicitMerges(), rejectImplicitMerges);
    enableReviewerByEmail = newInheritedBooleanBox();
    saveEnabler.listenTo(enableReviewerByEmail);
    grid.addHtml(AdminConstants.I.enableReviewerByEmail(), enableReviewerByEmail);
    maxObjectSizeLimit = new NpTextBox();
    saveEnabler.listenTo(maxObjectSizeLimit);
    effectiveMaxObjectSizeLimit = new Label();
    effectiveMaxObjectSizeLimit.setStyleName(Gerrit.RESOURCES.css().maxObjectSizeLimitEffectiveLabel());
    HorizontalPanel p = new HorizontalPanel();
    p.add(maxObjectSizeLimit);
    p.add(effectiveMaxObjectSizeLimit);
    grid.addHtml(AdminConstants.I.headingMaxObjectSizeLimit(), p);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Label(com.google.gwt.user.client.ui.Label) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ProjectState(com.google.gerrit.extensions.client.ProjectState) SubmitType(com.google.gerrit.extensions.client.SubmitType) ListBox(com.google.gwt.user.client.ui.ListBox) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox)

Aggregations

ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)99 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)41 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)41 ListBox (org.gwtbootstrap3.client.ui.ListBox)32 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)31 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)28 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)27 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)27 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)27 ArrayList (java.util.ArrayList)21 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)20 PerunError (cz.metacentrum.perun.webgui.model.PerunError)16 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)15 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)13 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)12 HashMap (java.util.HashMap)11 Map (java.util.Map)9 Button (org.gwtbootstrap3.client.ui.Button)9 HTML (com.google.gwt.user.client.ui.HTML)7