Java源码示例:org.pentaho.ui.xul.containers.XulWindow

示例1
/**
 * Tests all of the copy* methods.
 */
@Test
public void testCopyToClipboard() throws Exception {
  final XulTextbox textbox = context.mock(XulTextbox.class);
  final XulWindow window = context.mock(XulWindow.class);
  final String stringToCopy = "ignored"; //$NON-NLS-1$
  context.checking(new Expectations() {
    {
      exactly(3).of(doc).getElementById(with(any(String.class)));
      will(returnValue(textbox));
      exactly(3).of(textbox).getValue();
      will(returnValue(stringToCopy));
      exactly(3).of(doc).getRootElement();
      will(returnValue(window));
      exactly(3).of(window).copy(with(equal(stringToCopy)));
    }
  });
  controller.copyDdlToClipboard();
  controller.copyDmlToClipboard();
  controller.copyToClipboardMultiDimPreview();
}
 
示例2
private void close() {
  XulComponent window = document.getElementById( "general-datasource-window" );

  if ( window == null ) { // window must be root
    window = document.getRootElement();
  }
  if ( window instanceof XulDialog ) {
    ( (XulDialog) window ).hide();
  } else if ( window instanceof XulWindow ) {
    ( (XulWindow) window ).close();
  }
}
 
示例3
private boolean windowClosed() {
  boolean closedWindow = true;
  XulComponent window = document.getElementById( "general-datasource-window" );

  if ( window == null ) { // window must be root
    window = document.getRootElement();
  }
  if ( window instanceof XulWindow ) {
    closedWindow = ( (XulWindow) window ).isClosed();
  }
  return closedWindow;
}
 
示例4
public void copyDdlToClipboard() {
  try {
    XulTextbox ddlField = (XulTextbox) document.getElementById(ELEM_ID_DDL_FIELD);
    Assert.notNull(ddlField, "could not find element with id '" + ELEM_ID_DDL_FIELD + "'");
    ((XulWindow) document.getRootElement()).copy(ddlField.getValue());

  } catch (XulException e) {
    if (logger.isErrorEnabled()) {
      logger.error("an exception occurred", e);
    }
  }
}
 
示例5
public void copyDmlToClipboard() {

    try {
      XulTextbox dmlField = (XulTextbox) document.getElementById(ELEM_ID_DML_FIELD);
      Assert.notNull(dmlField, "could not find element with id '" + ELEM_ID_DML_FIELD + "'");
      ((XulWindow) document.getRootElement()).copy(dmlField.getValue());

    } catch (XulException e) {
      if (logger.isErrorEnabled()) {
        logger.error("an exception occurred", e);
      }
    }
  }
 
示例6
public void copyToClipboardMultiDimPreview() {
  XulTextbox multiDimSchemaField = (XulTextbox) document.getElementById("multiDimSchemaField");
  try {
    ((XulWindow) document.getRootElement()).copy(multiDimSchemaField.getValue());
  } catch (XulException e) {
    if (logger.isErrorEnabled()) {
      logger.error("an exception occurred", e);
    }
  }
}
 
示例7
public void cut() {
  try {
    ((XulWindow) this.getXulDomContainer().getDocumentRoot().getRootElement()).cut();
    paste.setDisabled(false);
  } catch (XulException e) {
    logger.error(e.getMessage(), e);
  }
}
 
示例8
public void copy() {
  try {
    ((XulWindow) this.getXulDomContainer().getDocumentRoot().getRootElement()).copy();
    paste.setDisabled(false);
  } catch (XulException e) {
    logger.error(e.getMessage(), e);
  }
}
 
示例9
public void paste() {
  try {
    ((XulWindow) this.getXulDomContainer().getDocumentRoot().getRootElement()).paste();
    paste.setDisabled(false);
  } catch (XulException e) {
    logger.error(e.getMessage(), e);
  }
}
 
示例10
public XulWindow getWindow() {
  return window;
}