List of usage examples for com.google.gwt.user.client.ui FlexTable getRowCount
@Override public int getRowCount()
From source file:com.google.gwt.sample.stockwatcher.client.UserNotificationPage.java
private void renderActuatorSubcriptionPanel() { FlexTable wrapper = new FlexTable(); setHeaders(wrapper);//from w ww. jav a 2 s. c o m for (String actuator : actuatorSubcriptionList.keySet()) { int row = wrapper.getRowCount(); wrapper.setText(row, 0, actuator); wrapper.setText(row, 1, actuatorSubcriptionList.get(actuator)); } addUnsubscribeActuatorColumnAllRow(wrapper); aTable = wrapper; actuatorSubscribedPanel.clear(); actuatorSubscribedPanel.setStyleName("mainStyle"); actuatorSubscribedPanel.setSpacing(10); actuatorSubscribedPanel.add(new HTML("Subscribed Actuators")); actuatorSubscribedPanel.add(aTable); actuatorSubscribedPanel.add(subscribeActuatorButton); }
From source file:com.google.gwt.sample.stockwatcher.client.UserNotificationPage.java
private void addUnsubscribeControllerColumnAllRow(FlexTable ft) { for (int i = 1; i < ft.getRowCount(); i++) { if (ft.getText(i, 0).equals(noSubscription)) { break; }/*w w w .j av a 2 s . c om*/ Anchor Unsubscribe = new Anchor("Unsubscribe"); ft.setWidget(i, ft.getCellCount(i), Unsubscribe); Unsubscribe.setName(ft.getText(i, 0)); setUnsubscribeControllerClickHandler(Unsubscribe); } }
From source file:com.google.gwt.sample.stockwatcher.client.UserNotificationPage.java
private void addUnsubscribeSensorColumnAllRow(FlexTable ft) { for (int i = 1; i < ft.getRowCount(); i++) { if (ft.getText(i, 0).equals(noSubscription)) { break; }// ww w . ja v a 2 s .co m Anchor Unsubscribe = new Anchor("Unsubscribe"); ft.setWidget(i, ft.getCellCount(i), Unsubscribe); Unsubscribe.setName(ft.getText(i, 0)); setUnsubscribeSensorClickHandler(Unsubscribe); } }
From source file:com.google.gwt.sample.stockwatcher.client.UserNotificationPage.java
private void addUnsubscribeActuatorColumnAllRow(FlexTable ft) { for (int i = 1; i < ft.getRowCount(); i++) { if (ft.getText(i, 0).equals(noSubscription)) { break; }//www. ja v a2 s. c o m Anchor Unsubscribe = new Anchor("Unsubscribe"); ft.setWidget(i, ft.getCellCount(i), Unsubscribe); Unsubscribe.setName(ft.getText(i, 0)); setUnsubscribeActuatorClickHandler(Unsubscribe); } }
From source file:com.googlesource.gerrit.plugins.xdocs.client.XDocDiffScreen.java
License:Apache License
protected static int addRow(FlexTable table) { int row = table.getRowCount(); table.insertRow(row);/* w w w.java 2 s . c om*/ return row; }
From source file:com.hazelcast.monitor.client.MapBrowserPanel.java
License:Open Source License
@Override protected FlexTable createTable() { FlexTable table = new FlexTable(); table.addStyleName("table"); table.addStyleName("mapstats"); FlexTable getTable = new FlexTable(); table.setWidget(0, 0, new Label("")); table.getFlexCellFormatter().setColSpan(0, 0, 2); table.setWidget(1, 1, getTable);/*from w w w.ja v a 2 s .c o m*/ final TextBox key = new TextBox(); getTable.setWidget(0, 0, new Label("Key: ")); getTable.setWidget(0, 1, key); Button button = new Button("Get"); button.addStyleName("map_get_button"); getTable.setWidget(0, 2, button); FlexTable resultTable = new FlexTable(); resultTable.setWidth("500px"); table.setWidget(1, 2, resultTable); resultTable.setWidget(0, 0, new Label("Value: ")); resultTable.setWidget(1, 0, new Label("Hits: ")); resultTable.setWidget(2, 0, new Label("Cost: ")); resultTable.setWidget(3, 0, new Label("Valid: ")); resultTable.setWidget(4, 0, new Label("Expiration Time: ")); resultTable.setWidget(5, 0, new Label("Last Acess Time: ")); resultTable.setWidget(6, 0, new Label("Last Update Time: ")); resultTable.setWidget(7, 0, new Label("Creation Time: ")); for (int i = 0; i < resultTable.getRowCount(); i++) { Label label = (Label) resultTable.getWidget(i, 0); label.addStyleName("bold"); if (i % 2 == 1) { resultTable.getRowFormatter().addStyleName(i, "mapstatsEvenRow"); } } final TextArea value = new TextArea(); final Label hits = new Label(); final Label cost = new Label(); final Label expirationTime = new Label(); final Label lastAcessTime = new Label(); final Label lastUpdateTime = new Label(); final Label creationTime = new Label(); final Label valid = new Label(); resultTable.setWidget(0, 1, value); resultTable.setWidget(1, 1, hits); resultTable.setWidget(2, 1, cost); resultTable.setWidget(3, 1, valid); resultTable.setWidget(4, 1, expirationTime); resultTable.setWidget(5, 1, lastAcessTime); resultTable.setWidget(6, 1, lastUpdateTime); resultTable.setWidget(7, 1, creationTime); final DateTimeFormat dateFormatter = DateTimeFormat.getFormat("yyyy.MM.dd HH:mm:ss"); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { mapService.get(clusterWidgets.clusterId, name, key.getText(), new AsyncCallback<MapEntry>() { public void onFailure(Throwable throwable) { if (throwable instanceof ClientDisconnectedException) { clusterWidgets.disconnected(); } value.setText(throwable.toString()); } public void onSuccess(MapEntry mapEntry) { value.setText((mapEntry == null) ? "null" : mapEntry.getValue()); hits.setText((mapEntry == null) ? "" : String.valueOf(mapEntry.getHits())); cost.setText((mapEntry == null) ? "" : formatMemorySize(mapEntry.getCost())); valid.setText((mapEntry == null) ? "" : String.valueOf(mapEntry.isValid())); expirationTime.setText( (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getExpirationTime())); lastAcessTime.setText( (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getLastAccessTime())); lastUpdateTime.setText( (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getLastUpdateTime())); creationTime.setText( (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getCreationTime())); } }); } }); return table; }
From source file:com.hazelcast.monitor.client.PanelUtils.java
License:Open Source License
public static void removeUnusedRows(int row, FlexTable table) { while (table.getRowCount() > row) { table.removeRow(row);/*from w w w.j a va 2s .c om*/ } }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapTable.java
License:Open Source License
/** * Adding document row/*from w w w . j a v a 2 s .c o m*/ * * @param gwtQueryResult Query result * @param score Document score */ private void addDocumentRow(GWTQueryResult gwtQueryResult, Score score) { Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering(); int rows = table.getRowCount(); int firstRow = rows; firtRowList.add("" + firstRow); GWTDocument doc = new GWTDocument(); if (gwtQueryResult.getDocument() != null) { doc = gwtQueryResult.getDocument(); } else if (gwtQueryResult.getAttachment() != null) { doc = gwtQueryResult.getAttachment(); } final String docPath = doc.getPath(); Image gotoDocument = new Image("img/icon/actions/goto_document.gif"); gotoDocument.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CommonUI.openPath(docPath.substring(0, docPath.lastIndexOf("/")), docPath); } }); gotoDocument.setTitle(Main.i18n("dashboard.keyword.goto.document")); gotoDocument.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(rows, 0, gotoDocument); if (doc.isAttachment()) { SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method sp.add(new HTML(Util.imageItemHTML("img/email_attach.gif") + Util.mimeImageHTML(doc.getMimeType()))); table.setWidget(rows, 1, sp); } else { SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method sp.add(new HTML(Util.mimeImageHTML(doc.getMimeType()))); table.setWidget(rows, 1, sp); } Hyperlink hLink = new Hyperlink(); hLink.setHTML(doc.getName()); // On attachment case must remove last folder path, because it's internal usage not for visualization if (doc.isAttachment()) { hLink.setTitle(doc.getParentPath().substring(0, doc.getParentPath().lastIndexOf("/"))); } else { hLink.setTitle(doc.getParentPath()); } table.setWidget(rows, 2, hLink); // Format table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE); table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE); table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE); table.getFlexCellFormatter().setWidth(rows, 0, "24"); table.getFlexCellFormatter().setWidth(rows, 1, "47"); for (int i = 0; i < 2; i++) { table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect"); } // Writing detail rows++; // Next row line FlexTable tableDocument = new FlexTable(); FlexTable tableProperties = new FlexTable(); FlexTable tableSubscribedUsers = new FlexTable(); tableDocument.setWidget(0, 0, tableProperties); tableDocument.setHTML(0, 1, ""); tableDocument.setWidget(0, 2, tableSubscribedUsers); tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP); tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP); tableDocument.getCellFormatter().setWidth(0, 0, "75%"); tableDocument.getCellFormatter().setWidth(0, 1, "25"); tableDocument.getCellFormatter().setWidth(0, 2, "25%"); tableDocument.setWidth("100%"); table.setWidget(rows, 0, tableDocument); table.getFlexCellFormatter().setColSpan(rows, 0, 3); table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT); tableDocument.setStyleName("okm-DisableSelect"); tableProperties.setStyleName("okm-DisableSelect"); tableSubscribedUsers.setStyleName("okm-DisableSelect"); tableProperties.setHTML(0, 0, "<b>" + Main.i18n("document.folder") + "</b>"); tableProperties.setHTML(0, 1, doc.getParentPath()); tableProperties.setHTML(1, 0, "<b>" + Main.i18n("document.size") + "</b>"); tableProperties.setHTML(1, 1, Util.formatSize(doc.getActualVersion().getSize())); tableProperties.setHTML(2, 0, "<b>" + Main.i18n("document.created") + "</b>"); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(2, 1, dtf.format(doc.getCreated()) + " " + Main.i18n("document.by") + " " + doc.getAuthor()); tableProperties.setHTML(3, 0, "<b>" + Main.i18n("document.lastmodified") + "</b>"); tableProperties.setHTML(3, 1, dtf.format(doc.getLastModified()) + " " + Main.i18n("document.by") + " " + doc.getActualVersion().getAuthor()); tableProperties.setHTML(4, 0, "<b>" + Main.i18n("document.mimetype") + "</b>"); tableProperties.setHTML(4, 1, doc.getMimeType()); tableProperties.setHTML(5, 0, "<b>" + Main.i18n("document.status") + "</b>"); if (doc.isCheckedOut()) { tableProperties.setHTML(5, 1, Main.i18n("document.status.checkout") + " " + doc.getLockInfo().getOwner()); } else if (doc.isLocked()) { tableProperties.setHTML(5, 1, Main.i18n("document.status.locked") + " " + doc.getLockInfo().getOwner()); } else { tableProperties.setHTML(5, 1, Main.i18n("document.status.normal")); } tableProperties.setHTML(6, 0, "<b>" + Main.i18n("document.subscribed") + "</b>"); if (doc.isSubscribed()) { tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.yes")); } else { tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.no")); } // Sets wordWrap for al rows for (int i = 0; i < 7; i++) { setRowWordWarp(i, 2, false, tableProperties); } // Setting subscribers tableSubscribedUsers.setHTML(0, 0, "<b>" + Main.i18n("document.subscribed.users") + "<b>"); setRowWordWarp(0, 1, false, tableSubscribedUsers); // Sets the folder subscribers for (GWTUser subscriptor : doc.getSubscriptors()) { tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername()); setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 1, false, tableSubscribedUsers); } HorizontalPanel hKeyPanel = addKeywords(table, doc.getKeywords(), selectedKeyList); // Drawing keywords // Setting visibility switch (visibleStatus) { case VISIBLE_SMALL: tableDocument.setVisible(false); hKeyPanel.setVisible(false); table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder"); table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder"); table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder"); break; case VISIBLE_MEDIUM: tableDocument.setVisible(false); hKeyPanel.setVisible(true); break; case VISIBLE_BIG: tableDocument.setVisible(true); hKeyPanel.setVisible(true); break; } // Saving object for refreshing language and setting visible ( true / false ) tableDocumentList.add(tableDocument); hKeyPanelList.add(hKeyPanel); }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapTable.java
License:Open Source License
/** * Adding folder/* w w w . j a va 2 s. c o m*/ * * @param gwtQueryResult Query result * @param score The folder score */ private void addFolderRow(GWTQueryResult gwtQueryResult, Score score) { Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering(); int rows = table.getRowCount(); int firstRow = rows; firtRowList.add("" + firstRow); GWTFolder folder = new GWTFolder(); if (gwtQueryResult.getFolder() != null) { folder = gwtQueryResult.getFolder(); } final String fldPath = folder.getPath(); Image gotoFolder = new Image("img/icon/actions/goto_folder.gif"); gotoFolder.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CommonUI.openPath(fldPath, null); } }); gotoFolder.setTitle(Main.i18n("dashboard.keyword.goto.folder")); gotoFolder.setStyleName("okm-KeyMap-ImageHover"); table.setWidget(rows, 0, gotoFolder); // Solves some middle alignament problem derived from mimeImageHTML method SimplePanel sp = new SimplePanel(); if (folder.isHasChildren()) { sp.add(new HTML(Util.imageItemHTML("img/menuitem_childs.gif"))); } else { sp.add(new HTML(Util.imageItemHTML("img/menuitem_empty.gif"))); } table.setWidget(rows, 1, sp); Hyperlink hLink = new Hyperlink(); hLink.setHTML(folder.getName()); hLink.setTitle(folder.getPath()); table.setWidget(rows, 2, hLink); // Format table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER); table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE); table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE); table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE); table.getFlexCellFormatter().setWidth(rows, 0, "24"); table.getFlexCellFormatter().setWidth(rows, 1, "47"); for (int i = 0; i < 2; i++) { table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect"); } // Writing detail rows++; // Next row line FlexTable tableFolder = new FlexTable(); FlexTable tableProperties = new FlexTable(); FlexTable tableSubscribedUsers = new FlexTable(); tableFolder.setWidget(0, 0, tableProperties); tableFolder.setHTML(0, 1, ""); tableFolder.setWidget(0, 2, tableSubscribedUsers); tableFolder.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP); tableFolder.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP); tableFolder.getCellFormatter().setWidth(0, 0, "75%"); tableFolder.getCellFormatter().setWidth(0, 1, "25"); tableFolder.getCellFormatter().setWidth(0, 2, "25%"); tableFolder.setWidth("100%"); table.setWidget(rows, 0, tableFolder); table.getFlexCellFormatter().setColSpan(rows, 0, 3); table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT); tableFolder.setStyleName("okm-DisableSelect"); tableProperties.setStyleName("okm-DisableSelect"); tableSubscribedUsers.setStyleName("okm-DisableSelect"); tableProperties.setHTML(0, 0, "<b>" + Main.i18n("folder.name") + "</b>"); tableProperties.setHTML(0, 1, folder.getName()); tableProperties.setHTML(1, 0, "<b>" + Main.i18n("folder.parent") + "</b>"); tableProperties.setHTML(1, 1, folder.getParentPath()); tableProperties.setHTML(2, 0, "<b>" + Main.i18n("folder.created") + "</b>"); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(2, 1, dtf.format(folder.getCreated()) + " " + Main.i18n("folder.by") + " " + folder.getAuthor()); tableProperties.setHTML(3, 0, "<b>" + Main.i18n("document.subscribed") + "</b>"); if (folder.isSubscribed()) { tableProperties.setHTML(3, 1, Main.i18n("document.subscribed.yes")); } else { tableProperties.setHTML(3, 1, Main.i18n("document.subscribed.no")); } // Sets wordWrap for al rows for (int i = 0; i < 4; i++) { setRowWordWarp(i, 2, false, tableProperties); } // Setting subscribers tableSubscribedUsers.setHTML(0, 0, "<b>" + Main.i18n("folder.subscribed.users") + "<b>"); setRowWordWarp(0, 1, false, tableSubscribedUsers); // Sets the folder subscribers for (GWTUser subscriptor : folder.getSubscriptors()) { tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername()); setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 1, false, tableSubscribedUsers); } HorizontalPanel hKeyPanel = addKeywords(table, folder.getKeywords(), selectedKeyList); // Drawing keywords // Setting visibility switch (visibleStatus) { case VISIBLE_SMALL: tableFolder.setVisible(false); hKeyPanel.setVisible(false); table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder"); table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder"); table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder"); break; case VISIBLE_MEDIUM: tableFolder.setVisible(false); hKeyPanel.setVisible(true); break; case VISIBLE_BIG: tableFolder.setVisible(true); hKeyPanel.setVisible(true); break; } // Saving object for refreshing language and setting visible ( true / false ) tableFolderList.add(tableFolder); hKeyPanelList.add(hKeyPanel); }
From source file:com.ikon.frontend.client.widget.dashboard.keymap.KeyMapTable.java
License:Open Source License
/** * addKeywords/*from ww w . j a va2 s.c o m*/ * * @param table * @param keywords * @param selectedKeyList * @return */ private HorizontalPanel addKeywords(FlexTable table, Set<String> keywords, Collection<String> selectedKeyList) { int rows = table.getRowCount(); // Writing keys rows++; // Next row line HorizontalPanel hKeyPanel = new HorizontalPanel(); table.setWidget(rows, 0, hKeyPanel); table.getFlexCellFormatter().setColSpan(rows, 0, 3); table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().addStyleName(rows, 0, "okm-Table-BottomBorder"); for (final String keyword : keywords) { // First adds only new keywords if (!selectedKeyList.contains(keyword)) { HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover add = new ImageHover("img/icon/actions/add_disabled.gif", "img/icon/actions/add.gif"); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // remove keyword on all keyword panels Main.get().mainPanel.dashboard.keyMapDashboard.selectKey(keyword); } }); add.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); hPanel.add(add); hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Gray"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); hKeyPanel.add(externalPanel); } } for (final String keyword : selectedKeyList) { // Last adding selected keywords HorizontalPanel externalPanel = new HorizontalPanel(); HorizontalPanel hPanel = new HorizontalPanel(); HTML space = new HTML(); ImageHover add = new ImageHover("img/icon/actions/delete_disabled.gif", "img/icon/actions/delete.gif"); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // remove keyword on all keyword panels Main.get().mainPanel.dashboard.keyMapDashboard.removeKey(keyword); } }); add.setStyleName("okm-KeyMap-ImageHover"); hPanel.add(new HTML(keyword)); hPanel.add(space); hPanel.add(add); hPanel.setCellWidth(space, "6"); hPanel.setStyleName("okm-KeyMap-Selected"); HTML space1 = new HTML(); externalPanel.add(hPanel); externalPanel.add(space1); externalPanel.setCellWidth(space1, "6"); hKeyPanel.add(externalPanel); } return hKeyPanel; }