/** {@inheritDoc} */ public void render( final Panel renderContainer, final ItemRenderer itemRenderer, final PagedSet<? extends Serializable> items, final String noItemsMessage) { Panel left = new FlowPanel(); left.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionColLeft()); left.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionCol()); Panel right = new FlowPanel(); right.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionColRight()); right.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectionCol()); int count = 0; if (items.getTotal() == 0) { Label noItemsMessageLabel = new Label(noItemsMessage); noItemsMessageLabel.addStyleName( StaticResourceBundle.INSTANCE.coreCss().connectionItemEmpty()); renderContainer.add(noItemsMessageLabel); } else { renderContainer.add(left); renderContainer.add(right); } double halfwayPoint = items.getPagedSet().size() / 2.0; for (Serializable item : items.getPagedSet()) { if (count >= halfwayPoint) { right.add(itemRenderer.render(item)); } else { left.add(itemRenderer.render(item)); } count++; } }
public PreloaderCallback getPreloaderCallback() { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error(String file) { System.out.println("error: " + file); } @Override public void update(PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
/** Show parameters when clicked. */ public void onClick(Widget arg0) { if (parametersForm != null) { parametersForm.clear(); // Add Type: parametersForm.addAttribute("Type", new Label(type.toString())); for (final ConnectionRef connectionRef : constraints.keySet()) { final Constraint constraint = constraints.get(connectionRef); final TextBox priorityTextBox = new TextBox(); priorityTextBox.setWidth("30px"); priorityTextBox.setText(constraint.getPriority() + ""); priorityTextBox.addFocusListener( new FocusListener() { public void onFocus(Widget arg1) { priorityTextBox.selectAll(); } public void onLostFocus(Widget arg1) { final Constraint constraint = constraints.get(connectionRef); constraint.setPriority(Integer.parseInt(priorityTextBox.getText())); constraints.put(connectionRef, constraint); } }); final TextBox constraintTextBox = new TextBox(); constraintTextBox.setWidth("300px"); constraintTextBox.setText(constraint.getConstraint()); constraintTextBox.addFocusListener( new FocusListener() { public void onFocus(Widget arg1) { constraintTextBox.selectAll(); } public void onLostFocus(Widget arg1) { final Constraint constraint = constraints.get(connectionRef); constraint.setConstraint(constraintTextBox.getText()); constraints.put(connectionRef, constraint); } }); Panel panel = new HorizontalPanel(); panel.add(new Label(" Priority: ")); panel.add(priorityTextBox); panel.add(new Label(" Value: ")); panel.add(constraintTextBox); parametersForm.addAttribute(constraint.getName(), panel); } } }
public AboutView() { super(); mainPanel.setWidth("100%"); mainPanel.add(new HTML("<h1>" + Messages.Util.INSTANCE.get().about() + "</h1>")); Panel panelV = new VerticalPanel(); panelV.setWidth("100%"); ((HasHorizontalAlignment) panelV).setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); Panel panel = new FlowPanel(); panel.getElement().getStyle().setProperty("maxWidth", "400px"); // might be judicious to use css instead... String pstyle = "style=\"text-align: justify; font-size: 125%;\""; StringBuilder htmlStr = new StringBuilder(); htmlStr.append("<h2>General Information</h2>"); htmlStr.append("<p ").append(pstyle).append(">"); htmlStr.append("This simple web app provides a showcase for the "); htmlStr.append("<a href=\"https://developer.lufthansa.com/\">Lufthansa Open API</a>. "); htmlStr.append( "The API and data are used in conformance with the <a href=\"https://developer.lufthansa.com/General_Terms_and_Conditions\">license</a>."); htmlStr.append("</p>"); htmlStr.append("<h2>Some Technical Aspects</h2>"); htmlStr.append("<p ").append(pstyle).append(">"); htmlStr.append("This app is developped using <a href=\"http://www.gwtproject.org/\">GWT</a>. "); htmlStr.append( "It reposes on the MVP architecture (Model-View-Presenter) as described in the article <a href=\"http://www.gwtproject.org/articles/mvp-architecture.html\">Building MVP apps</a>."); htmlStr.append("</p>"); htmlStr.append("<h2>Source Code</h2>"); htmlStr.append("<p ").append(pstyle).append(">"); htmlStr.append( "The source code is available on <a href=\"https://github.com/roikku/lh-api-showcase\">GitHub</a>. "); htmlStr.append("</p>"); htmlStr.append("<h2>Disclaimer</h2>"); htmlStr.append("<p ").append(pstyle).append(">"); htmlStr.append( "The owner of this website cannot be held liable for damages of any kind arising out of use, reference to, or reliance on any information found on this site. It must be borne in mind that no guarantee is given that the information provided in this website is correct, complete, and up-to-date."); htmlStr.append("</p>"); panel.add(new HTML(htmlStr.toString())); panelV.add(panel); mainPanel.add(panelV); initWidget(mainPanel); }
@Override public void init(P presenter) { super.setPresenter(presenter); super.setVisualization(container); container.add(titleHtml); container.add(filterPanel); container.add(displayerPanel); filterPanel.getElement().setAttribute("cellpadding", "2"); }
public static TextBox addTextBox(Panel p, String label, String infoMsg, boolean isPassword) { HorizontalPanel hp = new HorizontalPanel(); hp.add(new Label(label)); Image info = new Image(ImporterPlugin.RESOURCES.info()); info.setTitle(infoMsg); hp.add(info); hp.add(new Label(":")); Panel vp = new VerticalPanel(); vp.add(hp); TextBox tb = createTextBox(isPassword); vp.add(tb); p.add(vp); return tb; }
@Override public void showError(String message, String cause) { currentDisplayer = null; displayerPanel.clear(); displayerPanel.add(errorWidget); errorWidget.show(message, cause); }
/** * Initializes the widget given a map of select options. * * <p>The keys of the map are the values of the select options, while the values of the map are * the labels which should be used for the checkboxes. * * @param items the map of select options */ protected void init(Map<String, String> items) { initWidget(m_panel); m_items = new LinkedHashMap<String, String>(items); m_panel.setStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().multiCheckBox()); m_panel.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().textMedium()); for (Map.Entry<String, String> entry : items.entrySet()) { String value = entry.getValue(); CmsCheckBox checkbox = new CmsCheckBox(value); // wrap the check boxes in FlowPanels to arrange them vertically FlowPanel checkboxWrapper = new FlowPanel(); checkboxWrapper.add(checkbox); m_panel.add(checkboxWrapper); } m_panel.add(m_error); }
protected final void refreshInnerWidgetList(List data) { panel.clear(); items.clear(); view = newMasterView(); view.setItems(data != null ? data : new ArrayList()); panel.add(view); }
/** * Initialize widget components and layout elements. * * @param type file input to use * @param form An existing form panel to use */ public Uploader(FileInputType type, FormPanel form) { thisInstance = this; this.fileInputType = type; if (form == null) { form = new FormFlowPanel(); } uploadForm = form; uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); uploadForm.addSubmitHandler(onSubmitFormHandler); uploadForm.addSubmitCompleteHandler(onSubmitCompleteHandler); // Issue #206 FormElement.as(uploadForm.getElement()).setAcceptCharset("UTF-8"); uploaderPanel = getUploaderPanel(); uploaderPanel.add(uploadForm); uploaderPanel.setStyleName(STYLE_MAIN); setFileInput(fileInputType.getInstance()); setStatusWidget(statusWidget); super.initWidget(uploaderPanel); }
@UiHandler(value = "newFilterListBox") public void onNewFilterSelected(ChangeEvent changeEvent) { int selectedIdx = newFilterListBox.getSelectedIndex(); if (selectedIdx > 0) { String columnId = metadata.getColumnId(selectedIdx - 1); ColumnType columnType = metadata.getColumnType(selectedIdx - 1); CoreFunctionFilter columnFilter = FilterFactory.createCoreFunctionFilter( columnId, columnType, ColumnType.DATE.equals(columnType) ? CoreFunctionType.TIME_FRAME : CoreFunctionType.NOT_EQUALS_TO); if (filter == null) filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); ColumnFilterEditor columnFilterEditor = new ColumnFilterEditor(); columnFilterEditor.init(metadata, columnFilter, this); columnFilterEditor.expand(); filterListPanel.add(columnFilterEditor); newFilterListBox.setSelectedIndex(0); addFilterPanel.setVisible(false); addFilterButton.setVisible(true); columnFilterChanged(columnFilterEditor); } }
/** * Constructor. * * @param entityType Type of entity the avatar belongs to. * @param entityUniqueId Short name / account id of entity the avatar belongs to. * @param avatar Avatar image widget. */ public AvatarLinkPanel( final EntityType entityType, final String entityUniqueId, final AvatarWidget avatar) { Panel main = new FlowPanel(); main.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatar()); initWidget(main); Page page; switch (entityType) { case PERSON: page = Page.PEOPLE; break; case GROUP: page = Page.GROUPS; break; default: // this should never happen return; } HashMap<String, String> params = new HashMap<String, String>(); params.put("tab", "Stream"); String linkUrl = Session.getInstance().generateUrl(new CreateUrlRequest(page, entityUniqueId, params)); Hyperlink link = new InlineHyperlink("", linkUrl); main.add(link); link.getElement().appendChild(avatar.getElement()); }
@Override public void showDisplayer(Displayer displayer) { if (displayer != currentDisplayer) { displayerPanel.clear(); displayerPanel.add(displayer); currentDisplayer = displayer; } }
private void checkLogLabel() { if (log == null) { log = new TextArea(); log.setSize(graphics.getWidth() + "px", "200px"); log.setReadOnly(true); root.add(log); } }
/** This is called in the unhappy event of there being errors. */ public static void showBuilderErrors( BuilderResult results, Panel buildResults, ClientFactory clientFactory) { buildResults.clear(); BuildPackageErrorsSimpleTable errorsTable = new BuildPackageErrorsSimpleTable(clientFactory); errorsTable.setRowData(results.getLines()); errorsTable.setRowCount(results.getLines().size()); buildResults.add(errorsTable); }
protected void setupPanel(List<TextBox> textBoxes) { Panel panel = new HorizontalPanel(); includeOrExclude.addItem("Include"); includeOrExclude.addItem("Exclude"); panel.add(includeOrExclude); for (TextBox textBox : textBoxes) { panel.add(new Label(textBox.getName())); panel.add(textBox); } SimpleHyperlink deleteLink = new SimpleHyperlink("[X]"); deleteLink.addClickListener(this); panel.add(deleteLink); initWidget(panel); }
private void setupLoop() { // setup modules try { graphics = new GwtGraphics(root, config); } catch (Throwable e) { root.clear(); root.add(new Label("Sorry, your browser doesn't seem to support WebGL")); return; } lastWidth = graphics.getWidth(); lastHeight = graphics.getHeight(); Gdx.app = this; Gdx.audio = new GwtAudio(); Gdx.graphics = graphics; Gdx.gl20 = graphics.getGL20(); Gdx.gl = graphics.getGLCommon(); Gdx.files = new GwtFiles(preloader); this.input = new GwtInput(graphics.canvas); Gdx.input = this.input; this.net = new GwtNet(); Gdx.net = this.net; // tell listener about app creation try { listener.create(); listener.resize(graphics.getWidth(), graphics.getHeight()); } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); t.printStackTrace(); throw new RuntimeException(t); } // setup rendering timer new Timer() { @Override public void run() { try { graphics.update(); if (Gdx.graphics.getWidth() != lastWidth || Gdx.graphics.getHeight() != lastHeight) { GwtApplication.this.listener.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); lastWidth = graphics.getWidth(); lastHeight = graphics.getHeight(); Gdx.gl.glViewport(0, 0, lastWidth, lastHeight); } for (int i = 0; i < runnables.size; i++) { runnables.get(i).run(); } runnables.clear(); listener.render(); input.justTouched = false; } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); throw new RuntimeException(t); } } }.scheduleRepeating((int) ((1f / config.fps) * 1000)); }
public BootstrapGeneratorWidget() { contentPanel = new VerticalPanel(); contentPanel.setWidth("800px"); surveyService = GWT.create(SurveyService.class); addSurveyButton = new Button(TEXT_CONSTANTS.addSelected()); addSurveyButton.addClickHandler(this); generateFileButton = new Button(TEXT_CONSTANTS.generate()); generateFileButton.addClickHandler(this); removeButton = new Button(TEXT_CONSTANTS.removeSelected()); removeButton.addClickHandler(this); CaptionPanel selectorPanel = new CaptionPanel(TEXT_CONSTANTS.selectSurveyForInclusion()); HorizontalPanel temp = new HorizontalPanel(); selectionWidget = new SurveySelectionWidget(Orientation.HORIZONTAL, TerminalType.SURVEY); temp.add(selectionWidget); temp.add(addSurveyButton); selectorPanel.add(temp); contentPanel.add(selectorPanel); CaptionPanel zipPanel = new CaptionPanel(TEXT_CONSTANTS.fileContents()); selectionListbox = new ListBox(true); selectionListbox.setVisibleItemCount(DEFAULT_ITEM_COUNT); VerticalPanel zipPanelContent = new VerticalPanel(); HorizontalPanel selectedSurveyPanel = new HorizontalPanel(); ViewUtil.installFieldRow( selectedSurveyPanel, TEXT_CONSTANTS.selectedSurveys(), selectionListbox, LABEL_STYLE); selectedSurveyPanel.add(removeButton); zipPanelContent.add(selectedSurveyPanel); temp = new HorizontalPanel(); includeDbScriptBox = new CheckBox(); includeDbScriptBox.addClickHandler(this); ViewUtil.installFieldRow(temp, TEXT_CONSTANTS.includeDB(), includeDbScriptBox, LABEL_STYLE); zipPanelContent.add(temp); dbInstructionArea = new TextArea(); dbInstructionArea.setVisible(false); zipPanelContent.add(dbInstructionArea); temp = new HorizontalPanel(); notificationEmailBox = new TextBox(); ViewUtil.installFieldRow( temp, TEXT_CONSTANTS.notificationEmail(), notificationEmailBox, LABEL_STYLE); zipPanelContent.add(temp); zipPanelContent.add(generateFileButton); zipPanel.add(zipPanelContent); contentPanel.add(zipPanel); initWidget(contentPanel); }
public void addChoice(String choice) { RadioButton button = new RadioButton(groupName, choice); if (radioButtons.isEmpty()) { // first button in this group defaultButton = button; button.setValue(true); } radioButtons.add(button); container.add(button); }
@Override public void addFilterReset() { Anchor anchor = new Anchor(ChartJsDisplayerConstants.INSTANCE.chartjsDisplayer_resetAnchor()); filterPanel.add(anchor); anchor.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { getPresenter().onFilterResetClicked(); } }); }
public static CheckBox addCheckBox(Panel p, String label, String infoMsg) { HorizontalPanel hp = new HorizontalPanel(); CheckBox cb = new CheckBox(label); cb.setText(label); hp.add(cb); Image info = new Image(ImporterPlugin.RESOURCES.info()); info.setTitle(infoMsg); hp.add(info); p.add(hp); return cb; }
public void initialize() { customSqlBox.setSize("50em", "5em"); quickReferenceLink.addClickListener(this); showHideControlsLink.addClickListener(this); filterList = new WidgetList<TestFilterWidget>(filterFactory); Panel titlePanel = new HorizontalPanel(); titlePanel.add(getFieldLabel("Test attributes:")); titlePanel.add( new HTML( " <a href=\"" + WIKI_URL + "#attribute_filtering\" " + "target=\"_blank\">[?]</a>")); Panel attributeFilters = new VerticalPanel(); attributeFilters.setStyleName("box"); attributeFilters.add(titlePanel); attributeFilters.add(filterList); Panel commonFilterPanel = new VerticalPanel(); commonFilterPanel.add(customSqlBox); commonFilterPanel.add(attributeFilters); commonFilterPanel.add(showInvalid); RootPanel.get("common_filters").add(commonFilterPanel); RootPanel.get("common_quick_reference").add(quickReferenceLink); RootPanel.get("common_show_hide_controls").add(showHideControlsLink); generateQuickReferencePopup(); }
public static void showLoading(boolean isShow, Panel con) { if (isShow) { if (!(con instanceof RootPanel)) { div.getElement().getStyle().setProperty("position", "absolute"); } div.setStyleName("valign-wrapper loader-wrapper"); div.add(preLoader); con.add(div); } else { div.removeFromParent(); preLoader.removeFromParent(); } }
private void doBuild( final Panel buildResults, final String statusOperator, final String statusValue, final boolean enableStatusSelector, final String categoryOperator, final String category, final boolean enableCategorySelector, final String customSelector) { buildResults.clear(); final HorizontalPanel busy = new HorizontalPanel(); busy.add(new Label(constants.ValidatingAndBuildingPackagePleaseWait())); busy.add(new Image(images.redAnime())); buildResults.add(busy); Scheduler scheduler = Scheduler.get(); scheduler.scheduleDeferred( new Command() { public void execute() { RepositoryServiceFactory.getPackageService() .buildPackage( conf.getUuid(), true, buildMode, statusOperator, statusValue, enableStatusSelector, categoryOperator, category, enableCategorySelector, customSelector, new GenericCallback<BuilderResult>() { public void onSuccess(BuilderResult result) { LoadingPopup.close(); if (result == null || !result.hasLines()) { showSuccessfulBuild(buildResults); } else { showBuilderErrors(result, buildResults, clientFactory); } } public void onFailure(Throwable t) { buildResults.clear(); super.onFailure(t); } }); } }); }
void setupLoop() { // setup modules try { graphics = new GwtGraphics(root, config); } catch (Throwable e) { root.clear(); root.add(getNoWebGLSupportWidget()); return; } lastWidth = graphics.getWidth(); lastHeight = graphics.getHeight(); Gdx.app = this; Gdx.audio = new GwtAudio(); Gdx.graphics = graphics; Gdx.gl20 = graphics.getGL20(); Gdx.gl = Gdx.gl20; Gdx.files = new GwtFiles(preloader); this.input = new GwtInput(graphics.canvas); Gdx.input = this.input; this.net = new GwtNet(); Gdx.net = this.net; this.clipboard = new GwtClipboard(); updateLogLabelSize(); // tell listener about app creation try { listener.create(); listener.resize(graphics.getWidth(), graphics.getHeight()); } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); t.printStackTrace(); throw new RuntimeException(t); } AnimationScheduler.get() .requestAnimationFrame( new AnimationCallback() { @Override public void execute(double timestamp) { try { mainLoop(); } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); throw new RuntimeException(t); } AnimationScheduler.get().requestAnimationFrame(this, graphics.canvas); } }, graphics.canvas); }
/** Creates a new instance of SoftVerticalScroll */ public SoftHorizontalScrollbar(SoftScrollArea target) { this.target = target; this.base = new SimplePanel(); Panel horizontal = new HorizontalPanel(); this.base.setWidget(horizontal); super.initWidget(this.base); this.higherTarget.setWidget(this.higher); this.barTarget.setWidget(this.bar); this.lowerTarget.setWidget(this.lower); horizontal.add(lowerTarget); horizontal.add(barTarget); horizontal.add(higherTarget); this.setStyleName("gwittir-SoftHorizontalScrollbar"); this.bar.setStyleName("bar"); this.lower.setStyleName("lower"); this.higher.setStyleName("higher"); DOM.setStyleAttribute(this.lower.getElement(), "overflow", "hidden"); DOM.setStyleAttribute(this.bar.getElement(), "overflow", "hidden"); DOM.setStyleAttribute(this.higher.getElement(), "overflow", "hidden"); DOM.setStyleAttribute(this.getElement(), "overflow", "hidden"); }
/** set the status widget used to display the upload progress. */ public void setStatusWidget(IUploadStatus stat) { if (stat == null) { return; } uploaderPanel.remove(statusWidget.asWidget()); statusWidget = stat; if (!stat.asWidget().isAttached()) { uploaderPanel.add(statusWidget.asWidget()); } statusWidget.asWidget().addStyleName(STYLE_STATUS); statusWidget.setVisible(false); statusWidget.addCancelHandler(cancelHandler); statusWidget.setStatusChangedHandler(statusChangedHandler); }
private void showDatastoreSelection(final Panel outerPanel, final List<RadioButton> radios) { final FlowPanel datastoreSelectionPanel = new FlowPanel(); outerPanel.add(datastoreSelectionPanel); datastoreService.getAvailableDatastores( getTenant(), new DCAsyncCallback<List<DatastoreIdentifier>>() { @Override public void onSuccess(List<DatastoreIdentifier> datastores) { _datastores = datastores; showDatastoreSelection(datastoreSelectionPanel, datastores, radios); } }); }
public AppointmentWidget() { this.setStylePrimaryName("gwt-appointment"); headerPanel.setStylePrimaryName("header"); bodyPanel.setStylePrimaryName("body"); footerPanel.setStylePrimaryName("footer"); timelinePanel.setStylePrimaryName("timeline"); timelineFillPanel.setStylePrimaryName("timeline-fill"); this.add(headerPanel); this.add(bodyPanel); this.add(footerPanel); this.add(timelinePanel); timelinePanel.add(timelineFillPanel); DOM.setStyleAttribute(this.getElement(), "position", "absolute"); }
@Override public void display( Panel mainContainer, Panel facetContent, Panel headerPanel, Panel logoutPanel, Panel notificationPanel) { mainContainer.clear(); facetContent.clear(); bind(); mainContainer.addStyleName("Border"); mainContainer.add(this.display.getPublishContainer()); }