public CreateGroupWidget(UserGroup parent) { initComponents(); this.parent = parent; int row = 0; createTable.setWidget(row, 0, closeLink); createTable.getFlexCellFormatter().setColSpan(row, 0, 2); row += 1; createTable.setHTML(row, 0, "<b>Name</b>"); createTable.setWidget(row, 1, groupName); row += 1; createTable.setHTML(row, 0, "<b>Description</b>"); createTable.setWidget(row, 1, groupDescription); row += 1; createTable.setWidget(row, 0, table); createTable.getFlexCellFormatter().setColSpan(row, 0, 2); row += 1; createTable.setWidget(row, 0, createButton); createTable.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasAlignment.ALIGN_RIGHT); createTable.setWidget(row, 1, cancelButton); popup.setWidget(createTable); popup.setGlassEnabled(true); popup.setGlassStyleName("dialog_box_glass"); closeLink.addClickHandler(new CloseWidgetHandler()); cancelButton.addClickHandler(new CloseWidgetHandler()); }
public PositionsListeWidget() { this.setWidth("100%"); this.setHeight("100%"); links = UIFactory.getVLayout("70%", "500px"); rechts = UIFactory.getVLayout("30%", "100%"); this.setBackgroundColor("#CCFFCC"); Positionsliste einkaufArtikel = new Positionsliste(); Artikel neuerArtikel; try { neuerArtikel = Bauteil.erzeugeBauteil(20, 3, 2, "zweiterTyp", "schlecht"); einkaufArtikel.erfassePosition(neuerArtikel, 500, 1000); neuerArtikel = Bauteil.erzeugeBauteil(20, 3, 2, "dritter", "schlecht"); einkaufArtikel.erfassePosition(neuerArtikel, 500, 1000); } catch (InstanceCreationException e) { // TODO Auto-generated catch block e.printStackTrace(); } einkaufsTabelle = new PositionsWidget(); // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, "Gesamtverbrauch"); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); txtGesamtkosten = UIFactory.getStyledTextBox("TB1", true); txtLagerbedarf = UIFactory.getStyledTextBox("TB1", true); // Add some standard form options layout.setHTML(1, 0, "Gesamtkosten:"); layout.setWidget(1, 1, txtGesamtkosten); layout.setHTML(2, 0, "Lagerbedarf:"); layout.setWidget(2, 1, txtLagerbedarf); // Wrap the content in a DecoratorPanel // DecoratorPanel gesamt = new DecoratorPanel(); Canvas gesamt = new Canvas(); gesamt.setWidth("100%"); // gesamt.setWidget(layout); gesamt.addChild(layout); auswahl = new AuswahlEinkaufWidget(); // add Members to left and right side links.addMember(UIFactory.getStyledLabel("Einkaufsartikel", 30, 30)); links.addMember(einkaufsTabelle); rechts.addMember(auswahl); rechts.addMember(gesamt); this.addMember(links); this.addMember(rechts); }
private FlexTable getErrorWidget(PerunError error) { String text = "Request timeout exceeded."; String errorInfo = ""; if (error != null) { if (error.getName().equalsIgnoreCase("VoNotExistsException")) { text = "Virtual organization with such name doesn't exists. Please check URL and try again."; } else if (error.getName().equalsIgnoreCase("GroupNotExistsException")) { text = "Group with such name doesn't exists. Please check URL and try again."; } else { text = "Error: " + error.getName(); } errorInfo = error.getErrorInfo(); } FlexTable ft = new FlexTable(); ft.setSize("100%", "300px"); ft.setHTML(0, 0, new Image(LargeIcons.INSTANCE.errorIcon()) + "<h2>" + text + "</h2>"); ft.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_BOTTOM); ft.setHTML(1, 0, "<p>" + errorInfo); ft.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); return ft; }
/** Popup the view source dialog, showing the given content. */ public static void showSource(final String content, String name) { Constants constants = GWT.create(Constants.class); int windowWidth = Window.getClientWidth() / 2; int windowHeight = Window.getClientHeight() / 2; final FormStylePopup pop = new FormStylePopup(images.viewSource(), constants.ViewingSourceFor0(name), windowWidth); String[] rows = content.split("\n"); FlexTable table = new FlexTable(); for (int i = 0; i < rows.length; i++) { table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>"); table.setHTML(i, 1, "<span style='color:green;' >|</span>"); table.setHTML(i, 2, addSyntaxHilights(rows[i])); } ScrollPanel scrollPanel = new ScrollPanel(table); scrollPanel.setHeight(windowHeight + "px"); scrollPanel.setWidth(windowWidth + "px"); pop.addRow(scrollPanel); LoadingPopup.close(); pop.show(); }
private Widget getHeaderWidget() { FlexTable widget = new FlexTable(); widget.setHTML(0, 0, DashboardMessages.MSG.office()); officesLB = new ListBox(); officesLB.setWidth("250px"); widget.setWidget(0, 1, officesLB); widget.setHTML(0, 2, DashboardMessages.MSG.broker()); brokersLB = new ListBox(); brokersLB.setWidth("250px"); widget.setWidget(0, 3, brokersLB); widget.setHTML(0, 4, DashboardMessages.MSG.userStatus()); estateStatusLB = new ListBox(); for (EstateStatusSearchType status : EstateStatusSearchType.values()) { estateStatusLB.addItem(status.getTitle(), "" + status.getId()); } widget.setWidget(0, 5, estateStatusLB); findButton = new Button(); findButton.setText(BaseMessages.MSG.find()); widget.setWidget(0, 6, findButton); return widget; }
protected void layoutCalendar() { calendarGrid.clear(); calendarGrid.setCellSpacing(0); for (int i = 0, row = -2, col = 0; i < simpleDatePickers.size(); i++) { if ((i % monthColumns) == 0) { col = 0; row += 2; } else if (i > 0) { calendarGrid.setHTML(row, col, " "); calendarGrid.setHTML(row + 1, col, " "); calendarGrid.getCellFormatter().addStyleName(row, col, StyleMonthSeparator); calendarGrid.getCellFormatter().addStyleName(row + 1, col, StyleMonthSeparator); col += 1; } if (monthSelectorHeader.getParent() == null || simpleDatePickers.size() > 1) { if (i == 0 || (i % monthColumns) == 0) { calendarGrid.getRowFormatter().addStyleName(row, StyleMonthLabels); calendarGrid.getRowFormatter().addStyleName(row + 1, StyleMonthCell); } Widget w = null; if (i == 0 && monthSelectorHeader.getElement().getParentElement() == null) w = monthSelectorHeader; // calendarGrid.setWidget(row, col, monthSelectorHeader); else w = monthHeaders.get(i); // calendarGrid.setWidget(row, col, monthHeaders.get(i)); DockPanel p = null; if (leftButtons.iterator().hasNext() && leftButtons.getParent() == null && col == 0) { p = leftButtons; p.add(w, DockPanel.WEST); p.setCellWidth(w, "100%"); w = p; if (simpleDatePickers.size() == 1) { Iterator<Widget> it = p.iterator(); while (it.hasNext()) { p.add(it.next(), DockPanel.WEST); } } } if (rightButtons.iterator().hasNext() && rightButtons.getParent() == null && ((i + 1) % monthColumns) == 0) { p = rightButtons; p.add(w, DockPanel.WEST); p.setCellWidth(w, "100%"); w = p; } calendarGrid.setWidget(row, col, w); } calendarGrid.setWidget(row + 1, col, simpleDatePickers.get(i)); calendarGrid.getColumnFormatter().addStyleName(i, "Month-" + i); simpleDatePickers.get(i).addValueChangeHandler(onDaySelected); col++; } }
public void setContent(final String content) { clearContent(); final String[] rows = content.split("\n"); for (int i = 0; i < rows.length; i++) { table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>"); table.setHTML(i, 1, "<span style='color:green;' >|</span>"); table.setHTML(i, 2, addSyntaxHilights(rows[i])); } }
public FlexTable getSearchTable() { FlexTable ft = new FlexTable(); FlexTable dateFt = new FlexTable(); dateFt.setHTML(0, 0, "За период с"); dateFt.setWidget(0, 1, this.db1); dateFt.setHTML(0, 2, "по"); dateFt.setWidget(0, 3, this.db2); this.search1.setButtonsVisible(true, false); this.search2.setButtonsVisible(true, false); FlexTable buttFt = new FlexTable(); Button view = new Button("Поиск"); view.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { CandStatisticsForm.this.setFormData(); } }); Button clear = new Button("Очистить"); clear.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { CandStatisticsForm.this.db1.getTextBox().setText(""); CandStatisticsForm.this.db2.getTextBox().setText(""); CandStatisticsForm.this.search1.clear(); CandStatisticsForm.this.search2.clear(); CandStatisticsForm.this.setFormData(); } }); view.setWidth("100px"); clear.setWidth("100px"); buttFt.setWidget(0, 0, view); buttFt.setWidget(0, 1, clear); this.db1.setFormat( new DateBox.DefaultFormat( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM))); this.db2.setFormat( new DateBox.DefaultFormat( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM))); this.db1.setValue(new Date()); this.db2.setValue(new Date()); ft.setWidget(0, 0, dateFt); ft.setWidget(1, 0, this.search1.onInitialize(null)); ft.setWidget(2, 0, this.search2.onInitialize(null)); ft.setWidget(3, 0, buttFt); FlexTable.FlexCellFormatter format = ft.getFlexCellFormatter(); format.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER); return ft; }
@Override public void onLog(final String log) { final int row = getRowCount(); table.setHTML(row, 0, log); updateCellStyle(row, LogParser.getLevel(log), LogParser.isTraceLine(log)); if (!isPaused && !isTemplePaused) scroller.scrollToBottom(); }
@Override public void fillTable() { DateTimeFormat format; format = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG); int next = 1; for (final RentInfo info : list) { Button btn = new Button("Registrar Devolución"); btn.addClickHandler(new MyHandler(info, next)); table.setHTML(next, 0, info.getId()); table.setHTML(next, 1, format.format(info.getInitDate())); table.setHTML(next, 2, format.format(info.getDueDate())); table.setWidget(next, 3, btn); next++; } }
/** * Geths a list of a least 20 elements and inserts them on the table * * @param tableData a List of ImportResultData objects, the size must be 20 or less */ private void refreshTableData(List<ImportInfo> tableData) { ImportInfo pivote; for (int actualRow = 1; actualRow <= tableData.size(); actualRow++) { pivote = tableData.get(actualRow - 1); // sortableTable.setValue(actualRow, FILE_NAME_COLUMN, pivote.getFileName()); table.setHTML(actualRow, FILE_NAME_COLUMN, pivote.getFileName()); // sortableTable.setValue(actualRow, STATUS_COLUMN, pivote.getStatus()); table.setHTML(actualRow, STATUS_COLUMN, pivote.getStatus()); // sortableTable.setValue(actualRow, DATE_COLUMN, pivote.getDate()); table.setHTML(actualRow, DATE_COLUMN, pivote.getDate()); // ComparableHTML bla = new ComparableHTML("<a href= '" // + pivote.getDownloadLink() + "'>click aca</a>"); // sortableTable.setValue(actualRow, DOWNLOAD, bla); table.setHTML( actualRow, DOWNLOAD_COLUMN, "<a href= '" + pivote.getDownloadLink() + "'>click aca</a>"); } }
private FlexTable getCustomErrorWidget(PerunError error, String customText) { FlexTable ft = new FlexTable(); ft.setSize("100%", "300px"); ft.setHTML(0, 0, new Image(LargeIcons.INSTANCE.errorIcon()) + "<h2>Error: </h2>" + customText); ft.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); return ft; }
/** * Fill the table to ensure a minimal size. * * @param aStartingRow */ protected void fillWithEmptyRows(final FlexTable aTable, int aStartingRow, int aNbColumn) { // Fill any remaining slots with empty cells. for (; aStartingRow < constants.defaultMinDisplayedItems(); ++aStartingRow) { for (int i = 0; i < aNbColumn; i++) { aTable.setHTML(aStartingRow, i, NBSP); } // Set CSS style. aTable.getRowFormatter().setStyleName(aStartingRow, "item_list_empty_row"); } }
public void setContent(JsonObject jsonSource) { clearContent(); String jsonSourceString = formatJsonObjectAsString(jsonSource, ""); final String[] rows = jsonSourceString.split("\n"); for (int i = 0; i < rows.length; i++) { String escaped = replaceLeadingWhitespaces(rows[i]); table.setHTML(i, 0, escaped); } }
/** * Create a Decorated Form The code comes from the GWT show case : * http://gwt.google.com/samples/Showcase/Showcase.html#!CwDecoratorPanel * * @return */ private DecoratorPanel createDecoratedForm() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, "Enter Search Criteria"); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, "Name"); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, "Description"); layout.setWidget(2, 1, new TextBox()); // Wrap the content in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
public void onSuccess(GWTResultSet result) { GWTResultSet resultSet = result; removeAllRows(); for (Iterator<GWTQueryResult> it = resultSet.getResults().iterator(); it.hasNext(); ) { GWTQueryResult gwtQueryResult = it.next(); if (gwtQueryResult.getFolder() != null) { GWTFolder folder = gwtQueryResult.getFolder(); int rows = folderTable.getRowCount(); // Looks if must change icon on parent if now has no childs and properties with user // security atention if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) { if (folder.isHasChildren()) { folderTable.setHTML(rows, 0, Util.imageItemHTML("img/menuitem_childs.gif")); } else { folderTable.setHTML(rows, 0, Util.imageItemHTML("img/menuitem_empty.gif")); } } else { if (folder.isHasChildren()) { folderTable.setHTML(rows, 0, Util.imageItemHTML("img/menuitem_childs_ro.gif")); } else { folderTable.setHTML(rows, 0, Util.imageItemHTML("img/menuitem_empty_ro.gif")); } } folderTable.setHTML(rows, 1, folder.getPath()); folderTable.getCellFormatter().setWidth(rows, 0, "30"); folderTable .getCellFormatter() .setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER); } } status.unsetFlagChilds(); }
private void displayAction(TaskValue taskValue, int row) { String description = "<div class='actionTitle'>" + escapeHtml(taskValue.getTitle()) + "<span class='actionDetails'> - " + escapeHtml(taskValue.getDetails()) + "</span></div>"; table.setHTML(row, 0, description); table.setText(row, 1, mFormatter.getShortDueDate(taskValue)); table .getCellFormatter() .setStyleName( row, 1, isInPast(taskValue.getDueDate()) ? "actionDueInPass" : "actionDueInFuture"); }
/** Initialize this example. */ @ShowcaseSource @Override public Widget onInitialize() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, constants.cwDecoratorPanelFormTitle()); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, constants.cwDecoratorPanelFormName()); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, constants.cwDecoratorPanelFormDescription()); layout.setWidget(2, 1, new TextBox()); // Wrap the content in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
@Test public void html() { // Given FlexTable t = new FlexTable(); // When t.setHTML(1, 1, "<h1>test</h1>"); // Then assertThat(t.getHTML(1, 1)).isEqualTo("<h1>test</h1>"); Element e = t.getCellFormatter().getElement(1, 1); assertThat(e.getChildCount()).isEqualTo(1); HeadingElement h1 = e.getChild(0).cast(); assertThat(h1.getTagName()).isEqualTo("H1"); assertThat(h1.getInnerText()).isEqualTo("test"); }
public Widget asWidget() { if (widget == null) { northData.setMargins(new Margins(5)); westData.setMargins(new Margins(0, 5, 0, 5)); westData.setCollapsible(true); westData.setSplit(true); eastData.setMargins(new Margins(0, 5, 0, 5)); southData.setMargins(new Margins(5)); widget = uiBinder.createAndBindUi(this); for (int i = 0; i < LayoutRegion.values().length; i++) { final LayoutRegion r = LayoutRegion.values()[i]; if (r == LayoutRegion.CENTER) { continue; } SelectHandler handler = new SelectHandler() { @Override public void onSelect(SelectEvent event) { TextButton btn = (TextButton) event.getSource(); String txt = btn.getText(); if (txt.equals("Expand")) { con.expand(r); } else if (txt.equals("Collapse")) { con.collapse(r); } else if (txt.equals("Show")) { con.show(r); } else { con.hide(r); } } }; table.setHTML(i, 0, "<div style='font-size: 12px; width: 100px'>" + r.name() + ":</span>"); table.setWidget(i, 1, new TextButton("Expand", handler)); table.setWidget(i, 2, new TextButton("Collapse", handler)); table.setWidget(i, 3, new TextButton("Show", handler)); table.setWidget(i, 4, new TextButton("Hide", handler)); } } return widget; }
/** @gwt.typeArgs customers <com.mycompany.proto.console.hello.client.CustomerAdaptor> */ private void rebuildCustomersTable(List customers) { tableWrapper.clear(); FlexTable table = new FlexTable(); int rows = -1; table.setHTML(++rows, 0, "ID"); table.setHTML(rows, 1, "First Name"); table.setHTML(rows, 2, "Last Name"); table.setHTML(rows, 3, "Delete?"); for (Iterator iter = customers.iterator(); iter.hasNext(); ) { CustomerAdaptor customer = (CustomerAdaptor) iter.next(); table.setHTML(++rows, 0, customer.getId().toString()); table.setHTML(rows, 1, customer.getFirstName()); table.setHTML(rows, 2, customer.getLastName()); table.setWidget(rows, 3, new CustomerDeleteButton(customer)); } tableWrapper.add(table, DockPanel.CENTER); }
public LikeListe(ArrayList<Like> likeListe) { /** Label f�r eine kurze Information �ber das DialogFenster */ LabelInformation = new Label("Nutzer, denen das gefaellt:"); LabelInformation.setStyleName("LabelInformation"); /** FlexTable f�r darstellung der Nutzer */ FlexTableLikeListe = new FlexTable(); FlexTableLikeListe.setStyleName("FlexTableLikeListe"); // Durchlauf durch die LikeListe welche als Paramenter im Konstruktor �bergeben wurde. Jeder // Nutzer wird in einer row hinzugef�gt. for (int i = 0; i < likeListe.size(); i++) { FlexTableLikeListe.setHTML( i, 0, likeListe.get(i).getNutzer().getVorname() + " " + likeListe.get(i).getNutzer().getName()); } /** Button mit Hilfe man die DialogBox wieder schlie�en kann */ ButtonSchliessen = new Button("Schließen"); ButtonSchliessen.setStyleName("ButtonSchliessen"); ButtonSchliessen.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); /** DockPanel welches die zuvor initialisierten Elemente B�ndelt */ DockPanel dock = new DockPanel(); dock.setSpacing(4); dock.add(LabelInformation, DockPanel.NORTH); dock.add(FlexTableLikeListe, DockPanel.NORTH); dock.add(ButtonSchliessen, DockPanel.NORTH); dock.setWidth("100%"); setWidget(dock); }
@UiFactory public FlexTable createFlexTable() { FlexTable table = new FlexTable(); table.getElement().getStyle().setProperty("margin", "10px"); table.setCellSpacing(8); table.setCellPadding(4); for (int i = 0; i < LayoutRegion.values().length; i++) { final LayoutRegion r = LayoutRegion.values()[i]; if (r == LayoutRegion.CENTER) { continue; } SelectHandler handler = new SelectHandler() { @Override public void onSelect(SelectEvent event) { TextButton btn = (TextButton) event.getSource(); String txt = btn.getText(); if (txt.equals("Expand")) { con.expand(r); } else if (txt.equals("Collapse")) { con.collapse(r); } else if (txt.equals("Show")) { con.show(r); } else { con.hide(r); } } }; table.setHTML(i, 0, "<div style='font-size: 12px; width: 100px'>" + r.name() + ":</span>"); table.setWidget(i, 1, new TextButton("Expand", handler)); table.setWidget(i, 2, new TextButton("Collapse", handler)); table.setWidget(i, 3, new TextButton("Show", handler)); table.setWidget(i, 4, new TextButton("Hide", handler)); } return table; }
/** {@inheritDoc} */ protected void setRow(FlexTable table, int row, int elementIndex) { Alarm alarm = m_alarms[elementIndex]; if (alarm.getIsDashboardRole()) { table.setText(row, 0, alarm.getNodeLabel()); } else { table.setHTML( row, 0, "<a href=\"element/node.jsp?node=" + alarm.getNodeId() + "\">" + alarm.getNodeLabel() + "</a>"); } HTML label = new HTML(); label.setTitle(stripHtmlTags(alarm.getDescrption())); label.setHTML(SafeHtmlUtils.fromTrustedString(alarm.getLogMsg())); table.setWidget(row, 1, label); table.setText(row, 2, "" + alarm.getCount()); table.setText(row, 3, alarm.getFirstEventTime().toString()); table.setText(row, 4, alarm.getLastEventTime().toString()); table.getRowFormatter().setStyleName(row, alarm.getSeverity()); }
/** * Prepares the GUI * * @param entity PerunEntity GROUP or VO * @param applicationType INITIAL | EXTENSION */ protected void prepareGui(PerunEntity entity, String applicationType) { // trigger email verification as first if present in URL if (Location.getParameterMap().keySet().contains("m") && Location.getParameterMap().keySet().contains("i")) { String verifyI = Location.getParameter("i"); String verifyM = Location.getParameter("m"); if (verifyI != null && !verifyI.isEmpty() && verifyM != null && !verifyM.isEmpty()) { final SimplePanel verifContent = new SimplePanel(); leftMenu.addItem( ApplicationMessages.INSTANCE.emailValidationMenuItem(), SmallIcons.INSTANCE.documentSignatureIcon(), verifContent); ValidateEmail request = new ValidateEmail( verifyI, verifyM, new JsonCallbackEvents() { @Override public void onLoadingStart() { verifContent.clear(); verifContent.add(new AjaxLoaderImage()); } @Override public void onFinished(JavaScriptObject jso) { BasicOverlayType obj = jso.cast(); if (obj.getBoolean() == true) { verifContent.clear(); FlexTable ft = new FlexTable(); ft.setSize("100%", "300px"); ft.setHTML( 0, 0, new Image(LargeIcons.INSTANCE.acceptIcon()) + "<h2>" + ApplicationMessages.INSTANCE.emailValidationSuccess() + "</h2>"); ft.getFlexCellFormatter() .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter() .setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); verifContent.add(ft); } else { verifContent.clear(); FlexTable ft = new FlexTable(); ft.setSize("100%", "300px"); ft.setHTML( 0, 0, new Image(LargeIcons.INSTANCE.deleteIcon()) + "<h2>" + ApplicationMessages.INSTANCE.emailValidationFail() + "</h2>"); ft.getFlexCellFormatter() .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter() .setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); verifContent.add(ft); } } @Override public void onError(PerunError error) { ((AjaxLoaderImage) verifContent.getWidget()).loadingError(error); } }); request.retrieveData(); leftMenu.addLogoutItem(); return; } } // group and extension is not allowed if (group != null && applicationType.equalsIgnoreCase("EXTENSION")) { RootLayoutPanel panel = RootLayoutPanel.get(); panel.clear(); FlexTable ft = new FlexTable(); ft.setSize("100%", "300px"); ft.setHTML( 0, 0, new Image(LargeIcons.INSTANCE.errorIcon()) + "<h2>Error: " + ApplicationMessages.INSTANCE.groupMembershipCantBeExtended( group.getName(), vo.getName()) + "</h2>"); ft.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); panel.add(ft); return; } // application form page ApplicationFormPage formPage = new ApplicationFormPage(vo, group, applicationType); // even user "not yet in perun" can have some applications sent (therefore display by session // info) UsersApplicationsPage appsPage = new UsersApplicationsPage(); // if rt test if ("true".equals(Location.getParameter("rttest"))) { TestRtReportingTabItem tabItem = new TestRtReportingTabItem(); Widget rtTab = tabItem.draw(); leftMenu.addItem("RT test", SmallIcons.INSTANCE.settingToolsIcon(), rtTab); } // proper menu text String appMenuText = ApplicationMessages.INSTANCE.applicationFormForVo(vo.getName()); if (group != null) { appMenuText = ApplicationMessages.INSTANCE.applicationFormForGroup(group.getName()); } if (applicationType.equalsIgnoreCase("EXTENSION")) { appMenuText = ApplicationMessages.INSTANCE.membershipExtensionForVo(vo.getName()); if (group != null) { appMenuText = ApplicationMessages.INSTANCE.membershipExtensionForGroup(group.getName()); } } // load list of applications first if param in session if ("apps".equals(Location.getParameter("page"))) { Anchor a = leftMenu.addItem( ApplicationMessages.INSTANCE.applications(), SmallIcons.INSTANCE.applicationFromStorageIcon(), appsPage); leftMenu.addItem(appMenuText, SmallIcons.INSTANCE.applicationFormIcon(), formPage); a.fireEvent(new ClickEvent() {}); // appsPage.menuClick(); // load list of apps } else { Anchor a = leftMenu.addItem(appMenuText, SmallIcons.INSTANCE.applicationFormIcon(), formPage); leftMenu.addItem( ApplicationMessages.INSTANCE.applications(), SmallIcons.INSTANCE.applicationFromStorageIcon(), appsPage); a.fireEvent(new ClickEvent() {}); // formPage.menuClick(); // load application form } leftMenu.addLogoutItem(); }
public iCalCalendarPanel() { // style this element as absolute position DOM.setStyleAttribute(this.getElement(), "position", "absolute"); DOM.setStyleAttribute(this.getElement(), "top", "0px"); DOM.setStyleAttribute(this.getElement(), "left", "0px"); DOM.setStyleAttribute(this.getElement(), "padding", "0px"); DOM.setStyleAttribute(DOM.getElementById("messageBox"), "display", "none"); mainLayoutPanel.setWidth("100%"); add(mainLayoutPanel); // add header headerPanel.setStyleName("gwt-cal-HeaderPanel"); DOM.setInnerHTML(headerPanel.getElement(), " "); footerPanel.setStyleName("gwt-cal-FooterPanel"); DOM.setInnerHTML(headerPanel.getElement(), " "); mainLayoutPanel.add(headerPanel, DockPanel.NORTH); mainLayoutPanel.add(footerPanel, DockPanel.SOUTH); // add left panel datePicker.setValue(new Date()); dateLayoutPanel.add(datePicker, DockPanel.SOUTH); dateLayoutPanel.add(splitterPanel, DockPanel.SOUTH); splitterPanel.setStyleName("splitter"); mainLayoutPanel.add(dateLayoutPanel, DockPanel.WEST); // CalendarFormat.INSTANCE.setFirstDayOfWeek(1); // change hour offset to false to facilitate iCal style settings.setOffsetHourLabels(true); settings.setTimeBlockClickNumber(Click.Double); // create day view calendar = new Calendar(); calendar.setSettings(settings); // set style as google-cal calendar.setWidth("100%"); // set today as default date mainLayoutPanel.add(calendar, DockPanel.CENTER); mainLayoutPanel.setCellVerticalAlignment(dateLayoutPanel, HasAlignment.ALIGN_BOTTOM); dateLayoutPanel.setCellVerticalAlignment(datePicker, HasAlignment.ALIGN_BOTTOM); dateLayoutPanel.setWidth("168px"); // add today button todayButton.setStyleName("todayButton"); todayButton.setText("Today"); todayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { datePicker.setValue(new Date(), true); // dayView.setDate(new Date()); } }); previousDayButton.setStyleName("previousButton"); previousDayButton.setHTML("«"); previousDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Date d = datePicker.getValue(); d.setDate(d.getDate() - 1); datePicker.setValue(d, true); } }); nextDayButton.setStyleName("nextButton"); nextDayButton.setHTML("»"); nextDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Date d = datePicker.getValue(); d.setDate(d.getDate() + 1); datePicker.setValue(d, true); } }); headerPanelLayout.setWidget(0, 0, todayButton); headerPanelLayout.setWidget(0, 1, previousDayButton); oneDayButton.setText("1 Day"); oneDayButton.setStyleName("dayButton"); threeDayButton.setText("3 Day"); threeDayButton.setStyleName("dayButton"); threeDayButton.addStyleName("active"); activeDayButton = threeDayButton; weekDayButton.setText("Work Week"); weekDayButton.setStyleName("dayButton"); monthButton.setText("Month"); monthButton.setStyleName("dayButton"); headerPanelLayout.setWidget(0, 2, oneDayButton); headerPanelLayout.setWidget(0, 3, threeDayButton); headerPanelLayout.setWidget(0, 4, weekDayButton); headerPanelLayout.setWidget(0, 5, monthButton); headerPanelLayout.setWidget(0, 6, nextDayButton); headerPanelLayout.setHTML(0, 7, " "); headerPanelLayout.getCellFormatter().setWidth(0, 0, "50%"); headerPanelLayout.getCellFormatter().setWidth(0, 7, "50%"); headerPanelLayout.setWidth("100%"); headerPanelLayout.setCellPadding(0); headerPanelLayout.setCellSpacing(0); headerPanel.add(headerPanelLayout); footerPanel.add( new HTML( "<a href='http://code.google.com/p/gwt-cal'>gwt-cal</a> widget for Google Web Toolkit, GPLv3, by <a href='http://www.google.com/profiles/Brad.Rydzewski'>Brad Rydzewski</a>")); oneDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = oneDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 1); // calendar.scrollToHour(6); } }); threeDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = threeDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 3); // calendar.scrollToHour(6); } }); weekDayButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = weekDayButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.DAY, 5); // calendar.scrollToHour(6); } }); monthButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { activeDayButton.removeStyleName("active"); activeDayButton = monthButton; activeDayButton.addStyleName("active"); calendar.setView(CalendarViews.MONTH); } }); datePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { calendar.setDate(event.getValue()); } }); calendar.addDeleteHandler( new DeleteHandler<Appointment>() { public void onDelete(DeleteEvent<Appointment> event) { boolean commit = Window.confirm( "Are you sure you want to delete appointment \"" + event.getTarget().getTitle() + "\""); if (commit == false) { event.setCancelled(true); System.out.println("cancelled appointment deletion"); } } }); calendar.addOpenHandler( new OpenHandler<Appointment>() { public void onOpen(OpenEvent<Appointment> event) { Window.alert("You double-clicked appointment \"" + event.getTarget().getTitle() + "\""); } }); calendar.addSelectionHandler( new SelectionHandler<Appointment>() { public void onSelection(SelectionEvent<Appointment> event) { System.out.println("selected " + event.getSelectedItem().getTitle()); } }); calendar.addTimeBlockClickHandler( new TimeBlockClickHandler<Date>() { public void onTimeBlockClick(TimeBlockClickEvent<Date> event) { Window.alert("you clicked time block " + event.getTarget()); } }); /* Generate random appointments */ AppointmentBuilder.appointmentsPerDay = 5; AppointmentBuilder.HOURS = new Integer[] {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; AppointmentBuilder.MINUTES = new Integer[] {0, 30}; AppointmentBuilder.DURATIONS = new Integer[] {60, 90, 120, 180, 240, 600}; AppointmentBuilder.DESCRIPTIONS[1] = "Best show on TV!"; ArrayList<Appointment> appointments = AppointmentBuilder.build(AppointmentBuilder.ICAL_STYLES); /* Add appointments to day view */ calendar.suspendLayout(); calendar.addAppointments(appointments); calendar.resumeLayout(); // window events to handle resizing Window.enableScrolling(false); Window.addResizeHandler( new ResizeHandler() { public void onResize(ResizeEvent event) { int h = event.getHeight(); calendar.setHeight( h - headerPanel.getOffsetHeight() - footerPanel.getOffsetHeight() + "px"); } }); Scheduler.get() .scheduleDeferred( new ScheduledCommand() { public void execute() { calendar.setHeight( Window.getClientHeight() - headerPanel.getOffsetHeight() - footerPanel.getOffsetHeight() + "px"); calendar.scrollToHour(6); } }); }
public Widget draw() { titleWidget.setText( Utils.getStrippedStringWithEllipsis(facility.getName()) + " (" + facility.getType() + "): create resource"); VerticalPanel vp = new VerticalPanel(); vp.setSize("100%", "100%"); // form inputs final ExtendedTextBox nameTextBox = new ExtendedTextBox(); final TextBox descriptionTextBox = new TextBox(); final ListBoxWithObjects<VirtualOrganization> vosDropDown = new ListBoxWithObjects<VirtualOrganization>(); // send button final CustomButton createButton = TabMenu.getPredefinedButton(ButtonType.CREATE, ButtonTranslation.INSTANCE.createResource()); // local events fills the listbox of Vos and Slds JsonCallbackEvents event = new JsonCallbackEvents() { @Override public void onFinished(JavaScriptObject jso) { // fill VOs listbox vosDropDown.clear(); ArrayList<VirtualOrganization> vos = JsonUtils.jsoAsList(jso); vos = new TableSorter<VirtualOrganization>().sortByName(vos); for (VirtualOrganization vo : vos) { vosDropDown.addItem(vo); } if (!vos.isEmpty()) createButton.setEnabled(true); } @Override public void onLoadingStart() { vosDropDown.clear(); vosDropDown.addItem("Loading..."); createButton.setEnabled(false); } @Override public void onError(PerunError error) { vosDropDown.clear(); vosDropDown.addItem("Error while loading"); createButton.setEnabled(false); } }; // load available VOs final GetVos vos = new GetVos(event); vos.setForceAll(true); vos.retrieveData(); // layout FlexTable layout = new FlexTable(); layout.setStyleName("inputFormFlexTable"); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add some standard form options layout.setHTML(0, 0, "Name:"); layout.setWidget(0, 1, nameTextBox); layout.setHTML(1, 0, "Description:"); layout.setWidget(1, 1, descriptionTextBox); layout.setHTML(2, 0, "VO:"); layout.setWidget(2, 1, vosDropDown); layout.setHTML(3, 0, "Facility:"); layout.setHTML(3, 1, facility.getName() + " (" + facility.getType() + ")"); for (int i = 0; i < layout.getRowCount(); i++) { cellFormatter.addStyleName(i, 0, "itemName"); } layout.setWidth("350px"); TabMenu menu = new TabMenu(); final ExtendedTextBox.TextBoxValidator validator = new ExtendedTextBox.TextBoxValidator() { @Override public boolean validateTextBox() { if (nameTextBox.getTextBox().getText().trim().isEmpty()) { nameTextBox.setError("Name can't be empty."); return false; } nameTextBox.setOk(); return true; } }; nameTextBox.setValidator(validator); createButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // loads new tab when creating successful, also disable button JsonCallbackEvents localEvents = new JsonCallbackEvents() { public void onLoadingStart() { (JsonCallbackEvents.disableButtonEvents(createButton)).onLoadingStart(); } public void onFinished(JavaScriptObject jso) { (JsonCallbackEvents.disableButtonEvents(createButton)).onFinished(jso); Resource res = (Resource) jso; session .getTabManager() .addTabToCurrentTab( new CreateFacilityResourceManageServicesTabItem(facility, res), true); } public void onError(PerunError error) { (JsonCallbackEvents.disableButtonEvents(createButton)).onError(error); } }; if (validator.validateTextBox()) { // request CreateResource request = new CreateResource(localEvents); request.createResource( nameTextBox.getTextBox().getText().trim(), descriptionTextBox.getText().trim(), facility.getId(), vosDropDown.getSelectedObject().getId()); } } }); menu.addWidget(createButton); final TabItem tab = this; menu.addWidget( TabMenu.getPredefinedButton( ButtonType.CANCEL, "", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { session.getTabManager().closeTab(tab, false); } })); vp.add(layout); vp.add(menu); vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT); this.contentWidget.setWidget(vp); return getWidget(); }
/** SearchControl */ public SearchControl() { table = new FlexTable(); table.setCellPadding(2); table.setCellSpacing(2); scrollPanel = new ScrollPanel(table); advancedView = new CheckBox(Main.i18n("search.view.advanced")); advancedView.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (advancedView.getValue()) { clean(); switchSearchMode(SEARCH_MODE_ADVANCED); } else { clean(); switchSearchMode(SEARCH_MODE_SIMPLE); } } }); compactResultsView = new CheckBox(Main.i18n("search.view.compact.results")); compactResultsView.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (compactResultsView.getValue()) { switchResultsViewMode(RESULTS_VIEW_COMPACT); table.getCellFormatter().setVisible(2, 0, false); // hide view property groups } else { switchResultsViewMode(RESULTS_VIEW_NORMAL); table.getCellFormatter().setVisible(2, 0, true); // show view property groups } } }); showPropertyGroups = new CheckBox(Main.i18n("search.view.propety.groups")); showPropertyGroups.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (searchButton.isEnabled()) { executeSearch(); } } }); saveUserNews = new CheckBox(Main.i18n("search.save.as.news")); searchSavedName = new TextBox(); searchSavedName.setWidth("200"); controlSearch = new ControlSearchIn(); resultPage = new ListBox(); resultPage.addItem("10", "10"); resultPage.addItem("20", "20"); resultPage.addItem("30", "30"); resultPage.addItem("50", "50"); resultPage.addItem("100", "100"); keyUpHandler = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evaluateSearchButtonVisible(); if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && searchButton.isEnabled()) { executeSearch(); } } }; searchButton = new Button( Main.i18n("button.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { executeSearch(); } }); cleanButton = new Button( Main.i18n("button.clean"), new ClickHandler() { @Override public void onClick(ClickEvent event) { clean(); } }); saveSearchButton = new Button( Main.i18n("button.save.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { long domain = 0; SearchNormal searchNormal = Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal; SearchAdvanced searchAdvanced = Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced; String operator = GWTQueryParams.OPERATOR_AND; params = new GWTQueryParams(); if (!searchAdvanced.path.getText().equals("")) { params.setPath(searchAdvanced.path.getText()); } else { params.setPath( searchNormal.context.getValue(searchNormal.context.getSelectedIndex())); } if (!searchAdvanced.categoryUuid.equals("")) { params.setCategoryUuid(searchAdvanced.categoryUuid); params.setCategoryPath( searchAdvanced.categoryPath.getText().substring(16)); // removes /okm:category } params.setContent(searchNormal.content.getText()); params.setName(searchNormal.name.getText()); params.setKeywords(searchNormal.keywords.getText()); params.setProperties( Main.get().mainPanel.search.searchBrowser.searchIn.getProperties()); params.setAuthor( searchNormal.userListBox.getValue(searchNormal.userListBox.getSelectedIndex())); params.setLastModifiedFrom(searchNormal.modifyDateFrom); params.setLastModifiedTo(searchNormal.modifyDateTo); params.setDashboard(saveUserNews.getValue()); params.setMailFrom(searchAdvanced.from.getText()); params.setMailTo(searchAdvanced.to.getText()); params.setMailSubject(searchAdvanced.subject.getText()); if (searchAdvanced.typeDocument.getValue()) { domain += GWTQueryParams.DOCUMENT; } if (searchAdvanced.typeFolder.getValue()) { domain += GWTQueryParams.FOLDER; } if (searchAdvanced.typeMail.getValue()) { domain += GWTQueryParams.MAIL; } params.setDomain(domain); if (searchTypeAnd.getValue()) { operator = GWTQueryParams.OPERATOR_AND; } else { operator = GWTQueryParams.OPERATOR_OR; } params.setOperator(operator); // Removes dates if dashboard is checked if (saveUserNews.getValue()) { params.setLastModifiedFrom(null); params.setLastModifiedTo(null); } params.setMimeType( searchAdvanced.mimeTypes.getValue(searchAdvanced.mimeTypes.getSelectedIndex())); if (!searchSavedName.getText().equals("")) { saveSearchButton.setEnabled(false); params.setQueryName(searchSavedName.getText()); isUserNews = params.isDashboard(); saveSearch(params, "sql"); } } }); searchSavedName.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evalueSaveSearchButtonVisible(); } }); searchButton.setEnabled(false); saveSearchButton.setEnabled(false); // Type of search searchTypePanel = new HorizontalPanel(); searchTypePanel.setVisible(true); // On OpenKM 4.0 has hidden AND / OR option list searchTypeAnd = new CheckBox("AND"); searchTypeOr = new CheckBox("OR"); searchTypeAnd.setValue(true); searchTypeOr.setValue(false); searchTypeAnd.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeOr.setValue( !searchTypeAnd.getValue()); // Always set changed between and and or type } }); searchTypeOr.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeAnd.setValue( !searchTypeOr.getValue()); // Always set changed between and and or type } }); HTML space1 = new HTML(""); searchTypePanel.add(searchTypeAnd); searchTypePanel.add(space1); searchTypePanel.add(searchTypeOr); searchTypePanel.setCellWidth(space1, "10"); table.setWidget(0, 0, advancedView); table.setWidget(1, 0, compactResultsView); table.setWidget(2, 0, showPropertyGroups); table.setWidget(3, 0, saveUserNews); table.setWidget(4, 0, saveSearchButton); table.setWidget(4, 1, searchSavedName); resultsPageText = new HTML(Main.i18n("search.page.results")); table.setWidget(5, 0, resultsPageText); table.setWidget(5, 1, resultPage); searchTypeText = new HTML(Main.i18n("search.type")); table.setHTML(6, 0, Main.i18n("search.type")); table.setWidget(6, 1, searchTypePanel); table.setWidget(6, 0, cleanButton); table.setWidget(6, 1, searchButton); table.setWidget(7, 0, controlSearch); table.getCellFormatter().setHorizontalAlignment(4, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(5, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(6, 0, HasAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setColSpan(0, 0, 2); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.getFlexCellFormatter().setColSpan(2, 0, 2); table.getFlexCellFormatter().setColSpan(3, 0, 2); table.getFlexCellFormatter().setColSpan(7, 0, 2); // By default is enabled search mode simple table.getCellFormatter().setVisible(3, 0, false); table.getCellFormatter().setVisible(4, 0, false); table.getCellFormatter().setVisible(4, 1, false); searchButton.setStyleName("okm-YesButton"); saveSearchButton.setStyleName("okm-AddButton"); saveSearchButton.addStyleName("okm-NoWrap"); cleanButton.setStyleName("okm-NoButton"); searchSavedName.setStyleName("okm-Input"); resultPage.setStyleName("okm-Input"); initWidget(scrollPanel); }
/** Creates the gui. */ private void createGUI() { if (editlogin == null) { setText(M.users.menuAddUser()); } else { setText(M.users.titleEditUser()); } setAnimationEnabled(true); setGlassEnabled(true); String addText = M.users.btnAdd(); if (editlogin != null) { addText = M.users.btnUpdate(); } Button btnAdd = new Button(addText); btnAdd.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (editlogin == null) { createUser(); } else { updateUser(); } } }); Button btnCancel = new Button(M.users.btnCancel()); btnCancel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { EditUserDialog.this.hide(); } }); VerticalPanel vpanel = new VerticalPanel(); // vpanel.setWidth("400px"); FlexTable layout = new FlexTable(); layout.setCellSpacing(6); layout.setHTML(0, 0, M.users.fullName()); name = new TextBox(); name.setText(user.getUsername()); layout.setWidget(0, 1, name); layout.setHTML(1, 0, M.users.login()); login = new TextBox(); login.setText(user.getLogin()); if (editlogin != null) { login.setReadOnly(true); } layout.setWidget(1, 1, login); layout.setHTML(2, 0, M.users.password()); password = new TextBox(); password.setText(""); layout.setWidget(2, 1, password); layout.setHTML(3, 0, M.users.isactive()); isactive = new CheckBox(); isactive.setValue(user.isActive()); layout.setWidget(3, 1, isactive); layout.setHTML(4, 0, M.users.access()); UserRole role = user.getUserrole(); FlexTable access = new FlexTable(); access.setCellSpacing(6); access.setHTML(0, 0, M.users.isadmin()); isadmin = new CheckBox(); isadmin.setValue(role.isAdmin()); access.setWidget(0, 1, isadmin); access.setHTML(1, 0, M.users.isdocuments()); isdocuments = new CheckBox(); isdocuments.setValue(role.isDocuments()); access.setWidget(1, 1, isdocuments); access.setHTML(2, 0, M.users.isfinances()); isfinances = new CheckBox(); isfinances.setValue(role.isFinances()); access.setWidget(2, 1, isfinances); access.setHTML(3, 0, M.users.ismanager()); ismanager = new CheckBox(); ismanager.setValue(role.isManager()); access.setWidget(3, 1, ismanager); layout.setWidget(4, 1, access); vpanel.add(layout); HorizontalPanel buttons = new HorizontalPanel(); buttons.setWidth("100%"); buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel bcontainer = new HorizontalPanel(); bcontainer.add(btnAdd); bcontainer.add(btnCancel); bcontainer.setSpacing(5); buttons.add(bcontainer); vpanel.add(buttons); setWidget(vpanel); /* * setPopupPosition( (Ballance_autosauler_net.mainpanel.getOffsetWidth() * / 2 - 200), 100); */ show(); }
/** * Inits the widget SortableTable, by Parvinder Thapa * * @link<http://psthapar.googlepages.com/simplesortabletable> */ private void initSortableTable() { // sortableTable = new SortableTable(); table = new FlexTable(); table.setWidth(500 + "px"); table.setStyleName("sortableTable"); table.setBorderWidth(1); table.setCellPadding(4); table.setCellSpacing(1); // sortableTable.setWidth(500 + "px"); // sortableTable.setStyleName("sortableTable"); // sortableTable.setBorderWidth(1); // sortableTable.setCellPadding(4); // sortableTable.setCellSpacing(1); // header table.setHTML(0, FILE_NAME_COLUMN, FILE_NAME_TEXT); table.setHTML(0, STATUS_COLUMN, STATUS_TEXT); table.setHTML(0, DATE_COLUMN, DATE_TEXT); table.setHTML(0, DOWNLOAD_COLUMN, DOWNLOAD_TEXT); // sortableTable.addColumnHeader(FILE_NAME_TEXT, FILE_NAME_COLUMN); // sortableTable.addColumnHeader(STATUS_TEXT, STATUS_COLUMN); // sortableTable.addColumnHeader(DATE_TEXT, DATE_COLUMN); // sortableTable.addColumnHeader(DOWNLOAD_TEXT, DOWNLOAD_COLUMN); // COSMETIC PART OF THE WIDGET // Set Style Name for the header // RowFormatter rowFormatter = sortableTable.getRowFormatter(); RowFormatter rowFormatter = table.getRowFormatter(); rowFormatter.setStyleName(0, "tableHeader"); // Set the Styles for the Data Rows and Columns // CellFormatter cellFormatter = sortableTable.getCellFormatter(); CellFormatter cellFormatter = table.getCellFormatter(); // Set the styles for the headers for (int colIndex = 0; colIndex < 4; colIndex++) { cellFormatter.setStyleName(0, colIndex, "headerStyle"); cellFormatter.setAlignment( 0, colIndex, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); } for (int rowIndex = 1; rowIndex < 21; rowIndex++) { if (rowIndex % 2 == 0) { rowFormatter.setStyleName(rowIndex, "customRowStyle"); } else { rowFormatter.setStyleName(rowIndex, "tableRow"); } for (int colIndex = 0; colIndex < 4; colIndex++) { cellFormatter.setStyleName(rowIndex, colIndex, "customFont"); if (colIndex == 1 || colIndex == 3) { cellFormatter.setAlignment( rowIndex, colIndex, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); } else if (colIndex == 0) { cellFormatter.setAlignment( rowIndex, colIndex, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); } if (colIndex == 2) { cellFormatter.setAlignment( rowIndex, colIndex, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); } } } // add(sortableTable); add(table); }