Search in sources :

Example 11 with XulTextbox

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");
}
Also used : XulRadio(org.pentaho.ui.xul.components.XulRadio) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulTab(org.pentaho.ui.xul.components.XulTab) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 12 with XulTextbox

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();
}
Also used : XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulDialog(org.pentaho.ui.xul.containers.XulDialog) XulLabel(org.pentaho.ui.xul.components.XulLabel) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 13 with XulTextbox

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();
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulListbox(org.pentaho.ui.xul.containers.XulListbox) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) Document(org.pentaho.ui.xul.dom.Document) XulComponent(org.pentaho.ui.xul.XulComponent) Test(org.junit.Test)

Aggregations

XulTextbox (org.pentaho.ui.xul.components.XulTextbox)13 XulRadio (org.pentaho.ui.xul.components.XulRadio)5 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)4 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)2 XulComponent (org.pentaho.ui.xul.XulComponent)2 XulException (org.pentaho.ui.xul.XulException)2 Binding (org.pentaho.ui.xul.binding.Binding)2 XulLabel (org.pentaho.ui.xul.components.XulLabel)2 XulTab (org.pentaho.ui.xul.components.XulTab)2 File (java.io.File)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DatabasePluginType (org.pentaho.di.core.plugins.DatabasePluginType)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)1 ExtMenuList (org.pentaho.di.ui.core.database.dialog.tags.ExtMenuList)1 ExtTextbox (org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox)1 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)1