// ------------------------------------------------------------------------------------- public void updateFileContent() { if (listFiles.getSelectedIndex() != -1) { service = (ServiceManagerWebServiceAsync) Registry.get("guiservice"); service.getFile( LeftPanelLogin.session_id, selectedComponent, listFiles.getSimpleValue(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { Dispatcher.forwardEvent(MainEvents.error, caught); } @Override public void onSuccess(String result) { if (result != null) { if (!result.equals(currentOutput)) { output.setValue(result); } } else { removeAll(); ((TextArea) textArea) .setValue( "Session time elapsed! Please log out, log in again and refresh the selected option"); add(textArea); layout(true); } } }); } else { output.setEmptyText("Please select a file to display."); } }
public RightPropertiesPanel() { setHeading(Constants.MENU_PROPS); setLayout(new FitLayout()); ToolBar toolBarSelection = new ToolBar(); LabelToolItem labelComponents = new LabelToolItem("Component: "); toolBarSelection.add(labelComponents); labelComponents.setVisible(true); setTopComponent(toolBarSelection); listComponents = new SimpleComboBox<String>(); updateFileList("Folders", listComponents); listComponents.add(Constants.COMPONENT_SPMANAGERWEB_NAME); listComponents.add("Test"); listComponents.setForceSelection(true); listComponents.setEditable(false); listComponents.setTriggerAction(ComboBox.TriggerAction.ALL); listComponents.setEmptyText("- Choose a component -"); listComponents.setFieldLabel("Component"); listComponents.setWidth(200); toolBarSelection.add(listComponents); listComponents.addSelectionChangedListener( new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { selectedComponent = listComponents.getSimpleValue(); output.setEmptyText( "Select a component and configuration file to display and press \"Load\""); updateFileList(selectedComponent, listFiles); } }); LabelToolItem labelFiles = new LabelToolItem(" File: "); toolBarSelection.add(labelFiles); labelFiles.setVisible(true); listFiles = new SimpleComboBox<String>(); listFiles.setForceSelection(true); listFiles.setEditable(false); listFiles.setTriggerAction(ComboBox.TriggerAction.ALL); listFiles.setEmptyText("-Choose a file-"); listFiles.setFieldLabel("File"); listFiles.setAutoWidth(false); listFiles.setWidth(250); toolBarSelection.add(listFiles); listFiles.addSelectionChangedListener( new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { output.setEmptyText( "Select a component and configuration file to display and press \"Load\""); output.clear(); } }); Button loadButton = new Button("Load"); toolBarSelection.add(loadButton); loadButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { updateFileContent(); } }); currentOutput = "Select a component and configuration file to display and press \"Load\""; output = new TextArea(); output.addStyleName("demo-TextArea"); output.setWidth("800px"); output.setHeight("400px"); output.setReadOnly(true); output.setEmptyText("Select a component and configuration file to display and press \"Load\""); output.setVisible(true); add(output); }