List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth
public void setCellWidth(IsWidget w, String width)
From source file:ilarkesto.gwt.client.Gwt.java
License:Open Source License
public static HorizontalPanel createHorizontalPanel(int spacing, Widget... widgets) { assert (widgets.length > 0); HorizontalPanel panel = new HorizontalPanel(); panel.setWidth("100%"); boolean first = true; for (Widget widget : widgets) { if (first) { first = false;// w w w . j a v a2 s. c om } else { if (spacing > 0) { Widget spacer = createEmptyDiv("HorizontalPanel-spacer"); panel.add(spacer); panel.setCellWidth(spacer, spacing + "px"); } } panel.add(widget); } return panel; }
From source file:n3phele.client.view.AccountHyperlinkView.java
License:Open Source License
private void setChartTableData() { ChangeHandler dropBoxEvent = new ChangeHandler() { public void onChange(ChangeEvent event) { if (options.isItemSelected(0)) { costOption = "normal"; if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); chart = new LineChart(createTable(), createOptions(chartTitle)); historyTable.setWidget(2, 0, chart); } else { costOption = "cumulative"; if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); chart = new LineChart(createTable(), createOptions(chartTitle)); historyTable.setWidget(2, 0, chart); }/*w w w . j a v a2 s . c o m*/ } }; vsTable.getColumnFormatter().setWidth(0, chartPanel.getOffsetWidth() + "px"); historyTable.getColumnFormatter().setWidth(0, chartPanel.getOffsetWidth() + "px"); HorizontalPanel chartOptionsTable = new HorizontalPanel(); if (options.getItemCount() < 2) { options.insertItem("Cost", 0); options.insertItem("Cumulative Cost", 1); } options.setWidth("126px"); options.addChangeHandler(dropBoxEvent); chartOptionsTable.add(options); chartOptionsTable.setCellWidth(options, "160px"); hours = new Button("24 hours", new ClickHandler() { public void onClick(ClickEvent event) { requestChartData("24hours"); chartTitle = "24 Hours Costs Chart"; if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); chart = new LineChart(createTable(), createOptions(chartTitle)); historyTable.setWidget(2, 0, chart); } }); hours.setWidth("70px"); chartOptionsTable.add(hours); days = new Button("7 days", new ClickHandler() { public void onClick(ClickEvent event) { // getProcessByDay(7); requestChartData("7days"); chartTitle = "7 Days Costs Chart"; if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); chart = new LineChart(createTable(), createOptions(chartTitle)); historyTable.setWidget(2, 0, chart); } }); days.setWidth("70px"); chartOptionsTable.add(days); month = new Button("30 days", new ClickHandler() { public void onClick(ClickEvent event) { // getProcessByDay(30); requestChartData("30days"); chartTitle = "30 Days Costs Chart"; if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); chart = new LineChart(createTable(), createOptions(chartTitle)); historyTable.setWidget(2, 0, chart); } }); month.setWidth("70px"); chartOptionsTable.add(month); historyTable.setWidget(1, 0, chartOptionsTable); historyTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); if (historyTable.isCellPresent(2, 0)) historyTable.clearCell(2, 0); historyTable.setWidget(2, 0, chart); historyTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER); vsTable.setWidget(1, 0, dataGrid); vsTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); }
From source file:n3phele.client.view.CommandDetailView.java
License:Open Source License
public CommandDetailView(ImageResource icon, String heading, String runButtonText, String cancelButtonText) { super(new MenuItem(icon, heading, null)); title = new FlexTable(); title.setCellSpacing(8);/*w ww. j ava 2 s . c o m*/ title.setWidth("100%"); commandName = new InlineHTML(commandDescriptionText); title.setWidget(0, 0, commandName); commandName.addStyleName(N3phele.n3pheleResource.css().commandDetailHeader()); commandDescription = new InlineHTML(commandDescriptionText); commandDescription.addStyleName(N3phele.n3pheleResource.css().commandDetailText()); title.setWidget(0, 1, commandDescription); commandVersion = new InlineHTML(commandVersionText); title.setWidget(1, 0, commandVersion); title.getCellFormatter().setStylePrimaryName(1, 0, N3phele.n3pheleResource.css().commandDetailText()); title.getFlexCellFormatter().setRowSpan(0, 1, 2); this.add(title); /* * Setup parameters section of the view */ parameters = new SectionPanel("Parameters"); this.paramTable = createParameterTable(); parameters.add(paramTable); this.add(parameters); /* * Setup input and output files sections of the view */ nullRepoColumnIn = new Column<FileSpecification, FileSpecification>(createRepoRefCompositeCell(true)) { @Override public FileSpecification getValue(FileSpecification fs) { return fs; } }; nullRepoColumnOut = new Column<FileSpecification, FileSpecification>(createRepoRefCompositeCell(false)) { @Override public FileSpecification getValue(FileSpecification fs) { return fs; } }; inputs = new SectionPanel("Input Files"); inputTable = createFileTable(inputRepoColumn = nullRepoColumnIn); inputs.add(inputTable); this.add(inputs); outputs = new SectionPanel("Output Files"); outputTable = createFileTable(outputRepoColumn = nullRepoColumnOut); outputs.add(outputTable); this.add(outputs); clouds = new SectionPanel("Execute On"); HorizontalPanel divider = new HorizontalPanel(); divider.setWidth("100%"); clouds.add(divider); gotExecutionSelection = new CellWidget<String>( new ValidInputIndicatorCell(N3phele.n3pheleResource.inputErrorIcon()), "+Execution target selection required"); divider.add(gotExecutionSelection); divider.setCellVerticalAlignment(gotExecutionSelection, HorizontalPanel.ALIGN_MIDDLE); divider.setCellWidth(gotExecutionSelection, "20px"); accountTable = createAccountTable(); divider.add(accountTable); this.sendEmail = new CheckBox("Send you an email on completion"); sendEmail.setWordWrap(true); divider.add(sendEmail); divider.setCellVerticalAlignment(sendEmail, HorizontalPanel.ALIGN_MIDDLE); divider.setCellHorizontalAlignment(sendEmail, HorizontalPanel.ALIGN_CENTER); divider.setCellWidth(sendEmail, "20%"); this.add(clouds); buttons = new HorizontalPanel(); buttons.setWidth("90%"); buttons.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); Label jobLabel = new Label("with job name "); buttons.add(jobLabel); jobName = new TextBox(); buttons.add(jobName); Label fill = new Label(""); buttons.add(fill); buttons.setCellWidth(fill, "10%"); run = new Button(runButtonText); run.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { doRun(); } }); run.setEnabled(false); buttons.add(run); errorsOnPage = new CellWidget<String>(new ValidInputIndicatorCell(N3phele.n3pheleResource.inputErrorIcon()), "+check for missing or invalid parameters marked with this icon"); buttons.add(errorsOnPage); buttons.setCellWidth(errorsOnPage, "20px"); cancel = new Button(cancelButtonText); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { doCancel(); } }); buttons.add(cancel); this.add(buttons); }
From source file:n3phele.client.view.CreateServiceView.java
License:Open Source License
public CreateServiceView() { super(new MenuItem(N3phele.n3pheleResource.serviceIcon(), "Create Service", null)); table = new FlexTable(); table.setCellPadding(10);/*from w w w . ja va2s . co m*/ ChangeHandler update = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { validateAccount(true); } }; KeyUpHandler keyup = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { validateAccount(true); } }; this.account = null; Label lblNewLabel = new Label("Service Name"); table.setWidget(0, 0, lblNewLabel); nameValid = new ValidInputIndicatorWidget("Text value required", false); table.setWidget(0, 1, nameValid); name = new TextBox(); name.setVisibleLength(40); name.addChangeHandler(update); name.addKeyUpHandler(keyup); table.setWidget(0, 2, name); //accounts clouds = new SectionPanel("Execute On"); HorizontalPanel divider = new HorizontalPanel(); divider.setWidth("100%"); clouds.add(divider); gotExecutionSelection = new CellWidget<String>( new ValidInputIndicatorCell(N3phele.n3pheleResource.inputErrorIcon()), "+Execution target selection required"); gotExecutionSelection.setPixelSize(20, 20); divider.add(gotExecutionSelection); divider.setCellVerticalAlignment(gotExecutionSelection, HorizontalPanel.ALIGN_MIDDLE); divider.setCellWidth(gotExecutionSelection, "20px"); accountTable = createAccountTable(); divider.add(accountTable); this.add(clouds); secretTextSupplied = new ValidInputIndicatorWidget("Secret text required", false); gotCloudId = new ValidInputIndicatorWidget("Cloud id required", false); cloudSelected = new ValidInputIndicatorWidget("Cloud selection required", false); cancel = new Button("cancel", new ClickHandler() { public void onClick(ClickEvent event) { do_cancel(); } }); table.setWidget(1, 2, cancel); run = new Button("create", new ClickHandler() { public void onClick(ClickEvent event) { do_run(); } }); table.setWidget(1, 0, run); errorsOnPage = new ValidInputIndicatorWidget( "check for missing or invalid parameters marked with this icon", false); table.setWidget(0, 3, errorsOnPage); table.getFlexCellFormatter().setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); table.getColumnFormatter().setWidth(0, "25%"); table.getColumnFormatter().setWidth(1, "18px"); table.getColumnFormatter().setWidth(4, "16px"); table.setCellPadding(1); table.setCellSpacing(5); this.add(table); validateAccount(true); }
From source file:net.auroris.ColorPicker.client.ColorPicker.java
License:GNU Affero Public License
/** * Instantiates a new color picker./*from ww w .ja v a2 s. c o m*/ */ public ColorPicker() { // UI Drawing // ------------------ hue = 0; saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; final VerticalPanel vp = new VerticalPanel(); final HorizontalPanel hp = new HorizontalPanel(); final FlexTable hxTable = new FlexTable(); vp.add(hxTable); vp.add(hp); // Add the large slider map slidermap = new SliderMap(this); hp.add(slidermap); hp.setCellWidth(slidermap, "130px"); hp.setCellHeight(slidermap, "130px"); // Add the small slider bar sliderbar = new SliderBar(this); hp.add(sliderbar); hp.setCellWidth(sliderbar, "30px"); hp.setCellHeight(sliderbar, "130px"); // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); colorpreview.setWidth("30px"); colorpreview.setHeight("30px"); DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); // Radio buttons final String rbgroup = "color" + this.hashCode(); rbHue = new RadioButton(rbgroup, "H:"); rbHue.addClickHandler(this); rbSaturation = new RadioButton(rbgroup, "S:"); rbSaturation.addClickHandler(this); rbBrightness = new RadioButton(rbgroup, "V:"); rbBrightness.addClickHandler(this); rbRed = new RadioButton(rbgroup, "R:"); rbRed.addClickHandler(this); rbGreen = new RadioButton(rbgroup, "G:"); rbGreen.addClickHandler(this); rbBlue = new RadioButton(rbgroup, "B:"); rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable hxTable.setWidget(0, 0, colorpreview); hxTable.getFlexCellFormatter().setColSpan(0, 0, 3); // Uncomment this part if we want the rest of textboxes // hxTable.setWidget(1, 0, rbHue); // hxTable.setWidget(1, 1, tbHue); // hxTable.setWidget(1, 2, new HTML("°")); // hxTable.setWidget(2, 0, rbSaturation); // hxTable.setWidget(2, 1, tbSaturation); // hxTable.setText(2, 2, "%"); // hxTable.setWidget(3, 0, rbBrightness); // hxTable.setWidget(3, 1, tbBrightness); // hxTable.setText(3, 2, "%"); // hxTable.setWidget(4, 0, rbRed); // hxTable.setWidget(4, 1, tbRed); // hxTable.setWidget(5, 0, rbGreen); // hxTable.setWidget(5, 1, tbGreen); // hxTable.setWidget(6, 0, rbBlue); // hxTable.setWidget(6, 1, tbBlue); hxTable.setText(0, 1, "# "); hxTable.setWidget(0, 2, tbHexColor); // table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup // panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); // First event onClick(rbSaturation); initWidget(vp); }
From source file:net.autosauler.ballance.client.gui.CommInfoPanel.java
License:Apache License
/** * Instantiates a new comm info panel.//from w w w .jav a 2 s . c o m */ public CommInfoPanel() { super(false); Image i = new Image(Images.menu.icoRefresh()); Label msg = new Label(M.comm.commInProgress()); HorizontalPanel panel = new HorizontalPanel(); panel.setWidth("200px"); panel.setHeight("32px"); panel.add(i); panel.setCellWidth(i, "32px"); panel.setSpacing(2); panel.add(msg); setWidget(panel); // int width = RootPanel.get().getOffsetWidth(); // int height = RootPanel.get().getOffsetHeight(); int width = Window.getClientWidth() - 20; int height = Window.getClientHeight() * 3 / 4; int x = 250; int y = 100; if (width > 0) { x = width - 320; } if (height > 0) { y = height; } setPopupPosition(x, y); }
From source file:net.autosauler.ballance.client.gui.DatabasePanel.java
License:Apache License
/** * Instantiates a new database panel./*from ww w. ja v a 2s . c om*/ */ private DatabasePanel() { super(new VBoxLayout()); add(createGlobalScriptPanel()); add(createDropDatabasePanel()); add(createDumpDatabasePanel()); settingspanel = createSettingsPanel(); add(settingspanel); MainPanel.setCommInfo(true); Services.database.getSettings(new AsyncCallback<HashMap<String, String>>() { @Override public void onFailure(Throwable caught) { MainPanel.setCommInfo(false); settingspanel.clear(); Label err = new Label(caught.getMessage()); err.setVisible(false); settingspanel.add(err); effectAppear(err.getElement()); Log.error(caught.getMessage()); } @Override public void onSuccess(HashMap<String, String> result) { MainPanel.setCommInfo(false); settings = result; settingspanel.clear(); final Button btn = new Button(); btn.setText(M.database.btnSoreChanges()); btn.setEnabled(false); settingvalue = new TextBox(); settingvalue.setWidth("200px"); settingvalue.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { btn.setEnabled(true); } }); // create celllist // ============================================ ProvidesKey<String> provider = new ProvidesKey<String>() { @Override public Object getKey(String item) { return item == null ? null : item; } }; ListDataProvider<String> dataProvider = new ListDataProvider<String>(); dataProvider.setList(new ArrayList<String>(settings.keySet())); setingsList = new CellList<String>(new TextCell() { }, provider); setingsList.setPageSize(30); setingsList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); setingsList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION); // Add a selection model so we can select cells. final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(provider); setingsList.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { settingvalue.setText(settings.get(selectionModel.getSelectedObject())); } }); dataProvider.addDataDisplay(setingsList); // celllist created // ======================================================= btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String name = selectionModel.getSelectedObject(); String value = settingvalue.getText().trim(); if (!value.isEmpty()) { HashMap<String, String> values = new HashMap<String, String>(); values.put(name, value); MainPanel.setCommInfo(true); Services.database.setSettings(values, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { MainPanel.setCommInfo(false); new AlertDialog(caught).show(); } @Override public void onSuccess(Void result) { MainPanel.setCommInfo(false); btn.setEnabled(false); } }); } } }); HorizontalPanel panel = new HorizontalPanel(); panel.setSpacing(4); panel.setWidth("500px"); panel.setVisible(false); panel.add(setingsList); panel.setCellWidth(setingsList, "200px"); panel.add(settingvalue); panel.add(btn); settingspanel.add(panel); effectAppear(panel.getElement()); } }); }
From source file:net.cbtltd.client.field.spinner.VolumeSlider.java
License:Apache License
/** * Instantiates a new volume slider./*from w w w . ja va 2s .c om*/ * * @param min the minimum value of the spinner. * @param max the maximum value of the spinner. * @param value the initial value of the spinner. */ public VolumeSlider(Integer min, Integer max, Integer value) { HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setStyleName("gwt-VolumeSlider"); horizontalPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); progressBar = new ProgressBar(min, max); progressBar.setProgress(value); // spinner = new Spinner(listener, value, min, max, 1, 5, true, resources); spinner = new Spinner(listener, value, min, max, 1, 5, true); SimplePanel leftPanel = new SimplePanel(); leftPanel.add(spinner.getDecrementArrow()); leftPanel.setStyleName("decreaseArrow"); horizontalPanel.add(leftPanel); horizontalPanel.add(progressBar); progressBar.setWidth("100%"); horizontalPanel.setCellWidth(progressBar, "100%"); SimplePanel rightPanel = new SimplePanel(); rightPanel.add(spinner.getIncrementArrow()); rightPanel.setStyleName("increaseArrow"); horizontalPanel.add(rightPanel); initWidget(horizontalPanel); }
From source file:net.europa13.taikai.web.client.ui.MainPanel.java
License:Open Source License
/** * Constructor./*from www. j a va2s . c o m*/ */ private MainPanel() { super("<div id=\"top\"></div>\n<div id=\"middle\"></div>\n<div id=\"bottom\">\n"); setWidth("100%"); HorizontalPanel topPanel = new HorizontalPanel(); // topPanel.setWidth("100%"); topPanel.add(new HTML("<h1>TaikaiWeb</h1>")); // topPanel.setBorderWidth(1); add(topPanel, "top"); HorizontalPanel middlePanel = new HorizontalPanel(); sidePanel = new SidePanel(this); sidePanel.setWidth("100%"); sidePanel.setHeight("100%"); // sidePanel.setBorderWidth(1); middlePanel.add(sidePanel); toolbarPanel = new FlowPanel(); toolbarPanel.setStyleName("taikaiweb-Toolbar"); toolbarPanel.add(new Label("Tools:")); contentContainerPanel = new HTMLPanel("<div id=\"toolbar\"></div><div id=\"content\"></div>"); contentContainerPanel.setWidth("100%"); contentContainerPanel.setHeight("100%"); contentContainerPanel.add(toolbarPanel, "toolbar"); DecoratorPanel decorator = new DecoratorPanel(); decorator.add(contentContainerPanel); decorator.setWidth("100%"); decorator.setHeight("100%"); // decorator.set // middlePanel.add(contentContainerPanel); middlePanel.add(decorator); // middlePanel.setCellHeight(sidePanel, "100%"); middlePanel.setCellWidth(sidePanel, "20%"); middlePanel.setCellHeight(sidePanel, "100%"); middlePanel.setCellWidth(contentContainerPanel, "80%"); middlePanel.setCellWidth(contentContainerPanel, "100%"); middlePanel.setWidth("100%"); add(middlePanel, "middle"); }
From source file:nl.mpi.tg.eg.experiment.client.view.ComplexView.java
License:Open Source License
public List<StimulusButton> addRatingButtons(final List<PresenterEventListner> presenterListeners, final String ratingLabelLeft, final String ratingLabelRight, boolean footerButtons, String styleName, final String buttonGroupName, final String savedValue, final HorizontalPanel buttonsStylePanel) { final ArrayList<StimulusButton> stimulusButtonList = new ArrayList<>(); final VerticalPanel verticalPanel = new VerticalPanel(); final HorizontalPanel labelsPanel = new HorizontalPanel(); if (ratingLabelLeft != null) { labelsPanel.add(new Label(ratingLabelLeft)); }/*from w w w.ja va 2s. c o m*/ if (ratingLabelRight != null) { final Label label = new Label(ratingLabelRight); labelsPanel.add(label); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); } final HorizontalPanel buttonsPanel = (buttonsStylePanel != null) ? buttonsStylePanel : new HorizontalPanel(); for (PresenterEventListner listener : presenterListeners) { // stimulusRatingRadio needs stimulusFreeText objects to validate them StimulusButton nextButton = (buttonGroupName != null) ? getRadioButton(listener, buttonGroupName, savedValue) : getOptionButton(listener); if (styleName != null && !styleName.isEmpty()) { nextButton.addStyleName(styleName); } else if (footerButtons) { nextButton.addStyleName("footerButton"); } buttonsPanel.add(nextButton.getWidget()); buttonsPanel.setCellWidth(nextButton.getWidget(), (100 / presenterListeners.size()) + "%"); stimulusButtonList.add(nextButton); } verticalPanel.setWidth("100%"); labelsPanel.setWidth("100%"); buttonsPanel.setWidth("100%"); verticalPanel.add(labelsPanel); verticalPanel.add(buttonsPanel); if (footerButtons) { addToFooter(verticalPanel); } else { addWidget(verticalPanel); } return stimulusButtonList; }