Example usage for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment.

Prototype

public void setHorizontalAlignment(HorizontalAlignmentConstant align) 

Source Link

Document

Sets the default horizontal alignment to be used for widgets added to this panel.

Usage

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.CustomFormPopUp.java

License:Apache License

public CustomFormPopUp(Image image, String title, CustomFormConfiguration configuration) {
    super(image, title);
    this.configuration = configuration;

    this.externalFrame = new Frame();
    this.externalFrame.setWidth(configuration.getCustomFormWidth() + "px");
    this.externalFrame.setHeight(configuration.getCustomFormHeight() + "px");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.setHeight("100%");
    vp.add(this.externalFrame);

    okButton = new Button(Constants.INSTANCE.OK());

    //cancel button with default handler
    cancelButton = new Button(Constants.INSTANCE.Cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();/*from   w ww . ja v  a 2 s  .c  om*/
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hp.add(okButton);
    hp.add(cancelButton);

    vp.add(hp);

    this.addRow(vp);

}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.factPattern.Connectives.java

License:Apache License

public Widget connectives(SingleFieldConstraint c, String factClass) {
    HorizontalPanel hp = new HorizontalPanel();
    if (c.connectives != null && c.connectives.length > 0) {
        hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        for (int i = 0; i < c.connectives.length; i++) {

            ConnectiveConstraint con = c.connectives[i];

            hp.add(connectiveOperatorDropDown(con));
            hp.add(connectiveValueEditor(con));

            if (!isReadOnly) {
                Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall();
                clear.setAltText(Constants.INSTANCE.RemoveThisRestriction());
                clear.setTitle(Constants.INSTANCE.RemoveThisRestriction());
                clear.addClickHandler(createClickHandlerForClearImageButton(c, i));
                hp.add(clear);/*from   w w  w.  j av  a 2s. co  m*/
            }

        }
    }
    return hp;

}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.templates.RuleTemplateEditor.java

License:Apache License

public RuleTemplateEditor(final Asset asset, final RuleViewer viewer, final ClientFactory clientFactory,
        final EventBus globalEventBus) {

    this.globalEventBus = globalEventBus;
    this.model = (TemplateModel) asset.getContent();
    this.ruleModeller = new RuleModeller(asset, null, clientFactory, eventBus,
            new TemplateModellerWidgetFactory());

    String packageName = asset.getMetaData().getModuleName();
    this.sce = SuggestionCompletionCache.getInstance().getEngineFromCache(packageName);

    final VerticalPanel tPanel = new VerticalPanel();
    tPanel.setWidth("100%");

    tPanel.add(new Button(Constants.INSTANCE.LoadTemplateData(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            int height = (int) (Window.getClientHeight() * 0.7);
            int width = (int) (Window.getClientWidth() * 0.7);

            final FormStylePopup popUp = new FormStylePopup(null, Constants.INSTANCE.TemplateData(), width);

            //Initialise table to edit data
            table = new TemplateDataTableWidget(model, sce, asset.isReadonly(), eventBus);
            table.setPixelSize(width, height);
            popUp.addAttribute("", table);

            Button btnOK = new Button(ConstantsCore.INSTANCE.OK(), new ClickHandler() {
                public void onClick(ClickEvent event) {
                    popUp.hide();//w ww.  ja  va 2  s  .  c o m
                }
            });

            Button btnAddRow = new Button(Constants.INSTANCE.AddRow(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    table.appendRow();
                }

            });

            HorizontalPanel pnlClose = new HorizontalPanel();
            pnlClose.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
            pnlClose.add(btnOK);
            pnlClose.add(btnAddRow);
            popUp.addAttribute("", pnlClose);

            popUp.show();
        }
    }));
    tPanel.add(ruleModeller);
    initWidget(tPanel);
}

From source file:org.drools.guvnor.client.examples.NewRepositoryDialog.java

License:Apache License

public NewRepositoryDialog() {
    setTitle(((ConstantsCore) GWT.create(ConstantsCore.class)).WelcomeToGuvnor());

    constants = ((ConstantsCore) GWT.create(ConstantsCore.class));
    addAttribute("", new HTML("<div class='highlight'>" + constants.BrandNewRepositoryNote() + "</div>")); //NON-NLS

    HorizontalPanel hp = new HorizontalPanel();

    Button ins = new Button(constants.YesPleaseInstallSamples());
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hp.add(ins);/*from   www  .j  a v  a 2  s .  c o  m*/
    Button no = new Button(constants.NoThanks());
    hp.add(no);

    addAttribute("", hp);
    ins.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (!Window.confirm(constants.AboutToInstallSampleRepositoryAreYouSure()))
                return;
            LoadingPopup.showMessage(constants.ImportingAndProcessing());
            ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
            moduleService.installSampleRepository(new GenericCallback<java.lang.Void>() {
                public void onSuccess(Void v) {
                    Window.alert(constants.RepositoryInstalledSuccessfully());
                    hide();
                    Window.Location.reload();
                }
            });
        }
    });
    no.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

}

From source file:org.drools.guvnor.client.explorer.ExplorerViewCenterPanel.java

License:Apache License

private HorizontalPanel createBottomPanel() {
    HorizontalPanel bottomPanel = new HorizontalPanel();
    bottomPanel.setWidth("100%");
    bottomPanel.setStyleName("bottom-panel");
    bottomPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    bottomPanel.add(createCloseAllButton());
    return bottomPanel;
}

From source file:org.drools.guvnor.client.explorer.NewRepoDialog.java

License:Apache License

public NewRepoDialog() {
    setTitle(((Constants) GWT.create(Constants.class)).WelcomeToGuvnor());
    setWidth(300 + "px");

    constants = ((Constants) GWT.create(Constants.class));
    addAttribute("", new HTML("<div class='highlight'>" + constants.BrandNewRepositoryNote() + "</div>")); //NON-NLS

    HorizontalPanel hp = new HorizontalPanel();

    Button ins = new Button(constants.YesPleaseInstallSamples());
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hp.add(ins);// ww  w  . jav  a 2 s .  c o m
    Button no = new Button(constants.NoThanks());
    hp.add(no);

    addAttribute("", hp);
    ins.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (!Window.confirm(constants.AboutToInstallSampleRepositoryAreYouSure()))
                return;
            LoadingPopup.showMessage(constants.ImportingAndProcessing());
            RepositoryServiceFactory.getService()
                    .installSampleRepository(new GenericCallback<java.lang.Void>() {
                        public void onSuccess(Void v) {
                            Window.alert(constants.RepositoryInstalledSuccessfully());
                            hide();
                            Window.Location.reload();
                        }
                    });
        }
    });
    no.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

}

From source file:org.drools.guvnor.client.modeldriven.ui.CustomFormPopUp.java

License:Apache License

public CustomFormPopUp(ImageResource image, String title, CustomFormConfiguration configuration) {
    super(image, title);
    this.configuration = configuration;

    this.externalFrame = new Frame();
    this.externalFrame.setWidth(configuration.getCustomFormWidth() + "px");
    this.externalFrame.setHeight(configuration.getCustomFormHeight() + "px");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.setHeight("100%");
    vp.add(this.externalFrame);

    okButton = new Button(constants.OK());

    //cancel button with default handler
    cancelButton = new Button(constants.Cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();/*from  w  w w.j  av a  2s .  c  o  m*/
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hp.add(okButton);
    hp.add(cancelButton);

    vp.add(hp);

    this.addRow(vp);

}

From source file:org.drools.guvnor.client.modeldriven.ui.RuleTemplateEditor.java

License:Apache License

public RuleTemplateEditor(RuleAsset asset) {
    model = (TemplateModel) asset.content;

    final VerticalPanel tPanel = new VerticalPanel();
    tPanel.setWidth("100%");
    ruleModeller = new RuleModeller(asset, new TemplateModellerWidgetFactory());

    tPanel.add(new Button(constants.LoadTemplateData(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            final FormStylePopup popUp = new FormStylePopup(null, constants.TemplateData(),
                    (int) (Window.getClientWidth() * 0.8));
            popUp.setHeight(((int) (Window.getClientHeight() * 0.8)) + "px");
            popUp.addAttribute("", buildTemplateTable());
            Button close = new Button(constants.Close(), new ClickHandler() {
                public void onClick(ClickEvent event) {
                    popUp.hide();//from   w w  w .java2s  . c om
                }
            });
            HorizontalPanel pnlClose = new HorizontalPanel();
            pnlClose.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
            pnlClose.add(close);
            popUp.addAttribute("", pnlClose);

            popUp.show();
        }
    }));
    tPanel.add(ruleModeller);
    initWidget(tPanel);
}

From source file:org.drools.workbench.screens.guided.rule.client.editor.CustomFormPopUp.java

License:Apache License

public CustomFormPopUp(Image image, String title, CustomFormConfiguration configuration) {
    super(image, title);
    this.configuration = configuration;

    this.externalFrame = new Frame();
    this.externalFrame.setWidth(configuration.getCustomFormWidth() + "px");
    this.externalFrame.setHeight(configuration.getCustomFormHeight() + "px");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.setHeight("100%");
    vp.add(this.externalFrame);

    okButton = new Button(GuidedRuleEditorResources.CONSTANTS.OK());

    //cancel button with default handler
    cancelButton = new Button(GuidedRuleEditorResources.CONSTANTS.Cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();//from  w  w  w . j  a  va 2s  . c  om
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hp.add(okButton);
    hp.add(cancelButton);

    vp.add(hp);

    this.addRow(vp);

}

From source file:org.drools.workbench.screens.guided.rule.client.editor.factPattern.Connectives.java

License:Apache License

public Widget connectives(final SingleFieldConstraint c) {
    final HorizontalPanel hp = new HorizontalPanel();
    if (c.getConnectives() != null && c.getConnectives().length > 0) {
        hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        for (int i = 0; i < c.getConnectives().length; i++) {
            final int index = i;
            final ConnectiveConstraint con = c.getConnectives()[i];
            connectiveOperatorDropDown(con, new Callback<Widget>() {
                @Override//www  . ja v a  2 s  .c o m
                public void callback(final Widget w) {
                    hp.add(w);
                    hp.add(connectiveValueEditor(con));

                    if (!isReadOnly) {
                        Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
                        clear.setAltText(GuidedRuleEditorResources.CONSTANTS.RemoveThisRestriction());
                        clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisRestriction());
                        clear.addClickHandler(createClickHandlerForClearImageButton(c, index));
                        hp.add(clear);
                    }
                }
            });

        }
    }
    return hp;

}