diff --git a/kura/org.eclipse.kura.web2/build.properties b/kura/org.eclipse.kura.web2/build.properties index 880662a954..cb4c930cd4 100644 --- a/kura/org.eclipse.kura.web2/build.properties +++ b/kura/org.eclipse.kura.web2/build.properties @@ -22,3 +22,5 @@ output.. = target/classes/ source.. = src/main/java/,\ src/main/resources/,\ target/generated-sources/gwt +jars.extra.classpath = lib/gwtbootstrap3.jar,\ + lib/gwt-user.jar diff --git a/kura/org.eclipse.kura.web2/lib/gwt-user.jar b/kura/org.eclipse.kura.web2/lib/gwt-user.jar new file mode 100644 index 0000000000..5fd0678af9 Binary files /dev/null and b/kura/org.eclipse.kura.web2/lib/gwt-user.jar differ diff --git a/kura/org.eclipse.kura.web2/lib/gwtbootstrap3.jar b/kura/org.eclipse.kura.web2/lib/gwtbootstrap3.jar new file mode 100644 index 0000000000..c5bc6d4b34 Binary files /dev/null and b/kura/org.eclipse.kura.web2/lib/gwtbootstrap3.jar differ diff --git a/kura/org.eclipse.kura.web2/pom.xml b/kura/org.eclipse.kura.web2/pom.xml index c4c97177e5..6a59358b15 100644 --- a/kura/org.eclipse.kura.web2/pom.xml +++ b/kura/org.eclipse.kura.web2/pom.xml @@ -36,22 +36,20 @@ 2.10.0 UTF-8 - + org.gwtbootstrap3 gwtbootstrap3 1.0.1 - provided org.gwtproject gwt-user 2.12.1 - provided - + @@ -69,6 +67,35 @@ true + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.0 + + + validate + + ${project.basedir}/lib + true + + + org.gwtbootstrap3 + gwtbootstrap3 + 1.0.1 + + + org.gwtproject + gwt-user + 2.12.1 + + + + + copy + + + + org.apache.maven.plugins @@ -82,6 +109,9 @@ src/main/webapp/WEB-INF + + lib + diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java index ad2f3f8b2c..d9961c5d61 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java @@ -18,16 +18,10 @@ import static org.eclipse.kura.web.client.util.FilterBuilder.not; import static org.eclipse.kura.web.client.util.FilterBuilder.or; -import java.awt.Button; -import java.awt.Container; -import java.awt.Panel; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Optional; -import java.util.function.Consumer; - -import javax.naming.Context; import org.eclipse.kura.core.configuration.ConfigurationChangeEvent; import org.eclipse.kura.web.client.messages.Messages; @@ -71,11 +65,15 @@ import org.eclipse.kura.web.shared.service.GwtSessionService; import org.eclipse.kura.web.shared.service.GwtSessionServiceAsync; import org.gwtbootstrap3.client.ui.AnchorListItem; +import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.Column; +import org.gwtbootstrap3.client.ui.Container; import org.gwtbootstrap3.client.ui.FormLabel; +import org.gwtbootstrap3.client.ui.Icon; import org.gwtbootstrap3.client.ui.ListBox; import org.gwtbootstrap3.client.ui.Modal; import org.gwtbootstrap3.client.ui.NavPills; +import org.gwtbootstrap3.client.ui.Panel; import org.gwtbootstrap3.client.ui.PanelBody; import org.gwtbootstrap3.client.ui.PanelHeader; import org.gwtbootstrap3.client.ui.Row; @@ -101,7 +99,7 @@ import com.google.gwt.user.client.ui.ScrollPanel; import com.google.gwt.user.client.ui.Widget; -public class EntryClassUi extends Composite implements Context, ServicesUi.Listener { +public class EntryClassUi extends Composite implements ServicesUi.Listener { interface EntryClassUIUiBinder extends UiBinder { } @@ -322,15 +320,6 @@ public EntryClassUi(final GwtUserData gwtUserData, final GwtSecurityCapabilities initDropdownMenu(); initServicesTree(); - initExtensions(); - } - - private void initExtensions() { - - ExtensionRegistry.get().addExtensionConsumer(e -> { - e.onLoad(this); - }); - } private void initExceptionReportModal() { @@ -1150,7 +1139,7 @@ public void init() { private void handleConcurrencyEvent(GwtEventInfo eventInfo) { String eventPid = (String) eventInfo.getProperties().get(ConfigurationChangeEvent.CONF_CHANGE_EVENT_PID_PROP); - if (eventPid.length() == 0) { + if (eventPid.isEmpty()) { this.dropdownNotification.show(MSGS.configurationChangeEventNotificationGeneric()); } else { this.dropdownNotification.show(MSGS.configurationChangeEventNotification(eventPid)); @@ -1168,62 +1157,6 @@ private void showStatusPanel() { this.statusBinder.loadStatusData(false); } - @Override - public void addSidenavComponent(final String name, final String icon, final WidgetFactory widgetFactory) { - final AnchorListItem item = new AnchorListItem(name); - - try { - item.setIcon(IconType.valueOf(icon)); - } catch (final Exception e) { - // do nothing - } - - item.addClickHandler(evt -> confirmIfUiDirty(() -> { - EntryClassUi.this.contentPanelBody.clear(); - - forceTabsCleaning(); - EntryClassUi.this.setSelectedAnchorListItem(item); - EntryClassUi.this.contentPanel.setVisible(true); - setHeader(name, null); - EntryClassUi.this.contentPanelBody.clear(); - - EntryClassUi.this.contentPanelBody.add(widgetFactory.buildWidget()); - - EntryClassUi.this.deviceBinder.setSession(EntryClassUi.this.currentSession); - EntryClassUi.this.deviceBinder.initDevicePanel(); - })); - - this.sidenavPills.add(item); - } - - @Override - public void addSettingsComponent(final String name, final WidgetFactory factory) { - this.settingsBinder.addTab(name, factory); - } - - @Override - public void addAuthenticationHandler(final AuthenticationHandler authenticationHandler) { - // unsupported - } - - @Override - public void getXSRFToken(Callback callback) { - this.gwtXSRFService.generateSecurityToken(new AsyncCallback() { - - @Override - public void onSuccess(GwtXSRFToken result) { - callback.onSuccess(result.getToken()); - } - - @Override - public void onFailure(Throwable caught) { - callback.onFailure(caught.getMessage()); - } - - }); - - } - private class WrapperRequest implements Callback, Request { private AsyncCallback wrapped; @@ -1245,24 +1178,6 @@ public void run(RequestContext context) { } - @Override - public Callback startLongRunningOperation() { - - final WrapperRequest callback = new WrapperRequest(); - - RequestQueue.submit(callback); - - return callback; - - } - - @Override - public void showAlertDialog(final String message, final AlertSeverity severity, final Consumer callback) { - this.alertDialog.show(message, - severity == AlertSeverity.INFO ? AlertDialog.Severity.INFO : AlertDialog.Severity.ALERT, - callback::accept); - } - @Override public void onConfigurationChanged() { fetchAvailableServices(); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java new file mode 100644 index 0000000000..d5797874fd --- /dev/null +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.web.client.ui.login; + +import java.util.function.Supplier; + +import com.google.gwt.core.client.Callback; +import com.google.gwt.user.client.ui.Widget; + +public interface AuthenticationHandler { + + public String getName(); + + public Supplier getLoginDialogElement(); + + public void authenticate(final Callback callback); +} diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java index de5f8b6280..7a07652751 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java @@ -12,14 +12,12 @@ *******************************************************************************/ package org.eclipse.kura.web.client.ui.login; -import java.awt.Button; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.function.Consumer; - -import javax.naming.Context; +import java.util.function.Supplier; import org.eclipse.kura.web.client.messages.Messages; import org.eclipse.kura.web.client.ui.AlertDialog; @@ -37,7 +35,9 @@ import org.eclipse.kura.web.shared.service.GwtSecurityTokenServiceAsync; import org.eclipse.kura.web.shared.service.GwtSessionService; import org.eclipse.kura.web.shared.service.GwtSessionServiceAsync; +import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.FormGroup; +import org.gwtbootstrap3.client.ui.Icon; import org.gwtbootstrap3.client.ui.Input; import org.gwtbootstrap3.client.ui.InputGroup; import org.gwtbootstrap3.client.ui.InputGroupAddon; @@ -63,7 +63,7 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; -public class LoginUi extends Composite implements Context { +public class LoginUi extends Composite { private final GwtPasswordAuthenticationServiceAsync pwdAutenticationService = GWT .create(GwtPasswordAuthenticationService.class); @@ -136,8 +136,6 @@ private void initAuthenticationHandlers(final GwtLoginInfo loginInfo) { authenticationMethod.addChangeHandler(e -> setAuthenticationMethod(authenticationMethod.getSelectedItemText())); - ExtensionRegistry.get().addExtensionConsumer(e -> e.onLoad(LoginUi.this)); - } @Override @@ -188,13 +186,13 @@ private void setAuthenticationMethod(final String authenticationMethod) { this.authenticationMethodWidget = null; } - final WidgetFactory factory = this.authenticationHandler.getLoginDialogElement(); + final Supplier factory = this.authenticationHandler.getLoginDialogElement(); if (factory == null) { return; } - this.authenticationMethodWidget = factory.buildWidget(); + this.authenticationMethodWidget = factory.get(); if (this.authenticationMethodWidget != null) { this.loginModalBody.add(this.authenticationMethodWidget); @@ -215,17 +213,6 @@ private void initWaitModal() { this.waitModal.hide(); } - @Override - public void addSidenavComponent(String name, String icon, WidgetFactory element) { - // not supported - } - - @Override - public void addSettingsComponent(String name, WidgetFactory element) { - // not supported - } - - @Override public void addAuthenticationHandler(final AuthenticationHandler authenticationHandler) { final String name = authenticationHandler.getName(); @@ -248,12 +235,6 @@ public void addAuthenticationHandler(final AuthenticationHandler authenticationH this.authenticationMethodGroup.setVisible(this.authenticationHandlers.size() >= 2); } - @Override - public void getXSRFToken(Callback callback) { - callback.onFailure("not supported"); - } - - @Override public Callback startLongRunningOperation() { this.waitModal.show(); return new Callback() { @@ -273,13 +254,6 @@ public void onSuccess(Void result) { }; } - @Override - public void showAlertDialog(String message, AlertSeverity severity, Consumer callback) { - this.alertDialog.show(message, - severity == AlertSeverity.INFO ? AlertDialog.Severity.INFO : AlertDialog.Severity.ALERT, - callback::accept); - } - private class PasswordAuthenticationHandler implements AuthenticationHandler { private final FormGroup group = new FormGroup(); @@ -336,7 +310,7 @@ public String getName() { } @Override - public WidgetFactory getLoginDialogElement() { + public Supplier getLoginDialogElement() { return () -> { this.passwordInput.setValue(""); return this.group; @@ -436,7 +410,7 @@ public String getName() { } @Override - public WidgetFactory getLoginDialogElement() { + public Supplier getLoginDialogElement() { return () -> { final Paragraph paragraph = new Paragraph(); paragraph.setText(MSGS.loginCertificateDescription()); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java index e62fbc5b89..978279fe9a 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java @@ -12,7 +12,6 @@ *******************************************************************************/ package org.eclipse.kura.web.client.ui.security; -import java.awt.Window; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -59,6 +58,7 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; @@ -231,23 +231,6 @@ public boolean isDirty() { || webConsoleDirty || httpServiceDirty; } - public void addTab(final String name, final WidgetFactory widgetFactory) { - - final TabPane tabPane = new TabPane(); - tabPane.setId("__extension__" + name); - - final TabListItem item = new TabListItem(name); - item.setDataTarget("#__extension__" + name); - - item.addClickHandler(e -> { - tabPane.clear(); - tabPane.add(widgetFactory.buildWidget()); - }); - - this.navTabs.add(item); - this.tabContent.add(tabPane); - } - public void setDirty(boolean b) { this.certificateListPanel.setDirty(b); this.sslPanel.setDirty(b); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java index c64f238d4e..d5c825c563 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 Eurotech and/or its affiliates and others + * Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -12,17 +12,16 @@ *******************************************************************************/ package org.eclipse.kura.web.client.ui.settings; -import java.awt.Button; import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.ButtonGroup; - import org.eclipse.kura.web.client.messages.Messages; import org.eclipse.kura.web.client.ui.Tab; import org.eclipse.kura.web.client.ui.Tab.RefreshHandler; import org.eclipse.kura.web.shared.model.GwtSession; import org.gwtbootstrap3.client.ui.Anchor; +import org.gwtbootstrap3.client.ui.Button; +import org.gwtbootstrap3.client.ui.ButtonGroup; import org.gwtbootstrap3.client.ui.Modal; import org.gwtbootstrap3.client.ui.ModalBody; import org.gwtbootstrap3.client.ui.ModalFooter; @@ -30,7 +29,6 @@ import org.gwtbootstrap3.client.ui.NavTabs; import org.gwtbootstrap3.client.ui.TabContent; import org.gwtbootstrap3.client.ui.TabListItem; -import org.gwtbootstrap3.client.ui.TabPane; import org.gwtbootstrap3.client.ui.html.Paragraph; import org.gwtbootstrap3.client.ui.html.Span; @@ -100,23 +98,6 @@ public boolean isDirty() { return this.snapshotsPanel.isDirty(); } - public void addTab(final String name, final WidgetFactory widgetFactory) { - - final TabPane tabPane = new TabPane(); - tabPane.setId("__extension__" + name); - - final TabListItem item = new TabListItem(name); - item.setDataTarget("#__extension__" + name); - - item.addClickHandler(e -> { - tabPane.clear(); - tabPane.add(widgetFactory.buildWidget()); - }); - - this.navTabs.add(item); - this.tabContent.add(tabPane); - } - public void setDirty(boolean b) { this.snapshotsPanel.setDirty(b); diff --git a/target-platform/com.gwt.user/pom.xml b/target-platform/com.gwt.user/pom.xml index 7064f1ce31..de70c5cac8 100644 --- a/target-platform/com.gwt.user/pom.xml +++ b/target-platform/com.gwt.user/pom.xml @@ -64,7 +64,9 @@ jakarta.servlet,jakarta.servlet.http - com.google.gwt.user.server.*,com.google.gwt.user.client.rpc.* + com.google.gwt.user.server.*,com.google.gwt.user.client.rpc.*, + com.google.gwt.i18n.client.*,com.google.gwt.safehtml.shared.*, + com.google.gwt.i18n.shared.* osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" diff --git a/target-platform/p2-repo-equinox/pom.xml b/target-platform/p2-repo-equinox/pom.xml index e6788fb517..c53fe9a0a3 100644 --- a/target-platform/p2-repo-equinox/pom.xml +++ b/target-platform/p2-repo-equinox/pom.xml @@ -270,6 +270,7 @@ +