Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
BZ-1066483: making form modeler editor resizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
pefernan committed Mar 3, 2014
1 parent b3d6563 commit 71b6d2d
Showing 1 changed file with 17 additions and 7 deletions.
Expand Up @@ -16,13 +16,13 @@
package org.jbpm.formModeler.editor.client.editors;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.RequiresResize;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants;
Expand All @@ -35,11 +35,10 @@
@Templated(value = "FormModelerPanelViewImpl.html")
public class FormModelerPanelViewImpl extends Composite
implements
FormModelerPanelView {
FormModelerPanelView, RequiresResize {

final static private String GWT_DEFAULT_LOCALE = "default";
final static private String FORM_MODELER_DEFAULT_LOCALE = "en";
final static private String HEIGHT_100P = "100%";

private FormModelerPanelPresenter presenter;

Expand Down Expand Up @@ -78,9 +77,7 @@ public void hideForm() {

@Override
public void loadContext(String ctxUID) {
String height = getParent().getOffsetHeight() - 30 + "px";
this.setHeight(height);
frame.setHeight(height);
doOnResize();
String localeName = LocaleInfo.getCurrentLocale().getLocaleName();
if (GWT_DEFAULT_LOCALE.equals(localeName)) localeName = FORM_MODELER_DEFAULT_LOCALE;
frame.setUrl(UriUtils.fromString(GWT.getModuleBaseURL() + "Controller?_fb=wysiwygfe&_fp=Start&ctxUID=" + ctxUID + "&locale=" + localeName).asString());
Expand All @@ -91,6 +88,19 @@ public void loadContext(String ctxUID) {
public void showCanNotSaveReadOnly() {
Window.alert(CommonConstants.INSTANCE.CantSaveReadOnly());
}

@Override
public void onResize() {
doOnResize();
}

protected void doOnResize() {
final Widget w = getParent();
final int width = w.getOffsetWidth();
final int height = w.getOffsetHeight();
frame.setWidth( width + "px" );
frame.setHeight(height + "px");
}
}


0 comments on commit 71b6d2d

Please sign in to comment.