List of usage examples for com.google.gwt.user.client.ui LayoutPanel setWidgetBottomHeight
public void setWidgetBottomHeight(IsWidget child, double bottom, Unit bottomUnit, double height, Unit heightUnit)
From source file:com.moesol.gwt.maps.client.Driver.java
License:Open Source License
private void doMapPanel(RootPanel mapPanel) { mapPanel.setHeight("100%"); mapPanel.setWidth("100%"); DOM.setInnerHTML(mapPanel.getElement(), ""); final DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX); dockPanel.setHeight("420px"); dockPanel.setWidth("600px"); mapPanel.add(dockPanel);/* w w w. ja v a 2s . c o m*/ // loadLayerConfigsFromServer(); loadLayerConfigsFromClient(); //VerticalPanel vp = new VerticalPanel(); MapPanel mapFillPanel = new MapPanel(m_map); m_map.setDpi(m_scrnDpi); m_map.getController().withHoverDelayMillis(MAP_HOVER_DELAY_MILLIS); //new EdgeHoverPanControl(m_map, MAP_EDGE_HOVER_RADIUS_PIXELS, // MAP_EDGE_HOVER_PAN_INTERVAL, // MAP_EDGE_HOVER_MAX_PAN_PER_INTERVAL_PIXELS); // m_map.getController().addHoverHandler(new HoverHandler() { // BubbleControl bc = new BubbleControl(m_map); // // @Override // public void onHover(HoverEvent e) { // ViewCoords m_vc = new ViewCoords(e.getX(), e.getY()); // GeodeticCoords gc = m_map.getProjection().viewToGeodetic(m_vc); // bc.getHtml().setHTML("Hover: " + gc.toString()); // bc.animateShow(e.getClientX(), e.getClientY()); // } // }); if (isTrue("showSomeIcons", false)) { addSomeIcons(); } m_map.updateView(); // Button left = new Button("Left", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goLeft(); // } // }); // Button right = new Button("Right", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goRight(); // }}); // Button up = new Button("Up", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goUp(); // }}); // Button down = new Button("Down", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goDown(); // }}); // // Button in = new Button("In", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goIn(); // }}); // Button out = new Button("Out", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // goOut(); // }}); Button removeIcons = new Button("Remove Icons", new ClickHandler() { @Override public void onClick(ClickEvent event) { removeIcons(); } }); Button moveIcons = new Button("Move Icons", new ClickHandler() { @Override public void onClick(ClickEvent event) { moveIcons(); } }); Button resizeMap = new Button("Fill Viewport", new ClickHandler() { @Override public void onClick(ClickEvent event) { dockPanel.setHeight("100%"); dockPanel.setWidth("100%"); } }); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); oracle.add("0"); oracle.add("01"); oracle.add("1"); oracle.add("3"); m_levelBox = new SuggestBox(); m_map.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { mapChanged(); } }); HorizontalPanel bar = new HorizontalPanel(); // bar.add(left); // bar.add(right); // bar.add(up); // bar.add(down); // bar.add(in); // bar.add(out); bar.add(removeIcons); bar.add(moveIcons); bar.add(resizeMap); // bar.add(m_centerLabel); dockPanel.addNorth(bar, 20); //bar.add(m_levelBox); // if (false) { // // Show debug grid // bar.add(m_tiles); // } //vp.add(bar); LayoutPanel hp = new LayoutPanel(); dockPanel.add(hp); //hp.setHeight("500px"); //hp.setWidth("500px"); //vp.add(hp); if (isTrue("showLayerPanel", false)) { addTileMapServiceView(hp); // eventBus.addHandler(TileMapAddEvent.TYPE, new TileMapAddEvent.Handler() { // @Override // public void onTileMapAdd(TileMapAddEvent event) { // LayerSet layerSet = new LayerSet(); // TileMapMetadata tileMapMetadata = event.getTileMapMetadata(); // layerSet.setServer(tileMapMetadata.getUrl()); // layerSet.setData(""); // layerSet.setUrlPattern("{server}/{level}/{x}/{y}." + tileMapMetadata.getTileImageFormat()); // m_map.addLayer(layerSet); // } // }); } // The map viewport hp.add(mapFillPanel); //hp.setWidgetLeftWidth(mapFillPanel,0, Style.Unit.PCT, 100, Style.Unit.PCT); // The map controls MapPanZoomControl mapControls = new MapPanZoomControl(m_map, 15, 100); mapControls.getElement().getStyle().setZIndex(100000); hp.add(mapControls); hp.setWidgetLeftWidth(mapControls, 0, Style.Unit.PX, 56, Style.Unit.PX); hp.setWidgetTopHeight(mapControls, 0, Style.Unit.PX, 121, Style.Unit.PX); //The mouse position label; PositionControl mousePosLabel = new PositionControl(m_map); hp.add(mousePosLabel); hp.setWidgetRightWidth(mousePosLabel, 10, Style.Unit.PX, 500, Style.Unit.PX); hp.setWidgetTopHeight(mousePosLabel, 10, Style.Unit.PX, 20, Style.Unit.PX); // Map dimmer control MapDimmerControl dimmer = new MapDimmerControl(m_map, true); hp.add(dimmer); hp.setWidgetRightWidth(dimmer, 10, Style.Unit.PX, 35, Style.Unit.PX); hp.setWidgetBottomHeight(dimmer, 10, Style.Unit.PX, 22, Style.Unit.PX); SearchControl flyToControl = new SearchControl(); hp.add(flyToControl); hp.setWidgetRightWidth(flyToControl, 0, Style.Unit.PX, 160, Style.Unit.PX); hp.setWidgetTopHeight(flyToControl, 0, Style.Unit.PX, 50, Style.Unit.PX); flyToControl.addSearchHandler(new FlyToController(m_map)); // Layer a transparent dialog... if (isTrue("showTestDialog", false)) { DialogBox db = new DialogBox(); db.setHTML("<a href='' onclick='false'>x</a>"); db.setPopupPosition(100, 10); db.setPixelSize(100, 100); db.show(); } }
From source file:com.moesol.gwt.milmap.client.Driver.java
License:Open Source License
private void doMap(RootPanel mapPanel) { //doMap(mapPanel); mapPanel.setHeight("100%"); mapPanel.setWidth("100%"); DOM.setInnerHTML(mapPanel.getElement(), ""); final DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX); dockPanel.setHeight("100%"); dockPanel.setWidth("100%"); //dockPanel.setHeight("420px"); //dockPanel.setWidth("600px"); mapPanel.add(dockPanel);/* ww w.j av a2 s .c o m*/ // loadLayerConfigsFromServer(); m_map = new MapView(); loadLayerConfigsFromClient(); MapPanel mapFillPanel = new MapPanel(m_map); m_map.setDpi(m_scrnDpi); m_map.getController().withHoverDelayMillis(MAP_HOVER_DELAY_MILLIS); m_map.setDeclutterLabels(true); //new EdgeHoverPanControl(m_map, MAP_EDGE_HOVER_RADIUS_PIXELS, // MAP_EDGE_HOVER_PAN_INTERVAL, // MAP_EDGE_HOVER_MAX_PAN_PER_INTERVAL_PIXELS); // m_map.getController().addHoverHandler(new HoverHandler() { // BubbleControl bc = new BubbleControl(m_map); // // @Override // public void onHover(HoverEvent e) { // ViewCoords m_vc = new ViewCoords(e.getX(), e.getY()); // GeodeticCoords gc = m_map.getProjection().viewToGeodetic(m_vc); // bc.getHtml().setHTML("Hover: " + gc.toString()); // bc.animateShow(e.getClientX(), e.getClientY()); // } // }); if (isTrue("showSomeIcons", false)) { addSomeIcons(); } m_map.updateView(); //Button removeIcons = new Button("Remove Icons", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // removeIcons(); // }}); //Button moveIcons = new Button("Move Icons", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // moveIcons(); // }}); //Button showLeaders = new Button("Show Leaders", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // showLeaders(); // } //}); //Button benchmarks = new Button("Benchmarks", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // runBenchmarks(); // }}); //Button stats = new Button("Stats", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // stats(); // }}); //Button memoryTest = new Button("Memory Test", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // memoryTest(); // }}); //Button declutter = new Button("Declutter", new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // declutterTest(); // }}); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); oracle.add("0"); oracle.add("01"); oracle.add("1"); oracle.add("3"); m_levelBox = new SuggestBox(); m_map.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { mapChanged(); } }); // removing button bar for demo purposes //HorizontalPanel bar = new HorizontalPanel(); // bar.add(removeIcons); // bar.add(moveIcons); // bar.add(showLeaders); // bar.add(declutter); // bar.add(benchmarks); // bar.add(stats); // bar.add(memoryTest); // dockPanel.addNorth(bar, 20); LayoutPanel lp = new LayoutPanel(); dockPanel.add(lp); if (isTrue("showLayerPanel", false)) { addTileMapServiceView(lp); } // The map viewport lp.add(mapFillPanel); //count = hp.getWidgetCount(); //hp.setWidgetLeftWidth(mapFillPanel,0, Style.Unit.PCT, 100, Style.Unit.PCT); // The map controls MapPanZoomControl mapControls = new MapPanZoomControl(m_map, 15, 10); mapControls.getElement().getStyle().setZIndex(100000); lp.add(mapControls); lp.setWidgetLeftWidth(mapControls, 0, Style.Unit.PX, 56, Style.Unit.PX); lp.setWidgetTopHeight(mapControls, 0, Style.Unit.PX, 121, Style.Unit.PX); //The mouse position label; PositionControl mousePosLabel = new PositionControl(m_map); lp.add(mousePosLabel); lp.setWidgetRightWidth(mousePosLabel, 10, Style.Unit.PX, 500, Style.Unit.PX); lp.setWidgetTopHeight(mousePosLabel, 10, Style.Unit.PX, 20, Style.Unit.PX); //The Text control; m_textControl = new TextControl(); lp.add(m_textControl); lp.setWidgetLeftWidth(m_textControl, 10, Style.Unit.PX, 500, Style.Unit.PX); lp.setWidgetBottomHeight(m_textControl, 10, Style.Unit.PX, 20, Style.Unit.PX); // Map dimmer control MapDimmerControl dimmer = new MapDimmerControl(m_map, true); lp.add(dimmer); lp.setWidgetRightWidth(dimmer, 10, Style.Unit.PX, 60, Style.Unit.PX); lp.setWidgetBottomHeight(dimmer, 10, Style.Unit.PX, 34, Style.Unit.PX); // Map tag control TagControl tag = new TagControl(m_map, true); lp.add(tag); lp.setWidgetRightWidth(tag, 10, Style.Unit.PX, 35, Style.Unit.PX); lp.setWidgetBottomHeight(tag, 60, Style.Unit.PX, 22, Style.Unit.PX); SearchControl flyToControl = new SearchControl(); lp.add(flyToControl); lp.setWidgetRightWidth(flyToControl, 10, Style.Unit.PX, 160, Style.Unit.PX); lp.setWidgetTopHeight(flyToControl, 10, Style.Unit.PX, 50, Style.Unit.PX); flyToControl.addSearchHandler(new FlyToController(m_map)); // Layer a transparent dialog... if (isTrue("showTestDialog", false)) { DialogBox db = new DialogBox(); db.setHTML("<a href='' onclick='false'>x</a>"); db.setPopupPosition(100, 10); db.setPixelSize(100, 100); db.show(); } }
From source file:com.moesol.mapsample.client.MapSample.java
License:Open Source License
private void doMap(RootPanel mapPanel) { //doMap(mapPanel); mapPanel.setHeight("100%"); mapPanel.setWidth("100%"); DOM.setInnerHTML(mapPanel.getElement(), ""); final DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX); dockPanel.setHeight("100%"); dockPanel.setWidth("100%"); mapPanel.add(dockPanel);/*from w ww . j av a2 s. c om*/ // loadLayerConfigsFromServer(); m_map = new MapView(); loadLayerConfigsFromClient(); MapPanel mapFillPanel = new MapPanel(m_map); m_map.setDpi(m_scrnDpi); m_map.getController().withHoverDelayMillis(MAP_HOVER_DELAY_MILLIS); m_map.setDeclutterLabels(true); if (isTrue("showSomeIcons", false)) { addSomeIcons(); } m_map.updateView(); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); oracle.add("0"); oracle.add("01"); oracle.add("1"); oracle.add("3"); m_levelBox = new SuggestBox(); m_map.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { mapChanged(); } }); LayoutPanel lp = new LayoutPanel(); dockPanel.add(lp); // The map viewport lp.add(mapFillPanel); //count = hp.getWidgetCount(); //hp.setWidgetLeftWidth(mapFillPanel,0, Style.Unit.PCT, 100, Style.Unit.PCT); // The map controls MapPanZoomControl mapControls = new MapPanZoomControl(m_map, 15, 10); mapControls.getElement().getStyle().setZIndex(100000); lp.add(mapControls); lp.setWidgetLeftWidth(mapControls, 0, Style.Unit.PX, 56, Style.Unit.PX); lp.setWidgetTopHeight(mapControls, 0, Style.Unit.PX, 121, Style.Unit.PX); //The mouse position label; PositionControl mousePosLabel = new PositionControl(m_map); lp.add(mousePosLabel); lp.setWidgetRightWidth(mousePosLabel, 10, Style.Unit.PX, 500, Style.Unit.PX); lp.setWidgetTopHeight(mousePosLabel, 10, Style.Unit.PX, 20, Style.Unit.PX); //The Text control; m_textControl = new TextControl(); lp.add(m_textControl); lp.setWidgetLeftWidth(m_textControl, 10, Style.Unit.PX, 500, Style.Unit.PX); lp.setWidgetBottomHeight(m_textControl, 10, Style.Unit.PX, 20, Style.Unit.PX); // Map dimmer control MapDimmerControl dimmer = new MapDimmerControl(m_map, true); lp.add(dimmer); lp.setWidgetRightWidth(dimmer, 10, Style.Unit.PX, 60, Style.Unit.PX); lp.setWidgetBottomHeight(dimmer, 10, Style.Unit.PX, 34, Style.Unit.PX); // Map tag control TagControl tag = new TagControl(m_map, true); lp.add(tag); lp.setWidgetRightWidth(tag, 10, Style.Unit.PX, 35, Style.Unit.PX); lp.setWidgetBottomHeight(tag, 60, Style.Unit.PX, 22, Style.Unit.PX); SearchControl flyToControl = new SearchControl(); lp.add(flyToControl); lp.setWidgetRightWidth(flyToControl, 10, Style.Unit.PX, 160, Style.Unit.PX); lp.setWidgetTopHeight(flyToControl, 10, Style.Unit.PX, 50, Style.Unit.PX); flyToControl.addSearchHandler(new FlyToController(m_map)); // Layer a transparent dialog... if (isTrue("showTestDialog", false)) { DialogBox db = new DialogBox(); db.setHTML("<a href='' onclick='false'>x</a>"); db.setPopupPosition(100, 10); db.setPixelSize(100, 100); db.show(); } }
From source file:edu.ycp.cs.netcoder.client.DevelopmentView.java
License:Open Source License
public DevelopmentView(Session session) { super(session); addSessionObject(new ChangeList()); addSessionObject(new AffectEvent()); // Observe ChangeList state. // We do this so that we know when the local editor contents are // up to date with the text on the server. session.get(ChangeList.class).subscribe(ChangeList.State.CLEAN, this, getSubscriptionRegistrar()); // User won't be allowed to edit until the problem (and previous editor contents, if any) // are loaded. mode = Mode.LOADING;/*w ww.j av a2s.co m*/ textLoaded = false; // The overall UI is build in a LayoutPanel (which the parent class creates) LayoutPanel layoutPanel = getLayoutPanel(); // Add problem description widget problemDescription = new ProblemDescriptionWidget(session, getSubscriptionRegistrar()); layoutPanel.add(problemDescription); layoutPanel.setWidgetTopHeight(problemDescription, LayoutConstants.TOP_BAR_HEIGHT_PX, Unit.PX, LayoutConstants.DEV_PROBLEM_DESC_HEIGHT_PX, Unit.PX); // Add AceEditor widget editor = new AceEditor(); editor.setStyleName("NetCoderEditor"); layoutPanel.add(editor); layoutPanel.setWidgetTopHeight(editor, LayoutConstants.TOP_BAR_HEIGHT_PX + LayoutConstants.DEV_PROBLEM_DESC_HEIGHT_PX, Unit.PX, 200, Unit.PX); // Add the status and button bar widget StatusAndButtonBarWidget statusAndButtonBarWidget = new StatusAndButtonBarWidget(getSession(), getSubscriptionRegistrar()); statusAndButtonBarWidget.addToLeftPanel(new StatusMessageWidget(getSession(), getSubscriptionRegistrar())); statusAndButtonBarWidget.addToRightPanel( new EditorStatusWidget(getSession().get(ChangeList.class), getSubscriptionRegistrar())); Button submitButton = new Button("Submit"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { submitCode(); } }); statusAndButtonBarWidget.addToRightPanel(submitButton); layoutPanel.add(statusAndButtonBarWidget); layoutPanel.setWidgetBottomHeight(statusAndButtonBarWidget, LayoutConstants.DEV_RESULTS_PANEL_HEIGHT_PX, Unit.PX, LayoutConstants.DEV_STATUS_AND_BUTTON_BAR_HEIGHT_PX, Unit.PX); // Tab panel for test results and other information resultsTabPanel = new TabLayoutPanel(LayoutConstants.DEV_RESULTS_TAB_BAR_HEIGHT_PX, Unit.PX); // Test results widget resultWidget = new ResultWidget(getSession(), getSubscriptionRegistrar()); resultWidget.setWidth("100%"); resultWidget.setHeight("100%"); resultsTabPanel.add(resultWidget, "Test results"); layoutPanel.add(resultsTabPanel); layoutPanel.setWidgetBottomHeight(resultsTabPanel, 0, Unit.PX, LayoutConstants.DEV_RESULTS_PANEL_HEIGHT_PX, Unit.PX); // UI is now complete initWidget(layoutPanel); // Subscribe to window ResizeEvents getSession().get(WindowResizeNotifier.class).subscribe(WindowResizeNotifier.WINDOW_RESIZED, this, getSubscriptionRegistrar()); // Initiate loading of the problem and current editor text. loadProblemAndCurrentText(); // Create timer to flush unsent change events periodically. this.flushPendingChangeEventsTimer = new Timer() { @Override public void run() { final ChangeList changeList = getSession().get(ChangeList.class); if (changeList == null) { // paranoia return; } if (changeList.getState() == ChangeList.State.UNSENT) { Change[] changeBatch = changeList.beginTransmit(); AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { changeList.endTransmit(false); GWT.log("Failed to send change batch to server"); getSession().add(new StatusMessage(StatusMessage.Category.ERROR, "Could not save code to server!")); } @Override public void onSuccess(Boolean result) { changeList.endTransmit(true); } }; logCodeChangeService.logChange(changeBatch, callback); } } }; flushPendingChangeEventsTimer.scheduleRepeating(FLUSH_CHANGES_INTERVAL_MS); }
From source file:org.cloudcoder.app.client.view.DevActionsPanel.java
License:Open Source License
/** * Constructor./*w w w . j a va 2 s . c o m*/ */ public DevActionsPanel() { LayoutPanel layoutPanel = new LayoutPanel(); Button submitButton = new Button("Submit!"); submitButton.setStylePrimaryName("cc-emphButton"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (submitHandler != null) { submitHandler.run(); } } }); layoutPanel.add(submitButton); layoutPanel.setWidgetRightWidth(submitButton, 0.0, Unit.PX, BUTTON_WIDTH_PX, Unit.PX); layoutPanel.setWidgetBottomHeight(submitButton, 10.0, Unit.PX, BUTTON_HEIGHT_PX, Unit.PX); Button resetButton = new Button("Reset"); resetButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (resetHandler != null) { resetHandler.run(); } } }); layoutPanel.add(resetButton); layoutPanel.setWidgetRightWidth(resetButton, 0.0, Unit.PX, BUTTON_WIDTH_PX, Unit.PX); layoutPanel.setWidgetBottomHeight(resetButton, 10.0 + BUTTON_HEIGHT_PX + 10.0, Unit.PX, BUTTON_HEIGHT_PX, Unit.PX); initWidget(layoutPanel); }
From source file:org.jboss.as.console.client.core.Header.java
License:Open Source License
public Widget asWidget() { LayoutPanel outerLayout = new LayoutPanel(); outerLayout.addStyleName("page-header"); Widget logo = getLogoSection();/*from w w w. ja v a 2 s.co m*/ Widget links = getLinksSection(); LayoutPanel rhs = new LayoutPanel(); rhs.setStyleName("fill-layout"); MessageCenterView messageCenterView = new MessageCenterView(messageCenter); Widget messageCenter = messageCenterView.asWidget(); rhs.add(messageCenter); rhs.add(links); rhs.setWidgetRightWidth(messageCenter, 10, Style.Unit.PX, 100, Style.Unit.PCT); rhs.setWidgetRightWidth(links, 10, Style.Unit.PX, 100, Style.Unit.PCT); rhs.setWidgetBottomHeight(messageCenter, 27, Style.Unit.PX, 28, Style.Unit.PX); rhs.setWidgetBottomHeight(links, 0, Style.Unit.PX, 24, Style.Unit.PX); LayoutPanel innerLayout = new LayoutPanel(); innerLayout.add(logo); innerLayout.add(rhs); innerLayout.setWidgetLeftWidth(logo, 0, Style.Unit.PX, 50, Style.Unit.PCT); innerLayout.setWidgetRightWidth(rhs, 10, Style.Unit.PX, 50, Style.Unit.PCT); innerLayout.setWidgetBottomHeight(rhs, 0, Style.Unit.PX, 58, Style.Unit.PX); outerLayout.add(innerLayout); outerLayout.setWidgetTopHeight(innerLayout, 0, Style.Unit.PX, 58, Style.Unit.PX); outerLayout.getElement().setAttribute("role", "navigation"); outerLayout.getElement().setAttribute("aria-label", "Toplevel Categories"); return outerLayout; }
From source file:org.jboss.as.console.client.shared.subsys.picketlink.PicketLinkFinder.java
License:Open Source License
void launchAddFederationDialog() { ResourceDescription resourceDescription = StaticResourceDescription .from(PICKET_LINK_RESOURCES.newFederationDescription()); ComboBoxItem securityDomains = new ComboBoxItem("security-domain", "Security Domain"); securityDomains.setRequired(false);//from ww w . ja va2s. c o m securityDomains.setValueMap(this.securityDomains); DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle("Federation")); ModelNodeFormBuilder.FormAssets assets = new ModelNodeFormBuilder() .setResourceDescription(resourceDescription) .addFactory("security-domain", attributeDescription -> securityDomains) .setSecurityContext(securityContext).unsorted().build(); assets.getForm().setEnabled(true); assets.getForm().addFormValidator(new IdentityProviderEditor.IdentityProviderFormValidator()); DialogueOptions options = new DialogueOptions(event -> { FormValidation validation = assets.getForm().validate(); if (!validation.hasErrors()) { dialog.hide(); ModelNode payload = assets.getForm().getUpdatedEntity(); String name = payload.get(NAME).asString(); String ip = payload.get("identity-provider").asString(); Operation addFederation = new Operation.Builder(ADD, FEDERATION_TEMPLATE.resolve(statementContext, name)).build(); Operation addIdentityProvider = new Operation.Builder(ADD, IDENTITY_PROVIDER_TEMPLATE.resolve(statementContext, name, ip)) .param("security-domain", payload.get("security-domain").asString()) .param("external", payload.get("external").asBoolean()) .param("url", payload.get("url").asString()).build(); dispatcher.execute(new DMRAction(new Composite(addFederation, addIdentityProvider)), new SimpleCallback<DMRResponse>() { @Override public void onFailure(final Throwable caught) { super.onFailure(caught); readFederations(); } @Override public void onSuccess(final DMRResponse dmrResponse) { Console.info(Console.MESSAGES.successfullyAdded((name))); readFederations(); } }); } }, event -> dialog.hide()); VerticalPanel layout = new VerticalPanel(); layout.setStyleName("fill-layout-width window-content"); ContentDescription text = new ContentDescription(resourceDescription.get(DESCRIPTION).asString()); layout.add(text); layout.add(assets.getHelp().asWidget()); layout.add(assets.getForm().asWidget()); ScrollPanel scroll = new ScrollPanel(layout); LayoutPanel content = new LayoutPanel(); content.addStyleName("fill-layout"); content.add(scroll); content.add(options); content.getElement().setAttribute("style", "margin-bottom:10px"); content.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 92, Style.Unit.PCT); content.setWidgetBottomHeight(options, 0, Style.Unit.PX, 35, Style.Unit.PX); dialog.setWidth(640); dialog.setHeight(480); dialog.setWidget(new TrappedFocusPanel(content)); dialog.setGlassEnabled(true); dialog.center(); }
From source file:org.jboss.as.console.client.v3.widgets.AddResourceDialog.java
License:Open Source License
@Override public Widget asWidget() { if (assets == null) { ModelNodeFormBuilder builder = new ModelNodeFormBuilder().setCreateMode(true) .setResourceDescription(resourceDescription).setRequiredOnly(requiredOnly) .setSecurityContext(securityContext); for (Map.Entry<String, FormItemFactory> entry : factories.entrySet()) { builder.addFactory(entry.getKey(), entry.getValue()); }//from ww w . j a v a 2 s.c o m if (includes != null) builder.include(includes); assets = builder.build(); assets.getForm().setEnabled(true); } if (assets.getForm().hasWritableAttributes()) { DialogueOptions options = new DialogueOptions(new ClickHandler() { @Override public void onClick(ClickEvent event) { FormValidation validation = assets.getForm().validate(); if (!validation.hasErrors()) { callback.onAdd(assets.getForm().getUpdatedEntity()); } } }, new ClickHandler() { @Override public void onClick(ClickEvent event) { callback.onCancel(); } }); VerticalPanel layout = new VerticalPanel(); layout.setStyleName("fill-layout-width window-content"); Widget formWidget = assets.getForm().asWidget(); ModelNode opDescription = resourceDescription.get("operations").get("add").get("description"); ContentDescription text = new ContentDescription(opDescription.asString()); layout.add(text); layout.add(assets.getHelp().asWidget()); layout.add(formWidget); ScrollPanel scroll = new ScrollPanel(layout); LayoutPanel content = new LayoutPanel(); content.addStyleName("fill-layout"); content.add(scroll); content.add(options); content.getElement().setAttribute("style", "margin-bottom:10px"); content.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 92, Style.Unit.PCT); content.setWidgetBottomHeight(options, 0, Style.Unit.PX, 35, Style.Unit.PX); return new TrappedFocusPanel(content); } else { return new HTML(Console.CONSTANTS.noConfigurableAttributes()); } }
From source file:org.jboss.as.console.client.v3.widgets.MapAttributeAddPropertyDialog.java
License:Open Source License
public MapAttributeAddPropertyDialog(final PropertyManager propertyManager) { super(Console.CONSTANTS.common_label_add()); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("window-content"); form = new Form<>(PropertyRecord.class); TextBoxItem nameItem = new TextBoxItem("key", "Name") { @Override/*from ww w .j a v a 2s .c o m*/ public void setFiltered(boolean filtered) { // cannot be filtered (workaround) } }; TextBoxItem valueItem = new TextBoxItem("value", "Value") { @Override public void setFiltered(boolean filtered) { // cannot be filtered (workaround) } }; form.setFields(nameItem, valueItem); DialogueOptions options = new DialogueOptions(new ClickHandler() { @Override public void onClick(ClickEvent event) { PropertyRecord propertyRecord = form.getUpdatedEntity(); if (!form.validate().hasErrors()) { ModelNode node = new ModelNode(); node.set(propertyRecord.getValue()); Property property = new Property(propertyRecord.getKey(), node); propertyManager.onAdd(property, MapAttributeAddPropertyDialog.this); } } }, new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); VerticalPanel layout = new VerticalPanel(); layout.setStyleName("fill-layout-width window-content"); layout.add(new ContentDescription(Console.CONSTANTS.common_label_addProperty())); Widget formWidget = form.asWidget(); layout.add(formWidget); ScrollPanel scroll = new ScrollPanel(layout); LayoutPanel content = new LayoutPanel(); content.addStyleName("fill-layout"); content.add(scroll); content.add(options); content.getElement().setAttribute("style", "margin-bottom:10px"); content.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 92, Style.Unit.PCT); content.setWidgetBottomHeight(options, 0, Style.Unit.PX, 35, Style.Unit.PX); setWidget(new TrappedFocusPanel(content)); }
From source file:teropa.ko2010.client.Client.java
License:Creative Commons License
private void initMain(DockLayoutPanel dock) { LayoutPanel mainPanel = new LayoutPanel(); map = new Map("100%", "100%"); map.setMaxExtent(GoogleMercator.MAX_EXTENT); map.setResolutions(getResolutions(), 1); map.setCenter(new LonLat(391357.58482, 5476196.443835)); map.getView().setBackgroundColor(new Color("#c8c8c8")); OpenStreetMapLayer base = new OpenStreetMapLayer(GWT.getHostPageBaseURL() + "tiles/osm", "Mapnik", true); map.addLayer(base);//from ww w . j a v a 2 s. c o m solanum = new EpidemicLayer(GWT.getHostPageBaseURL() + "tiles/solanum", "Solanum", false); map.addLayer(solanum); map.addControl(new Panner(), Position.TOP_LEFT); map.addControl(new Zoomer(), Position.MIDDLE_LEFT); map.addControl(new CopyrightText(initCopyrightText()), Position.BOTTOM_LEFT); mainPanel.add(map); // map.getView().addViewClickHandler(new ViewClickEvent.Handler() { // public void onViewClicked(ViewClickEvent event) { // Window.alert(map.calc().getLonLat(event.point).toString()); // } // }); tc = new TimeControl(solanum); mainPanel.add(tc); mainPanel.setWidgetBottomHeight(tc, 30, Unit.PX, 50, Unit.PX); mainPanel.setWidgetLeftRight(tc, 50, Unit.PX, 50, Unit.PX); dock.add(mainPanel); }