Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
treblereel committed Jul 5, 2022
1 parent 77a06b4 commit 677c489
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 525 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import org.gwtproject.user.client.ui.IsWidget;
import org.gwtproject.user.client.ui.Widget;
import org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService;
import org.uberfire.client.mvp.UberView;
import org.uberfire.mvp.Command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import com.ait.lienzo.client.widget.panel.impl.ScrollablePanel;
import com.ait.lienzo.tools.client.event.EventType;
import com.ait.lienzo.tools.client.event.MouseEventUtil;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.IsWidget;
import elemental2.dom.Element;
import elemental2.dom.EventListener;
import jsinterop.base.Js;
Expand All @@ -37,6 +34,9 @@
import org.gwtbootstrap3.extras.notify.client.constants.NotifyType;
import org.gwtbootstrap3.extras.notify.client.ui.Notify;
import org.gwtbootstrap3.extras.notify.client.ui.NotifySettings;
import org.gwtproject.safehtml.shared.SafeHtmlBuilder;
import org.gwtproject.timer.client.Timer;
import org.gwtproject.user.client.ui.IsWidget;
import org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoCanvas;
import org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoPanel;
import org.kie.workbench.common.stunner.core.client.components.views.FloatingView;
Expand Down Expand Up @@ -73,7 +73,7 @@ public class AlertsPresenter {
public AlertsPresenter(final FloatingView<IsWidget> floatingView,
final Alerts alerts,
final ClientTranslationService clientTranslationService) {
this(floatingView, alerts, Js.cast(alerts.asWidget().getElement()), clientTranslationService);
this(floatingView, alerts, Js.uncheckedCast(alerts.asWidget().getElement()), clientTranslationService);
}

AlertsPresenter(final FloatingView<IsWidget> floatingView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import javax.inject.Named;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.Composite;
import org.jboss.errai.common.client.dom.Button;
import org.jboss.errai.common.client.dom.Span;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import elemental2.dom.Event;
import elemental2.dom.HTMLButtonElement;
import elemental2.dom.HTMLElement;
import io.crysknife.ui.templates.client.annotation.DataField;
import io.crysknife.ui.templates.client.annotation.EventHandler;
import io.crysknife.ui.templates.client.annotation.ForEvent;
import io.crysknife.ui.templates.client.annotation.Templated;
import org.gwtproject.user.client.ui.Composite;

@Dependent
@Templated
Expand All @@ -40,27 +42,30 @@ public class AlertsView

@Inject
@DataField
Button infoButton;
HTMLButtonElement infoButton;

@Inject
@DataField
Span infoText;
@Named("span")
HTMLElement infoText;

@Inject
@DataField
Button warningButton;
HTMLButtonElement warningButton;

@Inject
@DataField
Span warningText;
@Named("span")
HTMLElement warningText;

@Inject
@DataField
Button errorButton;
HTMLButtonElement errorButton;

@Inject
@DataField
Span errorText;
@Named("span")
HTMLElement errorText;

private Alerts presenter;

Expand All @@ -71,7 +76,7 @@ public void init(final Alerts presenter) {

@Override
public void setInfoText(String text) {
infoText.setTextContent(text);
infoText.textContent = text;
}

@Override
Expand All @@ -81,21 +86,21 @@ public void setInfoTooltip(String text) {

@Override
public void setInfoEnabled(boolean enabled) {
infoButton.setDisabled(!enabled);
infoButton.disabled = !enabled;
}

@Override
public void setInfoVisible(boolean visible) {
if (visible) {
infoButton.getStyle().setProperty(VISIBILITY, VISIBLE);
infoButton.style.visibility = VISIBLE;
} else {
infoButton.getStyle().setProperty(VISIBILITY, HIDDEN);
infoButton.style.visibility = HIDDEN;
}
}

@Override
public void setWarningsText(String text) {
warningText.setTextContent(text);
warningText.textContent = text;
}

@Override
Expand All @@ -105,21 +110,21 @@ public void setWarningsTooltip(String text) {

@Override
public void setWarningsEnabled(boolean enabled) {
warningButton.setDisabled(!enabled);
warningButton.disabled = !enabled;
}

@Override
public void setWarningsVisible(boolean visible) {
if (visible) {
warningButton.getStyle().setProperty(VISIBILITY, VISIBLE);
warningButton.style.visibility = VISIBLE;
} else {
warningButton.getStyle().setProperty(VISIBILITY, HIDDEN);
warningButton.style.visibility = HIDDEN;
}
}

@Override
public void setErrorsText(String text) {
errorText.setTextContent(text);
errorText.textContent = text;
}

@Override
Expand All @@ -129,30 +134,30 @@ public void setErrorsTooltip(String text) {

@Override
public void setErrorsEnabled(boolean enabled) {
errorButton.setDisabled(!enabled);
errorButton.disabled = (!enabled);
}

@Override
public void setErrorsVisible(boolean visible) {
if (visible) {
errorButton.getStyle().setProperty(VISIBILITY, VISIBLE);
errorButton.style.visibility = VISIBLE;
} else {
errorButton.getStyle().setProperty(VISIBILITY, HIDDEN);
errorButton.style.visibility = HIDDEN;
}
}

@EventHandler("infoButton")
void onShowInfos(ClickEvent event) {
void onShowInfos(@ForEvent("click") Event event) {
presenter.onShowInfos();
}

@EventHandler("warningButton")
void onShowWarnings(ClickEvent event) {
void onShowWarnings(@ForEvent("click") Event event) {
presenter.onShowWarnings();
}

@EventHandler("errorButton")
void onShowErrors(ClickEvent event) {
void onShowErrors(@ForEvent("click") Event event) {
presenter.onShowErrors();
}

Expand All @@ -161,9 +166,9 @@ public void destroy() {
presenter = null;
}

private static void setTooltip(final Button button,
private static void setTooltip(final HTMLButtonElement button,
final String text) {
button.setAttribute("data-placement", "top");
button.setTitle(text);
button.title = text;
}
}
Loading

0 comments on commit 677c489

Please sign in to comment.