@Override public void init(final GridBasePresenter presenter) { this.presenter = presenter; listContainer.clear(); listGrid = new ExtendedPagedTable<DataMockSummary>(10, null); presenter.addDataDisplay(listGrid); listContainer.add(listGrid); this.initGridColumns(); Button refreshButton = new Button(); refreshButton.setIcon(IconType.REFRESH); refreshButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.refreshList(); } }); listGrid.getToolbar().add(refreshButton); Button createServerDataButton = new Button(); createServerDataButton.setText("Create Server Side Data"); createServerDataButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.createData(); } }); listGrid.getToolbar().add(createServerDataButton); }
private void addNavItems(LHSNavItem... items) { int i = 0; int height = 25; for (LHSNavItem navItem : items) { layout.add(navItem); layout.setWidgetTopHeight(navItem, i * height, Style.Unit.PX, height, Style.Unit.PX); i++; } }
@Override public void onMouseMove(MouseMoveEvent event) { parent.setWidgetTopHeight(widget, event.getClientY() - offsetY, Unit.PX, height, Unit.PX); parent.setWidgetLeftWidth(widget, event.getClientX() - offsetX, Unit.PX, width, Unit.PX); parent.forceLayout(); if (mouseMoveHandler != null) { mouseMoveHandler.onMouseMove(event); } }
@Override public void showSearchResult(SearchResult result) { if (table == null) { table = new DeviceSearchResultTable(result.getDescs(), selection); table.setRangeChangeHandler(presenter); table.setClickHandler(presenter); table.load(); resultPanel.add(table); final DeviceColumnPopupPanel panel = new DeviceColumnPopupPanel( new DeviceColumnPopupPanel.Presenter() { @Override public void onValueChange(int column, boolean value) { if (table != null) { table.setVisible(column, value); } } }); columnButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { panel.popup(columnButton); } }); initColumnPanel(result.getDescs(), panel); } table.setData(result); if (table.getPageSize() != DevicePageSize.getPageSize()) { table.setPageSize(DevicePageSize.getPageSize()); pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex()); } }
public LHSServerGroupNavigation() { layout = new LayoutPanel(); layout.setStyleName("fill-layout"); stack = new VerticalPanel(); stack.setStyleName("fill-layout-width"); serverGroupSection = new ServerGroupSection(); stack.add(serverGroupSection.asWidget()); DeploymentSection deploymentSection = new DeploymentSection(); stack.add(deploymentSection.asWidget()); layout.add(stack); }
@Override public void setInSlot(Object slot, IsWidget content) { if (slot == ServerMgmtApplicationPresenter.TYPE_MainContent) { if (content != null) setContent(content); else contentCanvas.clear(); } }
@Override public Widget createWidget() { LayoutPanel layout = new RHSContentPanel("System Properties"); layout.add(new ContentHeaderLabel("System Properties")); layout.add(new ContentDescription(Console.CONSTANTS.properties_global_desc())); propertyEditor = new PropertyEditor(presenter, Console.getBootstrapContext().isStandalone()) { { numRows = 20; } }; layout.add(propertyEditor.asWidget()); return layout; }
public void detachHandlers() { /* * We remove the handlers to make sure unnecessary processing is not done */ if (handlerRegistration == null) return; handlerRegistration.removeHandler(); handlerRegistration2.removeHandler(); handlerRegistration = null; handlerRegistration2 = null; DOM.releaseCapture(parent.getElement()); }
public void clearWidgetFromMouse() { if (widget != null) { detachHandlers(); /* * Do not use widget.removeFromParent() since the parent might not * be "parent" if the widget has been attached to another parent * meanwhile (which is very likely) */ parent.remove(widget); widget = null; } }
public KscComboboxViewImpl() { initWidget(uiBinder.createAndBindUi(this)); m_layoutPanel.setSize("100%", "23px"); m_textBox.addKeyDownHandler( new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (m_presenter != null) { m_presenter.onEnterKeyEvent(); } } } }); m_selectionModel = new SingleSelectionModel<KscReportDetail>(); m_selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { m_presenter.onKscReportSelected(); } }); m_reportList = new CellList<KscReportDetail>(new KscReportDetailCell()); m_reportList.setPageSize(10); m_reportList.getElement().getStyle().setFontSize(12, Unit.PX); m_reportList.setSelectionModel(m_selectionModel); m_dataList = new ListDataProvider<KscReportDetail>(); m_dataList.addDataDisplay(m_reportList); m_pager = new SimplePager(); m_pager.setStyleName("onms-table-no-borders-margin"); m_pager.getElement().getStyle().setWidth(100, Unit.PCT); m_pager.setDisplay(m_reportList); FlowPanel flowPanel = new FlowPanel(); flowPanel.add(m_reportList); flowPanel.add(m_pager); m_popupPanel = new PopupPanel(); m_popupPanel.add(flowPanel); m_popupPanel.setAutoHideEnabled(true); m_popupPanel.setAnimationEnabled(true); m_popupPanel.setModal(false); m_popupPanel.getElement().getStyle().setBorderWidth(1, Unit.PX); m_popupPanel.getElement().getStyle().setBorderColor("#B5B8C8"); m_popupPanel.getElement().getStyle().setPadding(1, Unit.PX); }
public void attachWidgetToMouse( MouseDownEvent event, Widget w, MouseMoveHandler mouseMoveHandler, MouseUpHandler mouseUpHandler) { this.mouseMoveHandler = mouseMoveHandler; this.mouseUpHandler = mouseUpHandler; if (widget == w) return; clearWidgetFromMouse(); widget = w; if (widget != null) { height = w.getOffsetHeight(); width = w.getOffsetWidth(); offsetX = event.getRelativeX(w.getElement()); offsetY = event.getRelativeY(w.getElement()); parent.add(widget); parent.setWidgetTopHeight(widget, event.getClientY() - offsetY, Unit.PX, height, Unit.PX); parent.setWidgetLeftWidth(widget, event.getClientX() - offsetX, Unit.PX, width, Unit.PX); attachHandlers(); } }
private Widget createUi(ImageResource loadingIconResource) { Image loadingIcon = new Image(loadingIconResource); Label label = new Label(messages.loading()); LayoutPanel panel = new LayoutPanel(); panel.add(loadingIcon); panel.add(label); panel.setWidgetHorizontalPosition(loadingIcon, Alignment.BEGIN); panel.setWidgetHorizontalPosition(label, Alignment.END); panel.setWidth("160px"); panel.setHeight("32px"); return panel; }
@Override public void setPreview(final SafeHtml html) { if (contentCanvas.getWidgetCount() == 0) { // nested presenter shows preview Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { contentCanvas.clear(); contentCanvas.add(new HTML(html)); } }); } }
public DeploymentSection() { layout = new LayoutPanel(); layout.setStyleName("stack-section"); LHSNavItem current = new LHSNavItem( "Available Deployments", NameTokens.DeploymentsPresenter, Icons.INSTANCE.inventory_small()); LHSNavItem createNew = new LHSNavItem( "Add Deployment", "current-deployments;action=new", Icons.INSTANCE.add_small()); LHSNavItem plans = new LHSNavItem("Deployment Plans", "deployment-plans"); addNavItems(createNew, current, plans); }
@Override public Widget createWidget() { LayoutPanel layout = new RHSContentPanel("Servlet"); layout.add(new ContentHeaderLabel("Servlet/HTTP Configuration")); layout.add(new ContentDescription(Console.CONSTANTS.subsys_web_desc())); // ---- form = new Form(JSPContainerConfiguration.class); form.setNumColumns(2); FormToolStrip toolStrip = new FormToolStrip<JSPContainerConfiguration>( form, new FormToolStrip.FormCallback<JSPContainerConfiguration>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveJSPConfig(changeset); } @Override public void onDelete(JSPContainerConfiguration entity) {} }); toolStrip.providesDeleteOp(false); layout.add(toolStrip.asWidget()); // ---- CheckBoxItem disabled = new CheckBoxItem("disabled", "Disabled?"); CheckBoxItem development = new CheckBoxItem("development", "Development?"); TextBoxItem instanceId = new TextBoxItem("instanceId", "Instance ID", false); CheckBoxItem keepGenerated = new CheckBoxItem("keepGenerated", "Keep Generated?"); NumberBoxItem checkInterval = new NumberBoxItem("checkInterval", "Check Interval"); CheckBoxItem sourceFragment = new CheckBoxItem("displaySource", "Display Source?"); form.setFields(disabled, development, instanceId); form.setFieldsInGroup( Console.CONSTANTS.common_label_advanced(), new DisclosureGroupRenderer(), keepGenerated, checkInterval, sourceFragment); FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "web"); address.add("configuration", "jsp-configuration"); return address; } }, form); layout.add(helpPanel.asWidget()); layout.add(form.asWidget()); form.setEnabled(false); // TODO: // ---- TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.getElement().setAttribute("style", "padding-top:20px;"); connectorList = new ConnectorList(presenter); bottomLayout.add(connectorList.asWidget(), "Connectors"); serverList = new VirtualServerList(presenter); bottomLayout.add(serverList.asWidget(), "Virtual Servers"); bottomLayout.selectTab(0); layout.add(bottomLayout); return layout; }
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll); layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); serverName = new HTML("Replace me"); serverName.setStyleName("content-header-label"); panel.add(serverName); panel.add(new ContentDescription(Console.CONSTANTS.subsys_messaging_jms_provider_desc())); form = new Form(MessagingProvider.class); form.setNumColumns(2); CheckBoxItem persistenceItem = new CheckBoxItem("persistenceEnabled", "Persistence enabled?"); CheckBoxItem securityItem = new CheckBoxItem("securityEnabled", "Security enabled?"); CheckBoxItem messageCounterItem = new CheckBoxItem("messageCounterEnabled", "Message Counter enabled?"); // TextItem connector = new TextItem("connectorBinding", "Connector Binding"); // TextItem acceptor = new TextItem("acceptorBinding", "Acceptor Binding"); form.setFields(persistenceItem, securityItem, messageCounterItem); // form.setFieldsInGroup("Connections", new DisclosureGroupRenderer(), acceptor, connector); FormToolStrip<MessagingProvider> toolStrip = new FormToolStrip<MessagingProvider>( form, new FormToolStrip.FormCallback<MessagingProvider>() { @Override public void onSave(Map<String, Object> changeset) { presenter.onSaveProviderConfig(changeset); } @Override public void onDelete(MessagingProvider entity) {} }); toolStrip.providesDeleteOp(false); panel.add(toolStrip.asWidget()); FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = Baseadress.get(); address.add("subsystem", "messaging"); address.add("hornetq-server", "*"); return address; } }, form); panel.add(helpPanel.asWidget()); Widget formWidget = form.asWidget(); panel.add(formWidget); formWidget.getElement().setAttribute("style", "padding-bottom:20px;"); // ------ TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); secDetails = new SecurityDetails(presenter); bottomLayout.add(secDetails.asWidget(), "Security"); addrDetails = new AddressingDetails(presenter); bottomLayout.add(addrDetails.asWidget(), "Addressing"); bottomLayout.selectTab(0); panel.add(bottomLayout); bottomLayout.getElement().setAttribute("style", "padding-top:10px"); return layout; }
public void attachHandlers() { if (handlerRegistration != null) return; handlerRegistration = parent.addDomHandler(this, MouseMoveEvent.getType()); handlerRegistration2 = parent.addDomHandler(this, MouseUpEvent.getType()); DOM.setCapture(parent.getElement()); }
@Override public void clear() { resultPanel.clear(); table = null; }
PageSelectorItem(final WizardPageInfo pageInfo, ClickHandler clickHandler) { WizardResources res = WizardResources.INSTANCE; WizardResources.Styles styles = res.styles(); LayoutPanel layoutPanel = new LayoutPanel(); layoutPanel.addStyleName(styles.wizardPageSelectorItem()); ImageResource pageImageResource = pageInfo.getImage(); Image image = null; if (pageImageResource != null) { image = new Image(pageImageResource); layoutPanel.add(image); layoutPanel.setWidgetLeftWidth(image, 10, Unit.PX, image.getWidth(), Unit.PX); layoutPanel.setWidgetTopHeight( image, 40 - (image.getHeight() / 2), Unit.PX, image.getHeight(), Unit.PX); } FlowPanel captionPanel = new FlowPanel(); Label titleLabel = new Label(pageInfo.getTitle()); titleLabel.addStyleName(styles.headerLabel()); captionPanel.add(titleLabel); Label subTitleLabel = new Label(pageInfo.getSubTitle()); subTitleLabel.addStyleName(styles.subcaptionLabel()); captionPanel.add(subTitleLabel); layoutPanel.add(captionPanel); layoutPanel.setWidgetLeftWidth( captionPanel, 10 + (image == null ? 0 : image.getWidth()) + 12, Unit.PX, 450, Unit.PX); layoutPanel.setWidgetTopHeight(captionPanel, 19, Unit.PX, 55, Unit.PX); Image arrowImage = new Image(res.wizardDisclosureArrow()); layoutPanel.add(arrowImage); layoutPanel.setWidgetRightWidth(arrowImage, 20, Unit.PX, arrowImage.getWidth(), Unit.PX); layoutPanel.setWidgetTopHeight( arrowImage, 40 - (arrowImage.getHeight() / 2), Unit.PX, arrowImage.getHeight(), Unit.PX); layoutPanel.addDomHandler(clickHandler, ClickEvent.getType()); initWidget(layoutPanel); }
public Widget asWidget() { LayoutPanel layout = new LayoutPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll); layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT); // --- HorizontalPanel horzPanel = new HorizontalPanel(); horzPanel.getElement().setAttribute("style", "width:100%;"); Image image = new Image(Icons.INSTANCE.messaging()); horzPanel.add(image); horzPanel.add(new ContentHeaderLabel("JMS Subsystem Configuration")); image.getElement().getParentElement().setAttribute("width", "25"); panel.add(horzPanel); // ---- panel.add(new ContentGroupLabel("Connection Factories")); factoryTable = new DefaultCellTable<ConnectionFactory>(10); Column<ConnectionFactory, String> nameColumn = new Column<ConnectionFactory, String>(new TextCell()) { @Override public String getValue(ConnectionFactory object) { return object.getName(); } }; Column<ConnectionFactory, String> jndiColumn = new Column<ConnectionFactory, String>(new TextCell()) { @Override public String getValue(ConnectionFactory object) { return object.getJndiName(); } }; factoryTable.addColumn(nameColumn, "Name"); factoryTable.addColumn(jndiColumn, "JNDI"); StaticHelpPanel helpPanel = new StaticHelpPanel(MessagingDescription.getFactoryDescription()); panel.add(helpPanel.asWidget()); panel.add(factoryTable); // ---- panel.add(new ContentGroupLabel("Subresources")); TabPanel bottomLayout = new TabPanel(); bottomLayout.addStyleName("default-tabpanel"); bottomLayout.getElement().setAttribute("style", "padding-top:20px;"); queueList = new QueueList(presenter); bottomLayout.add(queueList.asWidget(), "Queues"); topicList = new TopicList(presenter); bottomLayout.add(topicList.asWidget(), "Topics"); bottomLayout.selectTab(0); panel.add(bottomLayout); return layout; }
public UI() { SplitLayoutPanel panel = new SplitLayoutPanel(); // North panel has username/problem name, page nav panel, // and slider to select the user's submissions. LayoutPanel northPanel = new LayoutPanel(); this.usernameAndProblemLabel = new Label(""); usernameAndProblemLabel.setStyleName("cc-problemName", true); northPanel.add(usernameAndProblemLabel); northPanel.setWidgetLeftRight( usernameAndProblemLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX); northPanel.setWidgetTopHeight(usernameAndProblemLabel, 0.0, Unit.PX, 22.0, Unit.PX); this.pageNavPanel = new PageNavPanel(); northPanel.add(pageNavPanel); northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX); northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX); this.sliderView = new ProblemSubmissionHistorySliderView(); northPanel.add(sliderView); northPanel.setWidgetTopHeight( sliderView, PageNavPanel.HEIGHT_PX, Unit.PX, ProblemSubmissionHistorySliderView.HEIGHT_PX, Unit.PX); northPanel.setWidgetLeftRight(sliderView, 0.0, Unit.PX, 0.0, Unit.PX); panel.addNorth(northPanel, PageNavPanel.HEIGHT_PX + 8.0 + SLIDER_HEIGHT_PX); // South panel has status message view, test outcome summary view, // and test result view. TODO: indicate whether or not the sumission compiled. LayoutPanel southPanel = new LayoutPanel(); this.statusMessageView = new StatusMessageView(); southPanel.add(statusMessageView); southPanel.setWidgetLeftRight( statusMessageView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX); southPanel.setWidgetTopHeight( statusMessageView, 0.0, Unit.PX, StatusMessageView.HEIGHT_PX, Unit.PX); this.testOutcomeSummaryView = new TestOutcomeSummaryView(); southPanel.add(testOutcomeSummaryView); southPanel.setWidgetRightWidth( testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX); southPanel.setWidgetTopHeight( testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX); this.testResultListView = new TestResultListView(); southPanel.add(testResultListView); southPanel.setWidgetLeftRight(testResultListView, 0.0, Unit.PX, 0.0, Unit.PX); southPanel.setWidgetTopBottom( testResultListView, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX, 0.0, Unit.PX); panel.addSouth(southPanel, 200.0); // Center panel has a ReadOnlyProblemTextView this.problemTextView = new ReadOnlyProblemTextView(); panel.add(problemTextView); initWidget(panel); }
private void setContent(IsWidget newContent) { contentCanvas.clear(); contentCanvas.add(newContent); }
public SongView() { LayoutPanel panel = new LayoutPanel(); initWidget(panel); InlineLabel songNameLabel = new InlineLabel("Song name:"); panel.add(songNameLabel); panel.setWidgetLeftWidth(songNameLabel, 0.0, Unit.PX, 90.0, Unit.PX); panel.setWidgetTopHeight(songNameLabel, 55.0, Unit.PX, 18.0, Unit.PX); songNameDisplayLabel = new InlineLabel(""); panel.add(songNameDisplayLabel); panel.setWidgetLeftWidth(songNameDisplayLabel, 109.0, Unit.PX, 311.0, Unit.PX); panel.setWidgetTopHeight(songNameDisplayLabel, 55.0, Unit.PX, 18.0, Unit.PX); final TextBox searchBox = new TextBox(); panel.add(searchBox); panel.setWidgetLeftWidth(searchBox, 96.0, Unit.PX, 173.0, Unit.PX); panel.setWidgetTopHeight(searchBox, 0.0, Unit.PX, 34.0, Unit.PX); InlineLabel searchBoxLabel = new InlineLabel("Search Song:"); panel.add(searchBoxLabel); panel.setWidgetLeftWidth(searchBoxLabel, 0.0, Unit.PX, 90.0, Unit.PX); panel.setWidgetTopHeight(searchBoxLabel, 0.0, Unit.PX, 18.0, Unit.PX); Button searchButton = new Button("Search"); searchButton.setText("Search"); panel.add(searchButton); panel.setWidgetLeftWidth(searchButton, 275.0, Unit.PX, 81.0, Unit.PX); panel.setWidgetTopHeight(searchButton, 4.0, Unit.PX, 30.0, Unit.PX); Button BackButton = new Button("Back"); panel.add(BackButton); panel.setWidgetLeftWidth(BackButton, 369.0, Unit.PX, 81.0, Unit.PX); panel.setWidgetTopHeight(BackButton, 0.0, Unit.PX, 30.0, Unit.PX); BackButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { TabberWebApp.setView(new MainView()); } }); searchButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { String songName = searchBox.getText(); RPC.songService.findSong( "username", songName, new AsyncCallback<Song>() { @Override public void onSuccess(Song result) { // Display the song in the view setModel(result); } @Override public void onFailure(Throwable caught) { Util.alertWidget("Error", "Could not load song: " + caught.getMessage()) .center(); } }); } }); // searchBox.addKeyPressHandler(new KeyPressHandler() { // // public void onKeyPress(KeyPressEvent event) { // if (!Character.isDigit(event.getCharCode())) { // ((TextBox) event.getSource()).cancelKey(); // } // } // }); // // }
@Override public void onResize() { if ((getParent().getOffsetHeight() - 120) > 0) { listContainer.setHeight(getParent().getOffsetHeight() - 120 + "px"); } }
public void onResize() { layout.onResize(); }
public UI() { DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX); LayoutPanel northPanel = new LayoutPanel(); this.topLabel = new Label(); topLabel.setStyleName("cc-problemName", true); northPanel.add(topLabel); northPanel.setWidgetTopHeight(topLabel, 0.0, Unit.PX, 22.0, Unit.PX); northPanel.setWidgetLeftRight(topLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX); this.pageNavPanel = new PageNavPanel(); northPanel.add(pageNavPanel); northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX); northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX); dockLayoutPanel.addNorth(northPanel, PageNavPanel.HEIGHT_PX); LayoutPanel southPanel = new LayoutPanel(); this.statusMessageView = new StatusMessageView(); southPanel.add(statusMessageView); southPanel.setWidgetTopBottom(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX); southPanel.setWidgetLeftRight(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX); dockLayoutPanel.addSouth(southPanel, StatusMessageView.HEIGHT_PX); this.userProgressView = new UserProgressView(); userProgressView.setViewSubmissionsCallback( new ICallback<Problem>() { @Override public void call(Problem value) { // Set the Problem. (The UserSelection should already be in the session.) getSession().add(value); // Switch to UserProblemSubmissionsPage getSession().get(PageStack.class).push(PageId.USER_PROBLEM_SUBMISSIONS); } }); dockLayoutPanel.add(userProgressView); initWidget(dockLayoutPanel); }
@Override public Widget createWidget() { LayoutPanel layout = new LayoutPanel(); FakeTabPanel titleBar = new FakeTabPanel("Socket Binding Groups"); layout.add(titleBar); ToolStrip toolstrip = new ToolStrip(); toolstrip.addToolButtonRight( new ToolButton( "Add", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.launchNewSocketDialogue(); } })); layout.add(toolstrip); // ----------- VerticalPanel panel = new VerticalPanel(); panel.setStyleName("rhs-content-panel"); ContentHeaderLabel nameLabel = new ContentHeaderLabel("Socket Binding Declarations"); HorizontalPanel horzPanel = new HorizontalPanel(); horzPanel.getElement().setAttribute("style", "width:100%;"); // Image image = new Image(Icons.INSTANCE.deployment()); // horzPanel.add(image); // image.getElement().getParentElement().setAttribute("width", "25"); horzPanel.add(nameLabel); panel.add(horzPanel); socketTable = new SocketTable(); HorizontalPanel tableOptions = new HorizontalPanel(); tableOptions.getElement().setAttribute("cellpadding", "2px"); groupFilter = new ComboBox(); groupFilter.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { presenter.onFilterGroup(event.getValue()); } }); Widget groupFilterWidget = groupFilter.asWidget(); groupFilterWidget.getElement().setAttribute("style", "width:200px;"); tableOptions.add(new Label("Socket Binding Group:")); tableOptions.add(groupFilterWidget); tableOptions.getElement().setAttribute("style", "float:right;"); panel.add(tableOptions); DefaultCellTable socketTableWidget = socketTable.asWidget(); panel.add(socketTableWidget); DefaultPager pager = new DefaultPager(); pager.setPage(0); pager.setPageSize(6); pager.setDisplay(socketTableWidget); panel.add(pager); ScrollPanel scroll = new ScrollPanel(panel); layout.add(scroll); layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 26, Style.Unit.PX); layout.setWidgetTopHeight(toolstrip, 26, Style.Unit.PX, 30, Style.Unit.PX); layout.setWidgetTopHeight(scroll, 56, Style.Unit.PX, 100, Style.Unit.PCT); // ----------- ToolStrip detailToolStrip = new ToolStrip(); editBtn = new ToolButton(Console.CONSTANTS.common_label_edit()); ClickHandler editHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { SocketBinding editedEntity = form.getEditedEntity(); if (editBtn.getText().equals(Console.CONSTANTS.common_label_edit())) { presenter.editSocketBinding(editedEntity); } else { presenter.saveSocketBinding( editedEntity.getName(), editedEntity.getGroup(), form.getChangedValues()); } } }; editBtn.addClickHandler(editHandler); detailToolStrip.addToolButton(editBtn); ClickHandler clickHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { SocketBinding socket = form.getEditedEntity(); Feedback.confirm( "Delete Socket Binding", "Really delete this socket binding '" + socket.getName() + "' ?", new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { presenter.onDelete(form.getEditedEntity()); } } }); } }; ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete()); deleteBtn.addClickHandler(clickHandler); detailToolStrip.addToolButton(deleteBtn); panel.add(new ContentGroupLabel("Socket Binding")); panel.add(detailToolStrip); // --- form = new Form<SocketBinding>(SocketBinding.class); form.setNumColumns(2); TextItem nameItem = new TextItem("name", "Name"); TextItem interfaceItem = new TextItem("interface", "Interface"); NumberBoxItem portItem = new NumberBoxItem("port", "Port"); TextBoxItem multicastItem = new TextBoxItem("multiCastAddress", "Multicast Address"); NumberBoxItem multicastPortItem = new NumberBoxItem("multiCastPort", "Multicast Port"); form.setFields(nameItem, interfaceItem, portItem, multicastItem, multicastPortItem); form.bind(socketTable.getCellTable()); Widget formWidget = form.asWidget(); form.setEnabled(false); final FormHelpPanel helpPanel = new FormHelpPanel( new FormHelpPanel.AddressCallback() { @Override public ModelNode getAddress() { ModelNode address = new ModelNode(); address.add("socket-binding-group", form.getEditedEntity().getGroup()); address.add("socket-binding", "*"); return address; } }, form); panel.add(helpPanel.asWidget()); panel.add(formWidget); // ------------------------------------------ return layout; }
@Override public void forceLayout() { GWT.log("FORCE LAYOUT"); super.forceLayout(); }