Search in sources :

Example 56 with HTML

use of com.google.gwt.user.client.ui.HTML in project perun by CESNET.

the class FindExternalPublications method getEmptyTable.

/**
 * Returns table with publications
 * @return table
 */
public CellTable<Publication> getEmptyTable() {
    // Table data provider.
    dataProvider = new ListDataProvider<Publication>(list);
    // Cell table
    table = new PerunTable<Publication>(list);
    table.removeRowCountChangeHandler();
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    // Connect the table to the data provider.
    dataProvider.addDataDisplay(table);
    // Sorting
    ListHandler<Publication> columnSortHandler = new ListHandler<Publication>(dataProvider.getList());
    table.addColumnSortHandler(columnSortHandler);
    // table selection
    table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Publication>createCheckboxManager());
    // set empty content & loader
    table.setEmptyTableWidget(loaderImage.prepareToSearch("Please select external pub. system and year range to search for publications for import."));
    loaderImage.setEmptyResultMessage("No publications found in external system.");
    // show checkbox column
    if (this.checkable) {
        table.addCheckBoxColumn();
    }
    /*
		// CATEGORY COLUMN
		ArrayList<String> categories = new ArrayList<String>();
		categories.add("Bodované v RIVu");
		categories.add("Nebodované v RIVu");
		categories.add("Příspěvek do ročenky");
		categories.add("Výjimečné výsledky");
		categories.add("Jiné");

		Column<Publication, String> categoryColumn = new Column<Publication, String>(new SelectionCell(categories)){
		@Override
		public String getValue(Publication object) {
		// category ID as string, 0 if not set
		int id = object.getCategoryId();
		if (id == 0) {
		// set default == 21/Bodované v RIVu to object
		object.setCategoryId(21);
		}
		if (id == 21) {
		return "Bodované v RIVu";
		} else if (id == 22) {
		return "Nebodované v RIVu";
		} else if (id == 23) {
		return "Výjimečné výsledky";
		} else if (id == 24) {
		return "Příspěvek do ročenky";
		} else if (id == 25) {
		return "Jiné";
		} else {
		return String.valueOf(id); // return ID if no match
		}
		}
		};
		categoryColumn.setFieldUpdater(new FieldUpdater<Publication, String>() {
		public void update(int index, Publication object, String value) {

		int id = 0;
		if (value.equalsIgnoreCase("Bodované v RIVu")) {
		id = 21;
		} else if (value.equalsIgnoreCase("Nebodované v RIVu")) {
		id = 22;
		} else if (value.equalsIgnoreCase("Příspěvek do ročenky")) {
		id = 24;
		} else if (value.equalsIgnoreCase("Výjimečné výsledky")) {
		id = 23;
		} else if (value.equalsIgnoreCase("Jiné")) {
		id = 25;
		}
		object.setCategoryId(id);
		selectionModel.setSelected(object, true);

		}
		});
		table.addColumn(categoryColumn, "Category");

		// NOT USEFULL => DISABLED
		// EXTERNAL ID
		TextColumn<Publication> externalIdColumn = new TextColumn<Publication>() {
		public String getValue(Publication object) {
		return String.valueOf(object.getExternalId());
		};
		};
		externalIdColumn.setSortable(true);
		columnSortHandler.setComparator(externalIdColumn, new PublicationComparator(PublicationComparator.Column.EXTERNAL_ID));
		table.addColumn(externalIdColumn, "External Id");
		*/
    // TITLE COLUMN
    TextColumn<Publication> titleColumn = new TextColumn<Publication>() {

        public String getValue(Publication object) {
            return object.getTitle();
        }
    };
    titleColumn.setSortable(true);
    columnSortHandler.setComparator(titleColumn, new PublicationComparator(PublicationComparator.Column.TITLE));
    table.addColumn(titleColumn, "Title");
    // AUTHORS COLUMN
    TextColumn<Publication> authorColumn = new TextColumn<Publication>() {

        public String getValue(Publication object) {
            return object.getAuthorsFormatted();
        }
    };
    authorColumn.setSortable(true);
    columnSortHandler.setComparator(authorColumn, new PublicationComparator(PublicationComparator.Column.AUTHORS));
    table.addColumn(authorColumn, "Authors");
    // YEAR COLUMN
    TextColumn<Publication> yearColumn = new TextColumn<Publication>() {

        public String getValue(Publication object) {
            return String.valueOf(object.getYear());
        }
    };
    yearColumn.setSortable(true);
    columnSortHandler.setComparator(yearColumn, new PublicationComparator(PublicationComparator.Column.YEAR));
    table.addColumn(yearColumn, "Year");
    // ISBN COLUMN
    TextColumn<Publication> isbnColumn = new TextColumn<Publication>() {

        public String getValue(Publication object) {
            return object.getIsbn();
        }
    };
    isbnColumn.setSortable(true);
    columnSortHandler.setComparator(isbnColumn, new PublicationComparator(PublicationComparator.Column.ISBN));
    table.addColumn(isbnColumn, "ISBN");
    // CITE COLUMN
    Column<Publication, String> citaceColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {

        public String getValue(Publication object) {
            return "Cite";
        }
    }, new FieldUpdater<Publication, String>() {

        public void update(int index, Publication object, String value) {
            SimplePanel sp = new SimplePanel();
            sp.add(new HTML(object.getMain()));
            Confirm cf = new Confirm("Cite publication", sp, true);
            cf.show();
        }
    });
    table.addColumn(citaceColumn, "Cite");
    return table;
}
Also used : PublicationComparator(cz.metacentrum.perun.webgui.json.comparators.PublicationComparator) ListHandler(com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler) Publication(cz.metacentrum.perun.webgui.model.Publication) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 57 with HTML

use of com.google.gwt.user.client.ui.HTML in project perun by CESNET.

the class UpdateAttribute method testUpdating.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testUpdating() {
    boolean result = true;
    String errorMsg = "";
    if (attributeDefinition == null) {
        errorMsg += "Attribute to update can't be null.</ br>";
        result = false;
    }
    if (attributeDefinition.getId() == 0) {
        errorMsg += "Wrong ID of attribute definition.</ br>";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating attribute", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML)

Example 58 with HTML

use of com.google.gwt.user.client.ui.HTML in project perun by CESNET.

the class CreateAttribute method testCreating.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testCreating() {
    boolean result = true;
    String errorMsg = "";
    if (friendlyName.length() == 0) {
        errorMsg += "You must enter attribute <strong>Friendly name</strong>.</ br>";
        result = false;
    }
    if (friendlyName.length() == 0) {
        errorMsg += "You must enter attribute <strong>Display name</strong>.</ br>";
        result = false;
    }
    if (namespace.length() == 0) {
        errorMsg += "Wrong parameter <strong>EntityType+DefinitionType</strong>.</ br>";
        result = false;
    }
    if (type.length() == 0) {
        errorMsg += "Wrong parameter <strong>Values type</strong>.</ br>";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating attribute", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) JSONString(com.google.gwt.json.client.JSONString)

Example 59 with HTML

use of com.google.gwt.user.client.ui.HTML in project perun by CESNET.

the class AddAutoRegGroupTabItem method draw.

@Override
public Widget draw() {
    titleWidget.setText("Add group for auto registration");
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // menu
    TabMenu menu = new TabMenu();
    menu.addWidget(new HTML(""));
    final GetAllGroups groups = new GetAllGroups(vo.getId());
    groups.setCoreGroupsCheckable(false);
    // remove already added union groups from offering
    JsonCallbackEvents localEvents = new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // second callback
            final GetAutoRegistrationGroups alreadySet = new GetAutoRegistrationGroups(vo.getId(), new JsonCallbackEvents() {

                public void onFinished(JavaScriptObject jso) {
                    JsArray<Group> esToRemove = JsonUtils.jsoAsArray(jso);
                    for (int i = 0; i < esToRemove.length(); i++) {
                        groups.removeFromTable(esToRemove.get(i));
                    }
                }
            });
            alreadySet.retrieveData();
        }
    };
    groups.setEvents(localEvents);
    final ExtendedSuggestBox box = new ExtendedSuggestBox(groups.getOracle());
    // button
    final CustomButton assignButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedExtSource());
    final TabItem tab = this;
    assignButton.addClickHandler(event -> {
        final ArrayList<Group> availableGroups = groups.getTableSelectedList();
        if (UiElements.cantSaveEmptyListDialogBox(availableGroups)) {
            AddAutoRegGroups request = new AddAutoRegGroups(JsonCallbackEvents.disableButtonEvents(assignButton, new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    // clear search
                    box.getSuggestBox().setText("");
                    groups.retrieveData();
                }
            }));
            request.setAutoRegGroups(availableGroups);
        }
    });
    menu.addFilterWidget(box, new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            groups.filterTable(text);
        }
    }, "Filter by name");
    menu.addWidget(assignButton);
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", clickEvent -> session.getTabManager().closeTab(tab, isRefreshParentOnClose())));
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    CellTable<Group> table = groups.getTable();
    assignButton.setEnabled(false);
    JsonUtils.addTableManagedButton(groups, table, assignButton);
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    vp.add(sp);
    // do not use resizePerunTable() when tab is in overlay - wrong width is calculated
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ImageResource(com.google.gwt.resources.client.ImageResource) SmallIcons(cz.metacentrum.perun.webgui.client.resources.SmallIcons) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) AddAutoRegGroups(cz.metacentrum.perun.webgui.json.registrarManager.AddAutoRegGroups) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) HTML(com.google.gwt.user.client.ui.HTML) GetAllGroups(cz.metacentrum.perun.webgui.json.groupsManager.GetAllGroups) ArrayList(java.util.ArrayList) Label(com.google.gwt.user.client.ui.Label) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) ButtonTranslation(cz.metacentrum.perun.webgui.client.localization.ButtonTranslation) UiElements(cz.metacentrum.perun.webgui.client.UiElements) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) GetAutoRegistrationGroups(cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups) Group(cz.metacentrum.perun.webgui.model.Group) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) MainMenu(cz.metacentrum.perun.webgui.client.mainmenu.MainMenu) PerunWebSession(cz.metacentrum.perun.webgui.client.PerunWebSession) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) JsArray(com.google.gwt.core.client.JsArray) Widget(com.google.gwt.user.client.ui.Widget) JsonUtils(cz.metacentrum.perun.webgui.json.JsonUtils) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ButtonType(cz.metacentrum.perun.webgui.client.resources.ButtonType) VirtualOrganization(cz.metacentrum.perun.webgui.model.VirtualOrganization) CellTable(com.google.gwt.user.cellview.client.CellTable) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) Group(cz.metacentrum.perun.webgui.model.Group) JsArray(com.google.gwt.core.client.JsArray) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) HTML(com.google.gwt.user.client.ui.HTML) AddAutoRegGroups(cz.metacentrum.perun.webgui.json.registrarManager.AddAutoRegGroups) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) GetAllGroups(cz.metacentrum.perun.webgui.json.groupsManager.GetAllGroups) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) GetAutoRegistrationGroups(cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 60 with HTML

use of com.google.gwt.user.client.ui.HTML in project perun by CESNET.

the class DeleteSecurityTeam method testDeleting.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testDeleting() {
    boolean result = true;
    String errorMsg = "";
    if (securityTeamId == 0) {
        errorMsg += "Wrong parameter <strong>SECURITY TEAM ID</strong>.\n";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while deleting Security Team", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML)

Aggregations

HTML (com.google.gwt.user.client.ui.HTML)170 ViewerPanel (org.cesiumjs.cs.widgets.ViewerPanel)34 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)32 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)31 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)26 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)21 FlexTable (com.google.gwt.user.client.ui.FlexTable)17 JSONString (com.google.gwt.json.client.JSONString)16 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)14 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)14 Label (com.google.gwt.user.client.ui.Label)14 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)13 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)12 Image (com.google.gwt.user.client.ui.Image)11 Widget (com.google.gwt.user.client.ui.Widget)11 ViewerOptions (org.cesiumjs.cs.widgets.options.ViewerOptions)11 Button (org.gwtbootstrap3.client.ui.Button)11 ListBox (com.google.gwt.user.client.ui.ListBox)10 ArrayList (java.util.ArrayList)10 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)10