本文整理汇总了Java中org.pentaho.di.ui.core.widget.TreeMemory类的典型用法代码示例。如果您正苦于以下问题:Java TreeMemory类的具体用法?Java TreeMemory怎么用?Java TreeMemory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeMemory类属于org.pentaho.di.ui.core.widget包,在下文中一共展示了TreeMemory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshTreeTable
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
/**
* Refresh the data in the tree-table...
* Use the data from the JobTracker in the job
*/
private void refreshTreeTable()
{
if (jobTracker!=null)
{
int nrItems = jobTracker.getTotalNumberOfItems();
if (nrItems!=previousNrItems)
{
// Allow some flickering for now ;-)
wTree.removeAll();
// Re-populate this...
TreeItem treeItem = new TreeItem(wTree, SWT.NONE);
String jobName = jobTracker.getJobName();
if(Const.isEmpty(jobName))
{
if (!Const.isEmpty(jobTracker.getJobFilename())) jobName = jobTracker.getJobFilename();
else jobName = Messages.getString("JobLog.Tree.StringToDisplayWhenJobHasNoName"); //$NON-NLS-1$
}
treeItem.setText(0, jobName);
TreeMemory.getInstance().storeExpanded(STRING_CHEF_LOG_TREE_NAME, new String[] { jobName }, true);
for (int i=0;i<jobTracker.nrJobTrackers();i++)
{
addTrackerToTree(jobTracker.getJobTracker(i), treeItem);
}
previousNrItems = nrItems;
TreeMemory.setExpandedFromMemory(wTree, STRING_CHEF_LOG_TREE_NAME);
}
}
}
示例2: expandAllItems
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
private void expandAllItems(TreeItem[] treeitems,boolean expand)
{
for (TreeItem item : treeitems) {
item.setExpanded(expand);
TreeMemory.getInstance().storeExpanded(STRING_REPOSITORY_EXPLORER_TREE_NAME, ConstUI.getTreeStrings(item), expand);
if(item.getItemCount()>0)
expandAllItems(item.getItems(),expand);
}
}
示例3: refreshTreeTable
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
/**
* Refresh the data in the tree-table...
* Use the data from the JobTracker in the job
*/
private void refreshTreeTable()
{
if (jobTracker!=null)
{
int nrItems = jobTracker.getTotalNumberOfItems();
if (nrItems!=previousNrItems)
{
// Allow some flickering for now ;-)
wTree.removeAll();
// Re-populate this...
TreeItem treeItem = new TreeItem(wTree, SWT.NONE);
String jobName = jobTracker.getJobName();
if(Const.isEmpty(jobName))
{
if (!Const.isEmpty(jobTracker.getJobFilename())) jobName = jobTracker.getJobFilename();
else jobName = BaseMessages.getString(PKG, "JobLog.Tree.StringToDisplayWhenJobHasNoName"); //$NON-NLS-1$
}
treeItem.setText(0, jobName);
TreeMemory.getInstance().storeExpanded(STRING_CHEF_LOG_TREE_NAME, new String[] { jobName }, true);
for (int i=0;i<jobTracker.nrJobTrackers();i++)
{
addTrackerToTree(jobTracker.getJobTracker(i), treeItem);
}
previousNrItems = nrItems;
TreeMemory.setExpandedFromMemory(wTree, STRING_CHEF_LOG_TREE_NAME);
}
}
}
示例4: expandAllItems
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
private void expandAllItems( TreeItem[] treeitems, boolean expand ) {
for ( TreeItem item : treeitems ) {
item.setExpanded( expand );
TreeMemory.getInstance().storeExpanded(
STRING_REPOSITORY_EXPLORER_TREE_NAME, ConstUI.getTreeStrings( item ), expand );
if ( item.getItemCount() > 0 ) {
expandAllItems( item.getItems(), expand );
}
}
}
示例5: refreshTreeTable
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
/**
* Refresh the data in the tree-table... Use the data from the JobTracker in the job
*/
private void refreshTreeTable() {
if ( jobTracker != null ) {
int nrItems = jobTracker.getTotalNumberOfItems();
if ( nrItems != previousNrItems ) {
// Allow some flickering for now ;-)
wTree.removeAll();
// Re-populate this...
TreeItem treeItem = new TreeItem( wTree, SWT.NONE );
String jobName = jobTracker.getJobName();
if ( Utils.isEmpty( jobName ) ) {
if ( !Utils.isEmpty( jobTracker.getJobFilename() ) ) {
jobName = jobTracker.getJobFilename();
} else {
jobName = BaseMessages.getString( PKG, "JobLog.Tree.StringToDisplayWhenJobHasNoName" );
}
}
treeItem.setText( 0, jobName );
TreeMemory.getInstance().storeExpanded( STRING_CHEF_LOG_TREE_NAME, new String[] { jobName }, true );
for ( int i = 0; i < jobTracker.nrJobTrackers(); i++ ) {
addTrackerToTree( jobTracker.getJobTracker( i ), treeItem );
}
previousNrItems = nrItems;
TreeMemory.setExpandedFromMemory( wTree, STRING_CHEF_LOG_TREE_NAME );
}
}
}
示例6: refreshTree
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
public void refreshTree() throws MetaStoreException {
tree.removeAll();
// Top level: the MetaStore
//
for ( int m = 0; m < metaStoreList.size(); m++ ) {
IMetaStore metaStore = metaStoreList.get( m );
TreeItem metaStoreItem = new TreeItem( tree, SWT.NONE );
metaStoreItem.setText( 0, Const.NVL( metaStore.getName(), "metastore-" + ( m + 1 ) ) );
metaStoreItem.setText( 1, Const.NVL( metaStore.getDescription(), "" ) );
// level: Namespace
//
List<String> namespaces = metaStore.getNamespaces();
for ( String namespace : namespaces ) {
TreeItem namespaceItem = new TreeItem( metaStoreItem, SWT.NONE );
namespaceItem.setText( 0, Const.NVL( namespace, "" ) );
// level: element type
//
List<IMetaStoreElementType> elementTypes = metaStore.getElementTypes( namespace );
for ( IMetaStoreElementType elementType : elementTypes ) {
TreeItem elementTypeItem = new TreeItem( namespaceItem, SWT.NONE );
elementTypeItem.setText( 0, Const.NVL( elementType.getName(), "" ) );
elementTypeItem.setText( 1, Const.NVL( elementType.getDescription(), "" ) );
// level: element
//
List<IMetaStoreElement> elements = metaStore.getElements( namespace, elementType );
for ( final IMetaStoreElement element : elements ) {
TreeItem elementItem = new TreeItem( elementTypeItem, SWT.NONE );
elementItem.setText( 0, Const.NVL( element.getName(), "" ) );
elementItem.setText( 2, Const.NVL( element.getId(), "" ) );
elementItem.addListener( SWT.Selection, new Listener() {
@Override
public void handleEvent( Event event ) {
log.logBasic( "Selected : " + element.getName() );
}
} );
addAttributesToTree( elementItem, element );
}
}
}
}
TreeUtil.setOptimalWidthOnColumns( tree );
TreeMemory.setExpandedFromMemory( tree, META_STORE_EXPLORER_DIALOG_TREE );
}
示例7: addControls
import org.pentaho.di.ui.core.widget.TreeMemory; //导入依赖的package包/类
/**
* Add the controls to the tab
*/
private void addControls() {
// Create the tree table...
wTree = new Tree( jobGraph.extraViewTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
wTree.setHeaderVisible( true );
TreeMemory.addTreeListener( wTree, STRING_CHEF_LOG_TREE_NAME );
TreeColumn column1 = new TreeColumn( wTree, SWT.LEFT );
column1.setText( BaseMessages.getString( PKG, "JobLog.Column.JobJobEntry" ) );
column1.setWidth( 200 );
TreeColumn column2 = new TreeColumn( wTree, SWT.LEFT );
column2.setText( BaseMessages.getString( PKG, "JobLog.Column.Comment" ) );
column2.setWidth( 200 );
TreeColumn column3 = new TreeColumn( wTree, SWT.LEFT );
column3.setText( BaseMessages.getString( PKG, "JobLog.Column.Result" ) );
column3.setWidth( 100 );
TreeColumn column4 = new TreeColumn( wTree, SWT.LEFT );
column4.setText( BaseMessages.getString( PKG, "JobLog.Column.Reason" ) );
column4.setWidth( 200 );
TreeColumn column5 = new TreeColumn( wTree, SWT.LEFT );
column5.setText( BaseMessages.getString( PKG, "JobLog.Column.Filename" ) );
column5.setWidth( 200 );
TreeColumn column6 = new TreeColumn( wTree, SWT.RIGHT );
column6.setText( BaseMessages.getString( PKG, "JobLog.Column.Nr" ) );
column6.setWidth( 50 );
TreeColumn column7 = new TreeColumn( wTree, SWT.RIGHT );
column7.setText( BaseMessages.getString( PKG, "JobLog.Column.LogDate" ) );
column7.setWidth( 120 );
FormData fdTree = new FormData();
fdTree.left = new FormAttachment( 0, 0 );
fdTree.top = new FormAttachment( 0, 0 );
fdTree.right = new FormAttachment( 100, 0 );
fdTree.bottom = new FormAttachment( 100, 0 );
wTree.setLayoutData( fdTree );
final Timer tim = new Timer( "JobGrid: " + jobGraph.getMeta().getName() );
TimerTask timtask = new TimerTask() {
public void run() {
Display display = jobGraph.getDisplay();
if ( display != null && !display.isDisposed() ) {
display.asyncExec( new Runnable() {
public void run() {
// Check if the widgets are not disposed.
// This happens is the rest of the window is not yet disposed.
// We ARE running in a different thread after all.
//
// TODO: add a "auto refresh" check box somewhere
if ( !wTree.isDisposed() ) {
refreshTreeTable();
}
}
} );
}
}
};
tim.schedule( timtask, 10L, 2000L ); // refresh every 2 seconds...
jobGraph.jobLogDelegate.getJobLogTab().addDisposeListener( new DisposeListener() {
public void widgetDisposed( DisposeEvent disposeEvent ) {
tim.cancel();
}
} );
}