use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.
the class StreamingController method initBindings.
/**
* Inits the controller-ui bindings.
*
* @param model - The {@link org.pentaho.di.trans.dataservice.ui.model.DataServiceModel} dataservice model.
* @throws InvocationTargetException
* @throws XulException
*/
public void initBindings(DataServiceModel model) throws InvocationTargetException, XulException, KettleException {
BindingFactory bindingFactory = getBindingFactory();
XulRadio streamingRadioButton = getElementById("streaming-type-radio");
XulTab streamingTab = getElementById("streaming-tab");
XulTextbox streamingMaxRows = getElementById("streaming-max-rows");
XulTextbox streamingMaxTime = getElementById("streaming-max-time");
bindingFactory.setBindingType(Binding.Type.BI_DIRECTIONAL);
// Set streaming max rows and time limit value on the text boxes.
// Get the values from the model first and fallback to the appropriate Kettle Properties
// if they don't exist in the mode.
int modelStreamingMaxRows = model.getServiceMaxRows();
streamingMaxRows.setValue(modelStreamingMaxRows > 0 ? Integer.toString(modelStreamingMaxRows) : kettleUtils.getKettleProperty("KETTLE_STREAMING_ROW_LIMIT", Integer.toString(DataServiceConstants.KETTLE_STREAMING_ROW_LIMIT)));
long modelStreamingMaxTime = model.getServiceMaxTime();
streamingMaxTime.setValue(modelStreamingMaxTime > 0 ? Long.toString(modelStreamingMaxTime) : kettleUtils.getKettleProperty("KETTLE_STREAMING_TIME_LIMIT", Integer.toString(DataServiceConstants.KETTLE_STREAMING_TIME_LIMIT)));
streamingTab.setVisible(model.isStreaming());
bindingFactory.createBinding(model, "serviceMaxRows", streamingMaxRows, "value", BindingConvertor.integer2String());
bindingFactory.createBinding(model, "serviceMaxTime", streamingMaxTime, "value", BindingConvertor.long2String());
bindingFactory.createBinding(streamingRadioButton, "selected", streamingTab, "visible");
}
use of org.pentaho.ui.xul.components.XulTextbox in project data-access by pentaho.
the class MessageHandler method showDetailedSuccessDialog.
@Bindable
public void showDetailedSuccessDialog(String message, String detailMessage) {
XulDialog detailedSuccessDialog = (XulDialog) document.getElementById("successDetailsDialog");
XulLabel successLabel = (XulLabel) document.getElementById("success_details_label");
successLabel.setValue(message);
XulTextbox detailMessageBox = (XulTextbox) document.getElementById("success_dialog_details");
detailMessageBox.setValue(detailMessage);
detailedSuccessDialog.show();
}
use of org.pentaho.ui.xul.components.XulTextbox in project pentaho-kettle by pentaho.
the class FragmentHandlerTest method testRefreshOptions.
@Test
public void testRefreshOptions() throws Exception {
XulListbox connectionBox = mock(XulListbox.class);
when(document.getElementById("connection-type-list")).thenReturn(connectionBox);
when(connectionBox.getSelectedItem()).thenReturn("myDb");
XulListbox accessBox = mock(XulListbox.class);
when(document.getElementById("access-type-list")).thenReturn(accessBox);
when(accessBox.getSelectedItem()).thenReturn("Native");
DataHandler dataHandler = mock(DataHandler.class);
when(xulDomContainer.getEventHandler("dataHandler")).thenReturn(dataHandler);
DatabaseInterface dbInterface = mock(DatabaseInterface.class);
when(dbInterface.getDefaultDatabasePort()).thenReturn(5309);
DataHandler.connectionMap.put("myDb", dbInterface);
XulComponent component = mock(XulComponent.class);
XulComponent parent = mock(XulComponent.class);
when(component.getParent()).thenReturn(parent);
when(document.getElementById("database-options-box")).thenReturn(component);
XulDomContainer fragmentContainer = mock(XulDomContainer.class);
Document mockDoc = mock(Document.class);
XulComponent firstChild = mock(XulComponent.class);
when(mockDoc.getFirstChild()).thenReturn(firstChild);
when(fragmentContainer.getDocumentRoot()).thenReturn(mockDoc);
when(xulDomContainer.loadFragment(anyString(), any(Object.class))).thenReturn(fragmentContainer);
XulTextbox portBox = mock(XulTextbox.class);
when(document.getElementById("port-number-text")).thenReturn(portBox);
fragmentHandler.refreshOptions();
// Iterate through the other database access types
when(accessBox.getSelectedItem()).thenReturn("JNDI");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("ODBC");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("OCI");
fragmentHandler.refreshOptions();
when(accessBox.getSelectedItem()).thenReturn("Plugin");
fragmentHandler.refreshOptions();
}
Aggregations