Example usage for com.google.gwt.user.client.ui LayoutPanel LayoutPanel

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

Introduction

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

Prototype

public LayoutPanel() 

Source Link

Document

Creates an empty layout panel.

Usage

From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java

License:Apache License

/**
 * Creates an empty tab panel./*from w w w . j a va  2  s.  c o m*/
 *
 * @param barHeight the size of the tab bar
 * @param barUnit the unit in which the tab bar size is specified
 */
public TabLayoutPanelCopy(double barHeight, Unit barUnit) {
    LayoutPanel panel = new LayoutPanel();
    initWidget(panel);

    // Add the tab bar to the panel.
    panel.add(tabBar);
    panel.setWidgetLeftRight(tabBar, 0, Unit.PX, 0, Unit.PX);
    panel.setWidgetTopHeight(tabBar, 0, Unit.PX, barHeight, barUnit);
    panel.setWidgetVerticalPosition(tabBar, Alignment.END);

    // Add the deck panel to the panel.
    // CHANGE4: styles again: deckPanel.addStyleName(CONTENT_CONTAINER_STYLE);
    panel.add(deckPanel);
    panel.setWidgetLeftRight(deckPanel, 0, Unit.PX, 0, Unit.PX);
    panel.setWidgetTopBottom(deckPanel, barHeight, barUnit, 0, Unit.PX);

    // Make the tab bar extremely wide so that tabs themselves never wrap.
    // (Its layout container is overflow:hidden)

    // CHANGE5: Adapt the TabBar Style element to our needs
    Style tabBarStyle = tabBar.getElement().getStyle();
    tabBarStyle.setHeight(barHeight, barUnit);
    tabBarStyle.setWidth(BIG_ENOUGH_TO_NOT_WRAP, Unit.PX);

    // CHANGE6: We don't want the standard GWT styles
    // tabBar.setStyleName("gwt-TabLayoutPanelTabs");
    // setStyleName("gwt-TabLayoutPanel");
}

From source file:cc.kune.initials.AvatarComposite.java

License:GNU Affero Public License

public AvatarComposite(final Builder builder, final int[][] sizes, final int[] fontSizes,
        final List<IsWidget> widgets) {
    final LayoutPanel panel = new LayoutPanel();
    final int fullSize = builder.getSize();
    panel.setSize(fullSize + "px", fullSize + "px");
    for (int i = 0; i < widgets.size(); i++) {
        final int top = sizes[i][0];
        final int height = sizes[i][1];
        final int left = sizes[i][2];
        final int width = sizes[i][3];
        final int finalWidth = width - left;
        final int finalHeight = height - top;
        final IsWidget widget = widgets.get(i);
        IsWidget wrap = widget;//from w  w  w.ja v  a2s .c o  m
        if (widget instanceof InitialLabel) {
            ((InitialLabel) widget).setStyle(height, fontSizes[i]);
        } else if (widget instanceof Image) {
            // If is an image, we crop/resize in the center of the image
            wrap = ImagesHelper.cropResize((Image) widget, fullSize, finalWidth, finalHeight);
        }
        panel.add(wrap);
        panel.setWidgetTopHeight(wrap, top, PX, height, PX);
        panel.setWidgetLeftWidth(wrap, left, PX, width, PX);
    }
    initWidget(panel);
}

From source file:com.calclab.hablar.core.client.pages.accordion.AccordionPanel.java

License:Apache License

/**
 * Creates an empty stack panel./*from   ww  w.  j av a  2  s .co m*/
 * 
 * @param unit
 *            the unit to be used for layout
 */
public AccordionPanel() {
    this.unit = Unit.PX;
    initWidget(layoutPanel = new LayoutPanel());
    layoutPanel.addStyleName("hablar-AccordionPanel");
}

From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleSiteManager.java

public void initialize(RootLayoutPanel rootPanel) {
    // XXX allocate different areas in root panel
    root = rootPanel;/*from   ww w .  j  a v a 2  s .co  m*/
    // dock = new DockLayoutPanel(Unit.PX);
    dock = dockPresenter.getDisplay().getDock();
    // dock = dock.addNorth(new HTML("<h1>(Header) "
    // + sessionManager.getSession().getLoginName() + "</h1>"), 100);
    // dock.addSouth(new HTML("<em>Footer</em>"), 50);
    // FIXME 20111130
    dockPresenter.getDisplay().setMessage(sessionManager.getSession().getLoginName());
    // menu = new LayoutPanel();
    menu = dockPresenter.getDisplay().getMenu();
    // dock.addWest(menu, 200);

    // initialize editors area.
    editor = new LayoutPanel();
    editor.setVisible(false);
    dock.add(editor);

    dockPresenter.bind();
    rootPanel.add(dockPresenter.getDisplay().asWidget());

    hookEditorCloseEvent();
    hookHistoryEvent();
    hookMenuClickEvent();
}

From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleSiteManager.java

public void initializeStaff(RootLayoutPanel rootPanel) {
    dockPresenter.unbind();/*from ww w .  j  a v  a 2  s . com*/
    // XXX allocate different areas in root panel
    root = rootPanel;
    // dock = new DockLayoutPanel(Unit.PX);
    // dock = dock.addNorth(new HTML("<h1>(Header) "
    // + sessionManager.getSession().getLoginName() + "</h1>"), 100);
    // dock.addSouth(new HTML("<em>Footer</em>"), 50);
    // FIXME 20111130
    menu = new LayoutPanel();
    // menu = staffPresenter.getDisplay().getMenu();
    // dock.addWest(menu, 200);

    // initialize editors area.
    editor = new FlowPanel();
    editor.setVisible(false);
    dock.add(editor);

    hookEditorCloseEvent();
    hookHistoryEvent();
    hookMenuClickEvent();
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.BatchClassManagementView.java

License:Open Source License

/**
 * Constructor./*from w ww  .j  a  v a  2 s  .  c  o  m*/
 * 
 * @param eventBus HandlerManager
 */
public BatchClassManagementView(HandlerManager eventBus) {
    super();
    initWidget(BINDER.createAndBindUi(this));

    editModulesPluginSelectView = new ConfigureModulesPluginSelectView(eventBus);
    addModuleView = new ConfigureModuleView(eventBus);

    editModulesPluginSelectViewLayoutPanel.add(editModulesPluginSelectView);
    addModulesViewLayoutPanel.add(addModuleView);
    Button edit = new Button();
    copy = new Button();
    Button delete = new Button();
    Button export = new Button();
    importButton = new Button();
    bottomPanel.addStyleName("leftPadding");
    bottomPanel.addStyleName("fullWidth");
    edit.setText(AdminConstants.EDIT_BUTTON);
    copy.setText(AdminConstants.COPY_BUTTON);
    delete.setText(AdminConstants.DELETE_BUTTON);
    export.setText(AdminConstants.EXPORT_BUTTON);
    importButton.setText(AdminConstants.IMPORT_BUTTON);
    apply.setText(AdminConstants.APPLY_BUTTON);

    validate.setText(VALIDATE);
    validate.addStyleName(BUTTON_STYLE);

    buttonPanel = new HorizontalPanel();
    buttonPanel.setWidth("100%");
    buttonPanel.setSpacing(BatchClassManagementConstants.FIVE);
    buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    buttonPanel.setVerticalAlignment(HasAlignment.ALIGN_TOP);
    buttonPanel.add(export);
    buttonPanel.add(importButton);
    buttonPanel.add(edit);
    buttonPanel.setCellWidth(edit, "95%");
    buttonPanel.add(new Label(BatchClassManagementConstants.EMPTY_STRING));
    buttonPanel.add(copy);
    buttonPanel.add(new Label(BatchClassManagementConstants.EMPTY_STRING));
    buttonPanel.add(delete);

    batchListPanel = new LayoutPanel();
    batchClassListView = new BatchClassListView();
    batchClassFieldListView = new BatchClassFieldListView();
    batchListPanel.add(batchClassListView.listView);
    submit.setText(AdminConstants.SAVE_BUTTON);
    cancel.setText(AdminConstants.CANCEL_BUTTON);
    deploy.setText(AdminConstants.DEPLOY_BUTTON);
    learn.setText(AdminConstants.LEARN_FILES_BUTTON);
    sample.setText(AdminConstants.GENERATE_FOLDERS_BUTTON);
    learnDB.setText(AdminConstants.LEARN_DB_BUTTON);
    bottomButtons.setVisible(false);
    batchClassBreadCrumbView.setVisible(false);
    toggleDeployButtonEnable(false);

    edit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            presenter.onEditButtonClicked();
        }
    });

    copy.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(
                        LocaleDictionary.get().getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_COPY));
                return;
            }
            final DialogBox dialogBox = new DialogBox();
            final CopyBatchClassView copyBatchClassView = new CopyBatchClassView();
            CopyBatchClassPresenter copyBatchClassPresenter = new CopyBatchClassPresenter(
                    presenter.getController(), copyBatchClassView);
            copyBatchClassPresenter
                    .setBatchClassDTO(presenter.getController().getBatchClassByIdentifier(identifier));
            copyBatchClassView.setDialogBox(dialogBox);
            copyBatchClassPresenter.bind();
            copyBatchClassPresenter.showBatchClassCopyView();
            copyBatchClassView.getSaveButton().setFocus(true);
        }
    });

    importButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            presenter.onImportButtonClicked();

        }
    });

    export.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                        .getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_EXPORT));
                return;
            }
            presenter.onExportButtonClicked(identifier);
        }
    });

    delete.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            final String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                        .getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_DELETE));
                return;
            }
            final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(
                    LocaleDictionary.get()
                            .getMessageValue(BatchClassManagementMessages.DELETE_BATCH_CLASS_CONFORMATION),
                    LocaleDictionary.get().getConstantValue(
                            BatchClassManagementConstants.DELETE_BATCH_CLASS_TITLE),
                    Boolean.FALSE);

            confirmationDialog.addDialogListener(new DialogListener() {

                @Override
                public void onOkClick() {
                    confirmationDialog.hide();
                    presenter.onDeleteButtonClicked(identifier);
                }

                @Override
                public void onCancelClick() {
                    confirmationDialog.hide();
                }
            });

        }
    });
}

From source file:com.ephesoft.dcma.gwt.admin.client.AdminEntryPoint.java

License:Open Source License

/**
 * To perform operations on load.//from w w w  .ja v  a  2 s  .com
 */
@Override
public void onLoad() {
    LayoutPanel layoutPanel = new LayoutPanel();
    layoutPanel.add(getMainView());

    final RootPanel rootPanel = new RootPanel(layoutPanel, rpcService);
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().addNonClickableTab("Batch Class Management", "BatchClassManagement.html");
    rootPanel.getHeader().addTab("Batch Instance Management", "BatchInstanceManagement.html", false);
    rootPanel.getHeader().addTab("Workflow Management", "CustomWorkflowManagement.html", false);
    rootPanel.getHeader().addTab("Folder Management", "FolderManager.html", false);
    rpcService.isReportingEnabled(new AsyncCallback<Boolean>() {

        @Override
        public void onFailure(Throwable arg0) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onSuccess(Boolean isReportingEnabled) {
            if (isReportingEnabled) {
                rootPanel.getHeader().addTab("Reports", "Reporting.html", false);
            }
        }
    });
    rootPanel.getHeader().getTabBar().selectTab(0);

    rpcService.getUserName(new AsyncCallback<String>() {

        @Override
        public void onSuccess(String userName) {
            rootPanel.getHeader().setUserName(userName);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void onFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
        }
    });

    RootLayoutPanel.get().add(rootPanel);
}

From source file:com.ephesoft.dcma.gwt.batchinstance.client.BatchInstance.java

License:Open Source License

/**
 * Processing to be done on load./*ww w.  j  ava2s .  c  o  m*/
 */
@Override
public void onLoad() {
    LayoutPanel layoutPanel = new LayoutPanel();
    BatchInstanceController controller = new BatchInstanceController(eventBus, rpcService);
    layoutPanel.add(controller.createView());

    final RootPanel rootPanel = new RootPanel(layoutPanel, rpcService);
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().addTab("Batch Class Management", "BatchClassManagement.html", false);
    rootPanel.getHeader().addNonClickableTab("Batch Instance Management", "BatchInstanceManagement.html");
    rootPanel.getHeader().addTab("Workflow Management", "CustomWorkflowManagement.html", false);
    rootPanel.getHeader().addTab("Folder Management", "FolderManager.html", false);
    rootPanel.getHeader().getTabBar().selectTab(1);
    ScreenMaskUtility.maskScreen();

    rpcService.isReportingEnabled(new EphesoftAsyncCallback<Boolean>() {

        @Override
        public void customFailure(Throwable arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSuccess(Boolean isReportingEnabled) {
            if (isReportingEnabled) {
                rootPanel.getHeader().addTab("Reports", "Reporting.html", false);
            }

        }
    });

    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(String userName) {
            rootPanel.getHeader().setUserName(userName);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void customFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
        }
    });

    RootLayoutPanel.get().add(rootPanel);
}

From source file:com.ephesoft.dcma.gwt.customworkflow.client.CustomWorkflowEntryPoint.java

License:Open Source License

@Override
public void onLoad() {

    CustomWorkflowController customWorkflowController = null;

    LayoutPanel layoutPanel = new LayoutPanel();
    customWorkflowController = new CustomWorkflowController(eventBus, rpcService);
    layoutPanel.add(customWorkflowController.createView());

    final RootPanel rootPanel = new RootPanel(layoutPanel, rpcService);
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().addTab("Batch Class Management", "BatchClassManagement.html", false);
    rootPanel.getHeader().addTab("Batch Instance Management", "BatchInstanceManagement.html", false);
    rootPanel.getHeader().addNonClickableTab("Workflow Management", "CustomWorkflowManagement.html");
    rootPanel.getHeader().addTab("Folder Management", "FolderManager.html", false);
    ScreenMaskUtility.maskScreen();/* www  .jav  a2  s . c  o  m*/
    rpcService.isReportingEnabled(new EphesoftAsyncCallback<Boolean>() {

        @Override
        public void customFailure(Throwable arg0) {
            /**
             * NO specific failure handling
             */
        }

        @Override
        public void onSuccess(Boolean isReportingEnabled) {
            if (isReportingEnabled) {
                rootPanel.getHeader().addTab("Reports", "Reporting.html", false);
            }

        }
    });
    rootPanel.getHeader().getTabBar().selectTab(2);
    rootPanel.getHeader().setEventBus(eventBus);

    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(final String userName) {
            rootPanel.getHeader().setUserName(userName);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void customFailure(final Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
        }
    });
    RootLayoutPanel.get().add(rootPanel);
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.FolderManager.java

License:Open Source License

@Override
public void onLoad() {
    LayoutPanel layoutPanel = new LayoutPanel();
    controller = new FolderManagementController(eventBus, rpcService);
    layoutPanel.add(controller.createView());

    final RootPanel rootPanel = new RootPanel(layoutPanel, rpcService);
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().addTab("Batch Class Management", "BatchClassManagement.html", false);
    rootPanel.getHeader().addTab("Batch Instance Management", "BatchInstanceManagement.html", false);
    rootPanel.getHeader().addTab("Workflow Management", "CustomWorkflowManagement.html", false);
    rootPanel.getHeader().addNonClickableTab("Folder Management", "FolderManager.html");
    ScreenMaskUtility.maskScreen();//from w  w  w . j  av  a 2 s . c  o  m

    rpcService.isReportingEnabled(new EphesoftAsyncCallback<Boolean>() {

        @Override
        public void customFailure(Throwable arg0) {
            //reporting is optional. Hence doing nothing on failure of getting whether reporting is enabled.
        }

        @Override
        public void onSuccess(Boolean isReportingEnabled) {
            if (isReportingEnabled) {
                rootPanel.getHeader().addTab("Reports", "Reporting.html", false);
            }

        }
    });

    rootPanel.getHeader().getTabBar().selectTab(3);
    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(String userName) {
            if (userName != null) {
                rootPanel.getHeader().setUserName(userName);
            }
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void customFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
        }
    });

    RootLayoutPanel.get().add(rootPanel);
}