@Override protected GUIContainerComponent getDynamicContents(IElement el) { GUIPanelComponent rootPanel = GUIPanelComponent.createFlow(null); rootPanel.setStyle("fileBrowser"); Folder folder = (Folder) el; if (folder == null) return rootPanel; try { folder.title.val(); // We first check whether this object exist. } catch(GeneralActionExecutionException gaee) { return rootPanel; // If the object does not exist, we just return empty panel. } GUIBufferComponent folderBuf = GUIBufferComponent.create(rootPanel, true, folder); //Items GUIPanelComponent itemsTable = GUIPanelComponent.createTable(rootPanel); int row = 0; for (Document item : folder.subItems.read()) { int col = 0; GUIBufferComponent itemBuf = GUIBufferComponent.create(rootPanel, true, item); GUIEdit select = GUIEdit.createList(itemsTable, Folder.PROPERTIES.selected); select.setLayoutData(TableLayoutData.create(row, col++)); GUIComponentBinding.create(itemBuf.opOutput(), select.ipCollection()); GUIComponentBinding.create(folderBuf.opOutput(), select.ipElement()); GUIButtonComponent edit = GUIButtonComponent.create(itemsTable, " ", TableLayoutData.create(row, col++)); edit.setStyle("editName"); edit.setTooltip("Rename"); GUIPanelComponent nameWrap = GUIPanelComponent.createFlow(itemsTable); if (item instanceof Folder) nameWrap.setRowColumn(row, col++, 1, 4); //chrome likes colspan 4 else nameWrap.setRowColumn(row, col++); GUIButtonComponent buttonLink = GUIButtonComponent.createLink(nameWrap, item.title.val().toString()); if (item instanceof RegularDocument) buttonLink.setStyle("#fileLink"); else buttonLink.setStyle("#folderLink"); if (item instanceof Folder) // Only for folders we will do navigation through the hierarchy and folder size. { GUIBufferComponent b1 = GUIBufferComponent.create(rootPanel, false, item); GUIComponentBinding.create(b1.opOutput(), this.ipRelay2()); GUIComponentBinding.create(buttonLink.opClick(), b1.ipSend()); GUILabelComponent.create(nameWrap, FormattingUtility.formatReal(Real.valueOf(((Folder)item).getSize())) + "MB"); } GUIInput nameInput = GUIInput.createField(nameWrap, Text.CLASSIFIER); nameInput.addInitialValue(item.title.val()); nameInput.setStyle("gwt-TextBox-invisible"); GUICommandComponent rename = GUICommandComponent.create(nameWrap, FileSystem.rename, PerformImmediately.NOTHING); GUIComponentBinding.create(itemBuf.opOutput(), rename, RenameDocument.PROPERTIES.document); GUIComponentBinding.create(nameInput.opValue(), rename, RenameDocument.PROPERTIES.newTitle); GUIRelayComponent clickRelay = GUIRelayComponent.create(nameWrap); FileSystem.missFirstValueLogic(nameWrap, nameInput, clickRelay, clickRelay.ipRelay()); GUIComponentBinding.create(clickRelay.opRelay(), rename.ipClick()); GUIBufferComponent nullBuffer = GUIBufferComponent.create(rootPanel, false, (IElement)null); GUIComponentBinding.create(nullBuffer.opOutput(), this.ipRelay1()); GUIComponentBinding.create(rename.opCommandExecuted(), nullBuffer.ipSend()); GUIBufferComponent showEditor = GUIBufferComponent.create(nameWrap, false, Text.fromString("invisible")); GUIBufferComponent showLink = GUIBufferComponent.create(nameWrap, false, Text.fromString("invisible")); GUIComponentBinding.create(edit.opClick(), showEditor.ipSend()); GUIComponentBinding.create(rename.opCommandExecuted(), showLink.ipSend()); GUIComponentBinding.create(showEditor.opOutput(), nameInput.ipRemoveStyle()); GUIComponentBinding.create(showEditor.opOutput(), buttonLink.ipAddStyle()); GUIComponentBinding.create(showLink.opOutput(), nameInput.ipAddStyle()); GUIComponentBinding.create(showLink.opOutput(), buttonLink.ipRemoveStyle()); if (item instanceof RegularDocument) { GUIPanelComponent fileUploader = GUIEdit.createFile(itemsTable, RegularDocument.PROPERTIES.file, true, true); GUIComponentBinding.create(itemBuf.opOutput(), fileUploader.ipRelay1()); fileUploader.setRowColumn(row, col++); GUIEdit.getBrowseButton(fileUploader).setStyle("#browse" + (isLeft.val().toBoolean() ? "L" : "R") + row); GUIHTMLComponent browse = GUIHTMLComponent.create(itemsTable, ""); browse.setLayoutData(TableLayoutData.create(row, col++)); browse.setTooltip("Browse"); } row++; } return rootPanel; }