Search in sources :

Example 1 with FillLayout

use of com.extjs.gxt.ui.client.widget.layout.FillLayout in project kapua by eclipse.

the class KapuaCloudConsole method renderLoginDialog.

private void renderLoginDialog() {
    final Viewport viewport = new Viewport();
    final BorderLayout borderLayout = new BorderLayout();
    viewport.setLayout(borderLayout);
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        viewport.setStyleName("login");
    } else {
        viewport.setStyleName("login-ie8");
    }
    // 
    // center
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));
    centerData.setCollapsible(false);
    centerData.setFloatable(false);
    centerData.setHideCollapseTool(false);
    centerData.setSplit(false);
    LayoutContainer splash = new LayoutContainer(new FillLayout());
    viewport.add(splash, centerData);
    // 
    // north
    SimplePanel ethLogo = new SimplePanel();
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        ethLogo.setStyleName("ethLogo");
    } else {
        ethLogo.setStyleName("ethLogo-ie8");
    }
    SimplePanel cloudLogo = new SimplePanel();
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        cloudLogo.setStyleName("cloudLogo");
    } else {
        cloudLogo.setStyleName("cloudLogo-ie8");
    }
    TableLayout layout = new TableLayout(2);
    layout.setWidth("100%");
    LayoutContainer lcFooter = new LayoutContainer(layout);
    if (!UserAgentUtils.isIE() || UserAgentUtils.getIEDocumentMode() > 8) {
        lcFooter.setStyleName("loginBanner");
    } else {
        lcFooter.setStyleName("loginBanner-ie8");
    }
    lcFooter.add(cloudLogo, new TableData(Style.HorizontalAlignment.LEFT, Style.VerticalAlignment.BOTTOM));
    lcFooter.add(ethLogo, new TableData(Style.HorizontalAlignment.RIGHT, Style.VerticalAlignment.BOTTOM));
    BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 72);
    northData.setCollapsible(false);
    northData.setFloatable(false);
    northData.setHideCollapseTool(false);
    northData.setSplit(false);
    northData.setMargins(new Margins(0));
    viewport.add(lcFooter, northData);
    RootPanel.get().add(viewport);
    // Dialog window
    final LoginDialog loginDialog = new LoginDialog();
    loginDialog.addListener(Events.Hide, new Listener<ComponentEvent>() {

        public void handleEvent(ComponentEvent be) {
            if (loginDialog.isAllowMainScreen()) {
                currentSession = loginDialog.getCurrentSession();
                if (currentSession != null) {
                    String username = currentSession.getGwtUser().getUsername();
                    if (username != null) {
                        // 
                        // Enter into the normal viewport
                        RootPanel.get().remove(viewport);
                        render(currentSession);
                    } else {
                        ConsoleInfo.display(MSGS.error(), MSGS.loginError());
                        loginDialog.show();
                    }
                } else {
                    ConsoleInfo.display(MSGS.error(), MSGS.loginError());
                    loginDialog.show();
                }
            }
        }
    });
    if (!UserAgentUtils.isIE()) {
        Window.addResizeHandler(new ResizeHandler() {

            public void onResize(ResizeEvent arg0) {
                loginDialog.center();
            }
        });
    }
    loginDialog.show();
}
Also used : BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) Viewport(com.extjs.gxt.ui.client.widget.Viewport) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent) BorderLayout(com.extjs.gxt.ui.client.widget.layout.BorderLayout) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) Margins(com.extjs.gxt.ui.client.util.Margins) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent) TableData(com.extjs.gxt.ui.client.widget.layout.TableData) TableLayout(com.extjs.gxt.ui.client.widget.layout.TableLayout)

Example 2 with FillLayout

use of com.extjs.gxt.ui.client.widget.layout.FillLayout in project kura by eclipse.

the class WirelessConfigTab method createWifiNetworksWindow.

private Window createWifiNetworksWindow() {
    final Window window = new Window();
    window.setSize(700, 400);
    window.setPlain(true);
    window.setModal(true);
    window.setBlinkModal(true);
    window.setHeading("Wireless Networks");
    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    window.add(dialogContents);
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig column = null;
    column = new ColumnConfig("ssid", "SSID", 100);
    column.setAlignment(HorizontalAlignment.LEFT);
    configs.add(column);
    column = new ColumnConfig("macAddress", "MAC Address", 100);
    column.setAlignment(HorizontalAlignment.CENTER);
    configs.add(column);
    column = new ColumnConfig("signalStrength", "Signal (dBm)", 100);
    column.setAlignment(HorizontalAlignment.CENTER);
    configs.add(column);
    column = new ColumnConfig("channel", "Channel", 100);
    column.setAlignment(HorizontalAlignment.CENTER);
    configs.add(column);
    column = new ColumnConfig("frequency", "Frequency", 100);
    column.setAlignment(HorizontalAlignment.CENTER);
    configs.add(column);
    column = new ColumnConfig("security", "Security", 100);
    column.setAlignment(HorizontalAlignment.LEFT);
    configs.add(column);
    /*
        CheckColumnConfig checkColumn = new CheckColumnConfig("selectAP", "Select", 55);
        CellEditor checkBoxEditor = new CellEditor(new CheckBox());  
        checkColumn.setEditor(checkBoxEditor);
        configs.add(checkColumn); 
		 */
    // rpc data proxy
    RpcProxy<ListLoadResult<GwtWifiHotspotEntry>> proxy = new RpcProxy<ListLoadResult<GwtWifiHotspotEntry>>() {

        @Override
        protected void load(Object loadConfig, final AsyncCallback<ListLoadResult<GwtWifiHotspotEntry>> callback) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

                @Override
                public void onFailure(Throwable ex) {
                    FailureHandler.handle(ex);
                }

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtNetworkService.findWifiHotspots(token, m_selectNetIfConfig.getName(), callback);
                }
            });
        }
    };
    m_wifiHotspotLoader = new BaseListLoader<ListLoadResult<GwtWifiHotspotEntry>>(proxy);
    m_wifiHotspotLoader.setSortDir(SortDir.ASC);
    m_wifiHotspotLoader.setSortField("signalStrength");
    // m_wifiHotspotLoader.setRemoteSort(true);
    SwappableListStore<GwtWifiHotspotEntry> store = new SwappableListStore<GwtWifiHotspotEntry>(m_wifiHotspotLoader);
    store.setKeyProvider(new ModelKeyProvider<GwtWifiHotspotEntry>() {

        public String getKey(GwtWifiHotspotEntry wifiHotspotEntry) {
            return wifiHotspotEntry.getSignalStrength().toString();
        }
    });
    m_grid = new Grid<GwtWifiHotspotEntry>(store, new ColumnModel(configs));
    m_grid.setBorders(false);
    m_grid.setStateful(false);
    m_grid.setLoadMask(true);
    m_grid.setStripeRows(true);
    m_grid.setColumnLines(true);
    m_grid.setColumnReordering(true);
    m_grid.setAutoExpandColumn("ssid");
    m_grid.getView().setAutoFill(true);
    // m_grid.addPlugin(checkColumn);
    m_wifiHotspotLoader.addLoadListener(new DataLoadListener(m_grid));
    GridSelectionModel<GwtWifiHotspotEntry> selectionModel = new GridSelectionModel<GwtWifiHotspotEntry>();
    selectionModel.setSelectionMode(SelectionMode.SINGLE);
    m_grid.setSelectionModel(selectionModel);
    // m_grid.addPlugin(selectionModel);
    m_grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GwtWifiHotspotEntry>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GwtWifiHotspotEntry> se) {
            if (se != null) {
                List<GwtWifiHotspotEntry> list = se.getSelection();
                if ((list != null) && (list.size() > 0)) {
                    GwtWifiHotspotEntry wifiHotspotEntry = list.get(0);
                    if (wifiHotspotEntry != null) {
                        m_ssidField.setValue(GwtSafeHtmlUtils.htmlUnescape(wifiHotspotEntry.getSSID()));
                        String security = wifiHotspotEntry.getSecurity();
                        if (security.equals("None")) {
                            m_securityCombo.setSimpleValue(MessageUtils.get(GwtWifiSecurity.netWifiSecurityNONE.name()));
                        } else if (security.equals("WEP")) {
                            m_securityCombo.setSimpleValue(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWEP.name()));
                        } else if (security.equals("WPA")) {
                            m_securityCombo.setSimpleValue(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWPA.name()));
                        } else if (security.equals("WPA2") || security.equals("WPA/WPA2")) {
                            m_securityCombo.setSimpleValue(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWPA2.name()));
                        } else {
                            m_securityCombo.setSimpleValue(MessageUtils.get(GwtWifiSecurity.netWifiSecurityNONE.name()));
                        }
                        if (security.equals("WPA") || security.equals("WPA2") || security.equals("WPA/WPA2")) {
                            GwtWifiCiphers pairwiseCiphers = wifiHotspotEntry.getPairwiseCiphersEnum();
                            if (pairwiseCiphers == GwtWifiCiphers.netWifiCiphers_TKIP) {
                                m_pairwiseCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_TKIP.name()));
                            } else if (pairwiseCiphers == GwtWifiCiphers.netWifiCiphers_CCMP) {
                                m_pairwiseCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP.name()));
                            } else if (pairwiseCiphers == GwtWifiCiphers.netWifiCiphers_CCMP_TKIP) {
                                m_pairwiseCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP_TKIP.name()));
                            } else {
                                // let's set it for CCMP TKIP
                                m_pairwiseCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP_TKIP.name()));
                            }
                            GwtWifiCiphers groupCiphers = wifiHotspotEntry.getGroupCiphersEnum();
                            if (groupCiphers == GwtWifiCiphers.netWifiCiphers_TKIP) {
                                m_groupCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_TKIP.name()));
                            } else if (groupCiphers == GwtWifiCiphers.netWifiCiphers_CCMP) {
                                m_groupCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP.name()));
                            } else if (groupCiphers == GwtWifiCiphers.netWifiCiphers_CCMP_TKIP) {
                                m_groupCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP_TKIP.name()));
                            } else {
                                // let's set it for CCMP TKIP
                                m_groupCiphersCombo.setSimpleValue(MessageUtils.get(GwtWifiCiphers.netWifiCiphers_CCMP_TKIP.name()));
                            }
                        }
                        // deselect all channels
                        for (int channel = 1; channel <= MAX_WIFI_CHANNEL; channel++) {
                            m_checkboxChannelSelectionModel.deselect(channel - 1);
                        }
                        // select proper channels
                        m_checkboxChannelSelectionModel.select(wifiHotspotEntry.getChannel() - 1, true);
                        window.hide();
                    }
                }
            }
        }
    });
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Wireless Networks in Range");
    cp.setFrame(true);
    cp.setSize(680, 365);
    FillLayout layout = new FillLayout();
    layout.setAdjustForScroll(true);
    cp.setLayout(layout);
    cp.add(m_grid);
    dialogContents.add(cp);
    window.add(dialogContents);
    return window;
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) GwtWifiCiphers(org.eclipse.kura.web.shared.model.GwtWifiCiphers) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) ArrayList(java.util.ArrayList) GwtXSRFToken(org.eclipse.kura.web.shared.model.GwtXSRFToken) RpcProxy(com.extjs.gxt.ui.client.data.RpcProxy) SwappableListStore(org.eclipse.kura.web.client.util.SwappableListStore) NodeList(com.google.gwt.dom.client.NodeList) List(java.util.List) ArrayList(java.util.ArrayList) Window(com.extjs.gxt.ui.client.widget.Window) GridSelectionModel(com.extjs.gxt.ui.client.widget.grid.GridSelectionModel) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) ListLoadResult(com.extjs.gxt.ui.client.data.ListLoadResult) VerticalPanel(com.extjs.gxt.ui.client.widget.VerticalPanel) GwtWifiHotspotEntry(org.eclipse.kura.web.shared.model.GwtWifiHotspotEntry) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel)

Example 3 with FillLayout

use of com.extjs.gxt.ui.client.widget.layout.FillLayout in project jahia by Jahia.

the class LayoutTabItem method attachPropertiesEditor.

@Override
public void attachPropertiesEditor(final NodeHolder engine, final AsyncTabItem tab) {
    if (engine.getNode() != null && engine.getLinker() instanceof EditLinker) {
        final PropertiesEditor.PropertyAdapterField templateField = propertiesEditor.getFieldsMap().get("j:view");
        final PropertiesEditor.PropertyAdapterField skinField = propertiesEditor.getFieldsMap().get("j:skin");
        final PropertiesEditor.PropertyAdapterField subNodesViewField = propertiesEditor.getFieldsMap().get("j:subNodesView");
        listener = new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

            public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
                Map<String, List<String>> contextParams = new HashMap<String, List<String>>();
                if (skinField != null && skinField.getValue() != null) {
                    contextParams.put("forcedSkin", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).getValue().getValue()));
                }
                if (subNodesViewField != null && subNodesViewField.getValue() != null) {
                    contextParams.put("forcedSubNodesTemplate", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).getValue().getValue()));
                }
                String template = (templateField != null && templateField.getValue() != null) ? ((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).getValue().getValue() : null;
                if (engine.getNode() != null) {
                    JahiaContentManagementService.App.getInstance().getRenderedContent(engine.getNode().getPath(), null, LayoutTabItem.this.language, template, "preview", contextParams, false, null, null, null, new BaseAsyncCallback<GWTRenderResult>() {

                        public void onSuccess(GWTRenderResult result) {
                            HTML html = new HTML(result.getResult());
                            setHTML(html);
                            tab.layout();
                        }
                    });
                } else {
                    setHTML(null);
                }
            }
        };
        if (templateField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).addSelectionChangedListener(listener);
        }
        if (skinField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).addSelectionChangedListener(listener);
        }
        if (subNodesViewField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).addSelectionChangedListener(listener);
        }
        tab.setLayout(new FillLayout());
        if (ctn == null) {
            ctn = new LayoutContainer(new FitLayout());
            tab.add(ctn);
            htmlPreview = new LayoutContainer();
            htmlPreview.addStyleName(cssWrapper);
            htmlPreview.setStyleAttribute("background-color", "white");
            FieldSet f = new FieldSet();
            f.addStyleName("x-panel");
            f.setHeadingHtml(Messages.get("label.preview", "Preview"));
            f.setScrollMode(Style.Scroll.AUTO);
            f.add(htmlPreview);
            tab.add(f);
        }
        ctn.add(propertiesEditor);
    } else {
        super.attachPropertiesEditor(engine, tab);
    }
}
Also used : PropertiesEditor(org.jahia.ajax.gwt.client.widget.definition.PropertiesEditor) GWTRenderResult(org.jahia.ajax.gwt.client.data.GWTRenderResult) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) HTML(com.google.gwt.user.client.ui.HTML) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) BaseAsyncCallback(org.jahia.ajax.gwt.client.core.BaseAsyncCallback) List(java.util.List) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean) HashMap(java.util.HashMap) Map(java.util.Map) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 4 with FillLayout

use of com.extjs.gxt.ui.client.widget.layout.FillLayout in project jahia by Jahia.

the class AbstractContentEngine method init.

protected void init(EngineContainer container) {
    this.container = container;
    setLayout(new FillLayout());
    addStyleName("content-engine");
    buttonBar = new ButtonBar();
    buttonBar.addStyleName("JahiaEditEngineButtonBar");
    container.setEngine(this, heading, buttonBar, null, this.getLinker());
    // init language switcher
    initLanguageSwitcher();
    // init tabs
    tabs = new TabPanel();
    tabs.setBodyBorder(false);
    tabs.setBorders(true);
    add(tabs);
    buttonBar.setAlignment(Style.HorizontalAlignment.CENTER);
    initFooter();
    container.getPanel().setFooter(true);
    loading();
}
Also used : TabPanel(com.extjs.gxt.ui.client.widget.TabPanel) ButtonBar(com.extjs.gxt.ui.client.widget.button.ButtonBar) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout)

Example 5 with FillLayout

use of com.extjs.gxt.ui.client.widget.layout.FillLayout in project jahia by Jahia.

the class DeployPortletDefinitionActionItem method onComponentSelection.

public void onComponentSelection() {
    GWT.runAsync(new RunAsyncCallback() {

        @Override
        public void onFailure(Throwable reason) {
        }

        @Override
        public void onSuccess() {
            LinkerSelectionContext lh = linker.getSelectionContext();
            GWTJahiaNode parent = lh.getSingleSelection();
            if (parent != null) {
                final com.extjs.gxt.ui.client.widget.Window w = new com.extjs.gxt.ui.client.widget.Window();
                w.addStyleName("deploy-portlet-definition-modal");
                w.setHeadingHtml(Messages.get("label.deployNewPortlet", "New portlets"));
                w.setModal(true);
                w.setResizable(false);
                w.setBodyBorder(false);
                w.setLayout(new FillLayout());
                w.setWidth(600);
                w.add(new FormDeployPortletDefinition() {

                    @Override
                    public void closeParent() {
                        w.hide();
                    }

                    @Override
                    public void refreshParent() {
                        Map<String, Object> data = new HashMap<String, Object>();
                        data.put(Linker.REFRESH_ALL, true);
                        linker.refresh(data);
                    }
                });
                w.setScrollMode(Style.Scroll.AUTO);
                w.layout();
                w.show();
            }
        }
    });
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) HashMap(java.util.HashMap) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) FormDeployPortletDefinition(org.jahia.ajax.gwt.client.widget.form.FormDeployPortletDefinition) LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)

Aggregations

FillLayout (com.extjs.gxt.ui.client.widget.layout.FillLayout)8 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)3 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)3 Margins (com.extjs.gxt.ui.client.util.Margins)2 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)2 ComboBox (com.extjs.gxt.ui.client.widget.form.ComboBox)2 HTML (com.google.gwt.user.client.ui.HTML)2 HashMap (java.util.HashMap)2 List (java.util.List)2 BaseAsyncCallback (org.jahia.ajax.gwt.client.core.BaseAsyncCallback)2 GWTJahiaNodeType (org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType)2 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)2 XTemplate (com.extjs.gxt.ui.client.core.XTemplate)1 ListLoadResult (com.extjs.gxt.ui.client.data.ListLoadResult)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 RpcProxy (com.extjs.gxt.ui.client.data.RpcProxy)1 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)1 Listener (com.extjs.gxt.ui.client.event.Listener)1 TreeGridEvent (com.extjs.gxt.ui.client.event.TreeGridEvent)1 ListStore (com.extjs.gxt.ui.client.store.ListStore)1