SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/uberfire-client-api/src/main/java/org/uberfire/client/util/Clipboard.java b/uberfire-client-api/src/main/java/org/uberfire/client/util/Clipboard.java
  2. index 09b6e60ce..042a4c27e 100644
  3. --- a/uberfire-client-api/src/main/java/org/uberfire/client/util/Clipboard.java
  4. +++ b/uberfire-client-api/src/main/java/org/uberfire/client/util/Clipboard.java
  5. @@ -18,6 +18,7 @@ package org.uberfire.client.util;
  6.  
  7.  import javax.enterprise.context.Dependent;
  8.  
  9. +import com.google.gwt.user.client.ui.TextArea;
  10.  import elemental2.dom.HTMLInputElement;
  11.  import elemental2.dom.HTMLTextAreaElement;
  12.  
  13. diff --git a/uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.ui.xml b/uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.ui.xml
  14. index 22cadaac2..aa4de1b4c 100644
  15. --- a/uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.ui.xml
  16. +++ b/uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.ui.xml
  17. @@ -18,9 +18,8 @@
  18.               xmlns:g="urn:import:com.google.gwt.user.client.ui"
  19.               xmlns:b="urn:import:org.gwtbootstrap3.client.ui">
  20.  
  21. -  <ui:with field="i18n" type="org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants"/>
  22. -
  23. -  <ui:style>
  24. +  <ui:with field="i18n" type="org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants"/>l
  25. +  <ui:lstyle>
  26.      .mainPanel {
  27.        width: 100%;
  28.      }
  29. @@ -34,7 +33,7 @@
  30.      .buttonGroup {
  31.        text-align: right;
  32.      }
  33. -  </ui:style>
  34. +  </ui:lstyle>
  35.  
  36.    <g:FlowPanel ui:field="mainPanel" addStyleNames="{style.mainPanel}">
  37.  
  38. diff --git a/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.java b/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.java
  39. index f3aa90618..6ee43df33 100644
  40. --- a/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.java
  41. +++ b/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.java
  42. @@ -25,10 +25,9 @@ import com.google.gwt.event.dom.client.ClickEvent;
  43.  import com.google.gwt.uibinder.client.UiBinder;
  44.  import com.google.gwt.uibinder.client.UiField;
  45.  import com.google.gwt.uibinder.client.UiHandler;
  46. -import com.google.gwt.user.client.ui.Composite;
  47. -import com.google.gwt.user.client.ui.HTMLPanel;
  48. -import com.google.gwt.user.client.ui.RequiresResize;
  49. -import com.google.gwt.user.client.ui.Widget;
  50. +import com.google.gwt.user.client.ui.*;
  51. +import elemental2.dom.Document;
  52. +import elemental2.dom.HTMLTextAreaElement;
  53.  import org.gwtbootstrap3.client.ui.Button;
  54.  import org.jboss.errai.common.client.api.Caller;
  55.  import org.jboss.errai.common.client.api.RemoteCallback;
  56. @@ -56,6 +55,8 @@ public class MiscFeaturesView extends Composite
  57.      public HTMLPanel panel;
  58.      @UiField
  59.      Button editor;
  60. +    @UiField
  61. +    TextArea msgArea;
  62.      @Inject
  63.      private Event<NotificationEvent> notification;
  64.  
  65. @@ -66,6 +67,9 @@ public class MiscFeaturesView extends Composite
  66.      @Inject
  67.      private Caller<VFSService> vfsServices;
  68.  
  69. +    @Inject
  70. +    Document document;
  71. +
  72.      @Override
  73.      public void init(final MiscFeaturesPresenter presenter) {
  74.          this.presenter = presenter;
  75. @@ -120,14 +124,32 @@ public class MiscFeaturesView extends Composite
  76.  
  77.      @UiHandler("setNewTitleButton")
  78.      public void onSetNewTitleButtonClick(final ClickEvent event) {
  79. -        presenter.setNewTitle("NewCoolTitle");
  80. +        //presenter.setNewTitle("NewCoolTitle");
  81. +        msgArea.setText("DORINHA");
  82. +
  83. +
  84.      }
  85.  
  86.      @UiHandler("activityNotFound")
  87.      public void onClickActivityNotFound(final ClickEvent event) {
  88. -        placeManager.goTo("some.place.does.not.exists.please!");
  89. +        copy();
  90.      }
  91.  
  92. +    public void copy() {
  93. +        HTMLTextAreaElement test = (HTMLTextAreaElement) document.getElementById("test").firstElementChild;
  94. +        //please use clipboard.java methods instead of this one
  95. +        copy(test);
  96. +    }
  97. +
  98. +    public boolean copy(final HTMLTextAreaElement element) {
  99. +        element.select();
  100. +        return copyNative();
  101. +    }
  102. +
  103. +    private native boolean copyNative() /*-{
  104. +        return $doc.execCommand("Copy");
  105. +    }-*/;
  106. +
  107.      @UiHandler("editor")
  108.      void handleEditor(ClickEvent e) {
  109.          vfsServices.call(new RemoteCallback<Path>() {
  110. diff --git a/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.ui.xml b/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.ui.xml
  111. index 915a468c8..7afa4de63 100644
  112. --- a/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.ui.xml
  113. +++ b/uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.ui.xml
  114. @@ -18,6 +18,12 @@
  115.  <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
  116.               xmlns:g="urn:import:com.google.gwt.user.client.ui"
  117.               xmlns:b="urn:import:org.gwtbootstrap3.client.ui">
  118. +    <ui:style>
  119. +        .textAreaHidden {
  120. +            position:absolute;
  121. +            left:-9999px;"
  122. +        }
  123. +    </ui:style>
  124.  
  125.      <g:HTMLPanel ui:field="panel">
  126.          <div class="container-fluid">
  127. @@ -35,14 +41,19 @@
  128.                      <b:Button ui:field="launchUnknownPlace">Open popup</b:Button>
  129.                      <hr/>
  130.                      <p>Sets a new Title</p>
  131. -                    <b:Button ui:field="setNewTitleButton">New Title</b:Button>
  132. +                    <b:Button ui:field="setNewTitleButton">Set dorinha to text area</b:Button>
  133.                      <hr/>
  134.                      <p>Activity not found</p>
  135. -                    <b:Button ui:field="activityNotFound">Try</b:Button>
  136. +                    <b:Button ui:field="activityNotFound">Copy it</b:Button>
  137.                      <hr/>
  138.                      <p>Uberfire also supports native JavaScript Editors</p>
  139.                      <b:Button text="Launch Editor" ui:field="editor"/>
  140. +                    <span id="test">
  141. +                        <g:TextArea  readOnly="true" ui:field="msgArea" addStyleNames="{style.textAreaHidden}"></g:TextArea>
  142. +                    </span>
  143. +
  144.                  </div>
  145. +
  146.              </div>
  147.          </div>
  148.      </g:HTMLPanel>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top