Java Code Examples for org.eclipse.swt.widgets.TableItem

The following are top voted examples for showing how to use org.eclipse.swt.widgets.TableItem. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AppleCommander   File: ImportSelectFilesWizardPane.java   Source Code and License 7 votes vote down vote up
/**
 * Refresh the table of information.
 */
protected void refreshTable() {
	fileTable.removeAll();
	Iterator specs = wizard.getImportSpecifications().iterator();
	boolean canFinish = specs.hasNext();
	while (specs.hasNext()) {
		ImportSpecification spec = (ImportSpecification) specs.next();
		File file = new File(spec.getSourceFilename());
		TableItem item = new TableItem(fileTable, SWT.NULL);
		item.setText(new String[] {
			file.getName(),
			spec.getTargetFilename(),
			spec.getFiletype() });
		item.setData(spec);
		canFinish &= spec.hasFiletype();
	}
	fileTable.redraw();
	wizard.enableFinishButton(canFinish);
}
 
Example 2
Project: ide-plugins   File: PluginsSWT.java   Source Code and License 6 votes vote down vote up
private void checkSelection(final Table table) {
    TableItem[] items = table.getSelection();
    if (items != null && items.length > 0) {
        for (TableItem item: items) {
            Plugin plugin = (Plugin) item.getData();
            if (plugin != null) {
                if (source.stream().anyMatch(p -> p.equals(plugin))) {
                    btnSelect.setEnabled(true);
                } else if (target.stream().anyMatch(p -> p.equals(plugin))) {
                    btnDeselect.setEnabled(true);
                }
                return;
            }
        }
    }
    btnSelect.setEnabled(false);
    btnDeselect.setEnabled(false);
}
 
Example 3
Project: Hydrograph   File: FilterHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Gets the conditional operator modify listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the conditional operator modify listener
 */
public ModifyListener getConditionalOperatorModifyListener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			TableItem tableItem = getTableItem(source);
			Condition condition = (Condition) tableItem.getData();
			if (tableItem.getData(FilterConstants.VALUE2TEXTBOX) != null) {
				Text text = (Text) tableItem.getData(FilterConstants.VALUE2TEXTBOX);
				enableAndDisableValue2TextBox(condition.getConditionalOperator(), text);
			}
			processConditionalOperator(source, conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 4
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 6 votes vote down vote up
public List<ACL> getZnodeAclFromTable() {

        Table table = getTable();
        TableItem[] items = table.getItems();

        Set<ACL> aclSet = new HashSet<ACL>(items.length);
        for (TableItem item : items) {

            int perms = getItemPerms(item);
            Id id = getItemId(item);

            ACL acl = new ACL(perms, id);
            aclSet.add(acl);
        }
        return new ArrayList<ACL>(aclSet);
    }
 
Example 5
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 6 votes vote down vote up
private void tableSelectionChanged(TableItem item) {

        Button setIdButton = getSetIdButton();
        setIdButton.setEnabled(SCHEME_DIGEST.equals(item.getText(TABLE_COLUMN_SCHEME)));

        Button removeButton = getRemoveButton();
        removeButton.setEnabled(item != null);

        initSchemeTableEditor(item);
        initIdTableEditor(item);

        Control idEditor = _IdTableEditor.getEditor();
        if (idEditor != null && !idEditor.isDisposed()) {
            idEditor.setFocus();
        }
    }
 
Example 6
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 6 votes vote down vote up
private int getItemPerms(TableItem item) {
    int perms = 0;
    Button allCheckBox = getItemPermCheckBox(item, ZooDefs.Perms.ALL);
    if (allCheckBox.getSelection()) {
        perms = ZooDefs.Perms.ALL;
    }
    else {
        for (int perm : PERMS) {
            Button permCheckBox = getItemPermCheckBox(item, perm);
            if (permCheckBox.getSelection()) {
                perms |= perm;
            }
        }
    }

    return perms;
}
 
Example 7
Project: eZooKeeper   File: JmxConnectionModelMainFormPage.java   Source Code and License 6 votes vote down vote up
/**
 * TODO: Comment.
 * 
 */
protected void initPropertiesSectionFromModel() {

    Table table = getPropertiesSectionTable();
    table.removeAll();

    Map<String, String> properties = getZooKeeperConnectionProperties();

    for (String key : properties.keySet()) {
        TableItem item = new TableItem(table, SWT.NONE);
        String value = properties.get(key);
        item.setText(0, key);
        item.setText(1, value);
    }

    packTable(table, PROPERTIES_COLUMN_WIDTHS);

}
 
Example 8
Project: eZooKeeper   File: BaseJmxModelMainFormPage.java   Source Code and License 6 votes vote down vote up
protected void initDescriptorSectionFromModel() {

        Descriptor descriptor = getJmxDescriptor();
        if (descriptor == null) {
            return;
        }

        Table table = getDescriptorTable();
        if (table == null) {
            return;
        }

        table.removeAll();

        for (String fieldName : descriptor.getFieldNames()) {
            TableItem item = new TableItem(table, SWT.NONE);
            Object value = descriptor.getFieldValue(fieldName);
            item.setText(0, fieldName);
            item.setText(1, String.valueOf(value));
        }

        packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS);
    }
 
Example 9
Project: eZooKeeper   File: MBeanAttributeModelMainFormPage.java   Source Code and License 6 votes vote down vote up
@Override
protected void initPrimarySectionFromModel() {

    Table table = getPrimaryTable();

    table.removeAll();

    MBeanAttributeModel model = getModel();
    MBeanAttribute attribute = model.getData();

    String valueString = attribute.getValueAsString();
    String valueError = attribute.getValueRetrievalErrorMessage();

    TableItem item = new TableItem(table, SWT.NONE);
    item.setText(0, attribute.getName());

    if (valueError != null) {
        item.setText(1, valueError);
        item.setForeground(1, table.getDisplay().getSystemColor(SWT.COLOR_RED));
    }
    else {
        item.setText(1, valueString);
    }

    packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS);
}
 
Example 10
Project: eZooKeeper   File: MBeanFeatureModeMainFormPage.java   Source Code and License 6 votes vote down vote up
@Override
protected void initInfoSectionFromModel() {

    Table table = getInfoTable();
    table.removeAll();

    MBeanFeatureInfo featureInfo = getFeatureInfo();

    TableItem nameItem = new TableItem(table, SWT.NONE);
    nameItem.setText(0, FEATURE_INFO_PROPERTY_NAME_NAME);
    nameItem.setText(1, featureInfo.getName());

    TableItem descriptionItem = new TableItem(table, SWT.NONE);
    descriptionItem.setText(0, FEATURE_INFO_PROPERTY_NAME_DESCRIPTION);
    descriptionItem.setText(1, featureInfo.getDescription());
}
 
Example 11
Project: neoscada   File: IgnorePage.java   Source Code and License 6 votes vote down vote up
@Override
public void setVisible ( final boolean visible )
{
    super.setVisible ( visible );

    if ( visible )
    {
        final Object[] data = this.mergeController.makeKnownFactories ().toArray ();
        this.factoriesViewer.setInput ( data );

        final Set<String> factories = this.mergeController.getIgnoreFactories ();

        // select all
        for ( final TableItem item : this.factoriesViewer.getTable ().getItems () )
        {
            item.setChecked ( factories.contains ( item.getData () ) );
        }

        // set ignore fields
        this.fieldsViewer.setInput ( this.mergeController.getIgnoreFields () );
    }
}
 
Example 12
Project: Hydrograph   File: FilterHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Gets the field name modify listener.
 * 
 * @param tableViewer
 *            the table viewer
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the field name modify listener
 */
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			int index = (int) source.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			String fieldName = source.getText();
			filterConditions.setFieldName(fieldName);
			
			if(StringUtils.isNotBlank(fieldName)){
				String fieldType = fieldsAndTypes.get(fieldName);
				TableItem item = tableViewer.getTable().getItem(index);
				CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
				if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
					conditionalCombo.setText(filterConditions.getConditionalOperator());
					conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
					new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
				}
			}
			validateCombo(source);
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 13
Project: neoscada   File: MonitorsViewTable.java   Source Code and License 6 votes vote down vote up
public List<DecoratedMonitor> selectedMonitors ()
{
    if ( this.tableRef.get ().getTable ().getSelectionCount () == 0 )
    {
        return new ArrayList<DecoratedMonitor> ();
    }
    final List<DecoratedMonitor> result = new ArrayList<DecoratedMonitor> ();
    for ( final TableItem row : this.tableRef.get ().getTable ().getSelection () )
    {
        if ( row.getData () instanceof DecoratedMonitor )
        {
            result.add ( (DecoratedMonitor)row.getData () );
        }
    }
    return result;
}
 
Example 14
Project: AppleCommander   File: DiskExplorerTab.java   Source Code and License 6 votes vote down vote up
/**
 * Delete the currently selected files.
 */
protected void deleteFile() {
	TableItem[] selection = fileTable.getSelection();

	String message = (selection.length > 1) ?
			textBundle.get("DeletePromptMultipleFiles") : //$NON-NLS-1$
			textBundle.get("DeletePromptSingleFile") //$NON-NLS-1$
			+ textBundle.get("DeletePromptTrailer"); //$NON-NLS-1$
	int answer = SwtUtil.showYesNoDialog(shell,
			textBundle.get("DeletePromptTitle"), //$NON-NLS-1$
			message);
	if (answer == SWT.YES) {
		for (int i=0; i<selection.length; i++) {
			TableItem tableItem = selection[i];
			FileEntry fileEntry = (FileEntry) tableItem.getData();
			fileEntry.delete();
		}
		fillFileTable(currentFileList);
		saveToolItem.setEnabled(true);
	}
}
 
Example 15
Project: gw4e.project   File: OfflineGW4ETestUIPage.java   Source Code and License 6 votes vote down vote up
/**
 * @param context
 * @return
 * @throws CoreException
 */
public OffLinePostConversionImpl createConvertor(ResourceContext context) throws CoreException {
	List<BuildPolicy> selected = new ArrayList<BuildPolicy>();
	TableItem[] items = buildPoliciesViewer.getTable().getItems();
	for (TableItem tableItem : items) {
		if (tableItem.getChecked()) {
			selected.add((BuildPolicy) tableItem.getData());
		}
	}
	BuildPolicy[] policies = new BuildPolicy[selected.size()];
	selected.toArray(policies);
 
	ResourceContext ctx = new ResourceContext(
			context.getContainerFullPath(), 
			gcc.getRoot(), 
			gcc.getPackageFragment(), 
			gcc.getClassName(),
			gcc.getExtendedClassName(),
			context.getSelectedFile(), 
			gcc.getMode(), 
			context.getClassExtension());
	return new OffLinePostConversionImpl(ctx, policies, Integer.parseInt(timeoutText.getText()));
}
 
Example 16
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 6 votes vote down vote up
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, 
		String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener,
		ImagePathConstant imagePath) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Button button = new Button(buttonPane, SWT.NONE);
	//button.setText(columnName);
	button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(columnName, button);
	tableItem.setData(buttonPaneName, buttonPane);
	button.addSelectionListener(buttonSelectionListener);
	button.setImage(imagePath.getImageFromRegistry());
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	button.setData(editorName, editor);
}
 
Example 17
Project: applecommander   File: DiskExplorerTab.java   Source Code and License 6 votes vote down vote up
/**
 * Delete the currently selected files.
 */
protected void deleteFile() {
	TableItem[] selection = fileTable.getSelection();

	String message = (selection.length > 1) ?
			textBundle.get("DeletePromptMultipleFiles") : //$NON-NLS-1$
			textBundle.get("DeletePromptSingleFile") //$NON-NLS-1$
			+ textBundle.get("DeletePromptTrailer"); //$NON-NLS-1$
	int answer = SwtUtil.showYesNoDialog(shell,
			textBundle.get("DeletePromptTitle"), //$NON-NLS-1$
			message);
	if (answer == SWT.YES) {
		for (int i=0; i<selection.length; i++) {
			TableItem tableItem = selection[i];
			FileEntry fileEntry = (FileEntry) tableItem.getData();
			fileEntry.delete();
		}
		fillFileTable(currentFileList);
		saveToolItem.setEnabled(true);
	}
}
 
Example 18
Project: applecommander   File: ImportSelectFilesWizardPane.java   Source Code and License 6 votes vote down vote up
/**
 * Refresh the table of information.
 */
protected void refreshTable() {
	fileTable.removeAll();
	Iterator specs = wizard.getImportSpecifications().iterator();
	boolean canFinish = specs.hasNext();
	while (specs.hasNext()) {
		ImportSpecification spec = (ImportSpecification) specs.next();
		File file = new File(spec.getSourceFilename());
		TableItem item = new TableItem(fileTable, SWT.NULL);
		item.setText(new String[] {
			file.getName(),
			spec.getTargetFilename(),
			spec.getFiletype() });
		item.setData(spec);
		canFinish &= spec.hasFiletype();
	}
	fileTable.redraw();
	wizard.enableFinishButton(canFinish);
}
 
Example 19
Project: Hydrograph   File: AvailableFieldsComposite.java   Source Code and License 6 votes vote down vote up
private void addListnersToSearchTextBox() {
	searchTextBox.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			if(!StringUtils.equals(Constants.DEFAULT_SEARCH_TEXT, searchTextBox.getText())){
			table.removeAll();
			for(String field:inputFields){
				if(StringUtils.containsIgnoreCase(field,searchTextBox.getText())){
					TableItem tableItem = new TableItem(table, SWT.NONE);
					tableItem.setText(0,field);
					tableItem.setText(1, fieldMap.get(field).getSimpleName());
				}
			}
			
			if(table.getItemCount()==0 && StringUtils.isNotBlank(searchTextBox.getText())){
				new TableItem(table, SWT.NONE).setText(Messages.CANNOT_SEARCH_INPUT_STRING+searchTextBox.getText());
			}
		}
			
		}
	});
}
 
Example 20
Project: Hydrograph   File: HiveFieldDialogHelper.java   Source Code and License 6 votes vote down vote up
/**
 * 
 * Compares available fields and selected partition key fields for 
 *   hive input and output components. 
 * 
 */
public boolean compare_fields(TableItem[] items,List<String> sourceFieldsList)
{
	ListIterator<String> t_itr,s_itr;
	boolean is_equal=true;
	
	List<String> target_fields = new ArrayList<String>();
	if(items.length > 0){
		for (TableItem tableItem : items){
			target_fields.add((String) tableItem.getText());
		}
	
	
	List<String> source_field = new ArrayList<String>(sourceFieldsList);
	
	t_itr=target_fields.listIterator(target_fields.size());
	s_itr = source_field.listIterator(source_field.size());
	
	
	while(t_itr.hasPrevious() & s_itr.hasPrevious()){
		if(StringUtils.equals(s_itr.previous(),t_itr.previous())){
			is_equal=true;
		}
		else{
			is_equal=false;
			break;
		}
	}
	}
	return is_equal;
	
}
 
Example 21
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 6 votes vote down vote up
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, 
		String editorName, int columnIndex,	String[] relationalOperators, SelectionListener dropDownSelectionListener,
		ModifyListener modifyListener,FocusListener focusListener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final CCombo combo = new CCombo(buttonPane, SWT.NONE);
	combo.setItems(relationalOperators);
	combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(comboName, combo);
	tableItem.setData(comboPaneName, buttonPane);
	combo.addSelectionListener(dropDownSelectionListener);
	combo.addModifyListener(modifyListener);
	combo.addFocusListener(focusListener);
	new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	combo.setData(editorName, editor);
	return combo;
}
 
Example 22
Project: Hydrograph   File: SchemaRowValidation.java   Source Code and License 6 votes vote down vote up
private void setRedColorOnTableRowBasedOnInvalidData(GridRow gridRow,
		String componentType, TableItem tableItem){
	if(!gridRow.getFieldName().matches(Constants.REGEX)){
		setRedColor(tableItem);
	}
	else if(gridRow instanceof FixedWidthGridRow){
		if(gridRow instanceof GenerateRecordSchemaGridRow){
			executeIfObjectIsGenerateRecordRow(gridRow, componentType, tableItem);
		}else{
			executeIfObjectIsFixedWidthRow(gridRow, componentType, tableItem);
		}
	}
	else if(gridRow instanceof GridRow){
		validationCheckForBigDecimalAndDateDatatype(gridRow, componentType, tableItem);
		if(!isRowInvalid)
		{	
			if(gridRow instanceof XPathGridRow){
				validationCheckForXpathGridRow(gridRow,tableItem);
			}
		}
	}
}
 
Example 23
Project: Hydrograph   File: SchemaRowValidation.java   Source Code and License 6 votes vote down vote up
private void checkIfXPathIsDuplicate( ) {
	Text loopXpathQueryTextBox=(Text)table.getData();
	String loopXPathQuery=loopXpathQueryTextBox.getText();
	Set<Path> setToCheckDuplicates= new HashSet<Path>();
	Set<String> uniqueName=new HashSet<>();
	for(TableItem tableItem:table.getItems()){
		Path xPathColumn=makeXPathAbsoluteIfNot(tableItem.getText(2), loopXPathQuery);
		if(!uniqueName.add(tableItem.getText(0))){
			tableItem.setData(Constants.ERROR_MESSAGE,FIELD_IS_DUPLICATE);
			setRedColor(tableItem);
		}
		else if(!setToCheckDuplicates.add(xPathColumn)){
			tableItem.setData(Constants.ERROR_MESSAGE,Messages.X_PATH_IS_DUPLICATE);
			setRedColor(tableItem);
		}
		else{
			tableItem.setData(Constants.ERROR_MESSAGE,"");
			setBlackColor(tableItem);
		}
	}	
}
 
Example 24
Project: Hydrograph   File: InputFieldColumnLabelProvider.java   Source Code and License 6 votes vote down vote up
@Override
public void update(ViewerCell cell) {
	  TableItem item = (TableItem) cell.getItem();
	  
	  Pattern pattern = Pattern.compile("^[a-zA-Z0-9 _]*$");
		
		if (!pattern.matcher(((InputField)cell.getElement()).getFieldName()).matches()) {
			  item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
			  item.setForeground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
			  ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should match regular expression- \"^[a-zA-Z0-9_]*$\" ");
			  ((InputField)cell.getElement()).getErrorObject().setHasError(true);
	    }else{
	    	
	    	if(((InputField)cell.getElement()).getFieldName().trim().equalsIgnoreCase("")){
	    		item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
	    		((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should not be empty");
				  ((InputField)cell.getElement()).getErrorObject().setHasError(true);
	    	}else{
				  ((InputField)cell.getElement()).getErrorObject().setHasError(false);
	    	}
	    	
	    	
	    }
	super.update(cell);
}
 
Example 25
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 6 votes vote down vote up
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, 
		String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Button button = new Button(buttonPane, SWT.CHECK);
	button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	if(null != buttonSelectionListener){
		button.addSelectionListener(buttonSelectionListener);
	}
	tableItem.setData(columnName, button);
	tableItem.setData(groupPaneName, buttonPane);
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	button.setData(editorName, editor);
}
 
Example 26
Project: Hydrograph   File: InputFieldsComposite.java   Source Code and License 6 votes vote down vote up
private void deleteToolItem(ToolBar toolBar) {
	ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE);
	tltmDelete.setWidth(5);
	tltmDelete.setImage(ImagePathConstant.DELETE_BUTTON.getImageFromRegistry());
	tltmDelete.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			for (TableItem tableItem : inputFieldTable.getSelection()) {
				inputFields.remove(String.valueOf(tableItem.getData()));
			}
			inputFieldTableViewer.refresh();
			dialog.refreshErrorLogs();
			addCusrsorToLastRow();
		}
	});
}
 
Example 27
Project: BiglyBT   File: UIPWListPanel.java   Source Code and License 5 votes vote down vote up
public void updateList() {
  ArrayList list = new ArrayList();
  TableItem[] items = pluginList.getItems();
  for(int i = 0 ; i < items.length ; i++) {
    if(items[i].getChecked())
      list.add(items[i].getData());
  }
  ((UnInstallPluginWizard)wizard).setPluginList(list);
  ((UnInstallPluginWizard)wizard).setFinishEnabled( isFinishEnabled() );

}
 
Example 28
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 5 votes vote down vote up
private void addNewItem() {
    ACL acl = new ACL();
    acl.setId(ZooDefs.Ids.ANYONE_ID_UNSAFE);
    acl.setPerms(ZooDefs.Perms.ALL);

    TableItem newItem = addAclTableItem(acl);
    Table table = getTable();
    table.setSelection(newItem);
    tableSelectionChanged(newItem);

    fireOrchestrationChange();
}
 
Example 29
Project: Hydrograph   File: ViewExecutionHistoryDataDialog.java   Source Code and License 5 votes vote down vote up
/**
 * The Function will set Table column values
 * @param tableViewer
 * @param jobDetails
 */
private void setTableColumnValues(TableViewer tableViewer, List<Job> jobDetails){
	jobDetails.sort((job1, job2)-> job2.getUniqueJobId().compareTo(job1.getUniqueJobId()));
	jobDetails.forEach(job -> {
		String timeStamp = getTimeStamp(job.getUniqueJobId());
    	TableItem items = new TableItem(table, SWT.None);
    	items.setText(0, job.getUniqueJobId());
    	items.setText(1, timeStamp);
    	String mode = getJobExecutionMode(job.isRemoteMode());
    	items.setText(2, mode);
    	items.setText(3, job.getJobStatus());
	});
}
 
Example 30
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 5 votes vote down vote up
private void initIdTableEditor(TableItem item) {

        Control oldEditor = _IdTableEditor.getEditor();
        if (oldEditor != null) {
            oldEditor.dispose();
        }

        if (item == null) {
            return;
        }

        Table table = getTable();

        Text newEditor = new Text(table, SWT.SINGLE);

        newEditor.setText(item.getText(TABLE_COLUMN_ID));
        newEditor.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                Text editor = (Text) _IdTableEditor.getEditor();
                _IdTableEditor.getItem().setText(TABLE_COLUMN_ID, editor.getText());

                fireOrchestrationChange();
            }
        });

        _IdTableEditor.setEditor(newEditor, item, TABLE_COLUMN_ID);
    }
 
Example 31
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License 5 votes vote down vote up
private void removeItems(TableItem[] items) {

        Table table = getTable();
        table.setRedraw(false);
        try {

            for (TableItem item : items) {

                Control schemeTableEditorControl = _SchemeTableEditor.getEditor();
                if (schemeTableEditorControl != null) {
                    schemeTableEditorControl.dispose();
                }

                _SchemeTableEditor.setEditor(null, item, 0);

                Control idTableEditorControl = _IdTableEditor.getEditor();
                if (idTableEditorControl != null) {
                    idTableEditorControl.dispose();
                }

                _IdTableEditor.setEditor(null, item, 1);

                for (int perm : PERMS) {
                    TableEditor tableEditor = getItemPermTableEditor(item, perm);
                    Button checkBox = (Button) tableEditor.getEditor();
                    tableEditor.dispose();
                    checkBox.dispose();
                }

                item.dispose();
            }
        }
        finally {
            table.setRedraw(true);
        }
    }
 
Example 32
Project: bdf2   File: ParameterCellModifier.java   Source Code and License 5 votes vote down vote up
@Override
public void modify(Object element, String property, Object value) {
	SubprocessParameter p=(SubprocessParameter)((TableItem)element).getData();
	if(property.equals("var")){
		p.setVar((String)value);
	}
	if(property.equals("subvar")){
		p.setSubvar((String)value);
	}
	viewer.refresh();
}
 
Example 33
Project: eZooKeeper   File: ZnodeModelStatFormPage.java   Source Code and License 5 votes vote down vote up
private void addStatValueTableItem(Table table, String name, String value, String description) {
    TableItem item = new TableItem(table, SWT.NONE);

    item.setText(0, name);
    item.setText(1, value);
    item.setText(2, description);
}
 
Example 34
Project: neoscada   File: WriteAttributesOperationWizardValuePage.java   Source Code and License 5 votes vote down vote up
@Override
public void modify ( final Object element, final String property, final Object value )
{
    logger.debug ( "Modify Value: {}:{}:{}", new Object[] { element, property, value } );

    final TableItem tableItem = (TableItem)element;

    if ( tableItem.getData () instanceof AttributeEntry )
    {
        final AttributeEntry entry = (AttributeEntry)tableItem.getData ();
        if ( property.equals ( "value" ) )
        {
            entry.setValue ( value.toString () );
        }
        else if ( property.equals ( "name" ) )
        {
            entry.setName ( value.toString () );
        }
        else if ( property.equals ( "value-type" ) )
        {
            final Integer i = (Integer)value;
            final String valueType = WriteAttributesOperationWizardValuePage.this.valueTypeEditor.getItems ()[i];
            for ( final ValueType vt : ValueType.values () )
            {
                if ( vt.label ().equals ( valueType ) )
                {
                    entry.setValueType ( vt );
                }
            }
        }
        this.viewer.update ( entry, WriteAttributesOperationWizardValuePage.this.PROPERTIES );
        dialogChanged ();
    }
}
 
Example 35
Project: neoscada   File: IgnorePage.java   Source Code and License 5 votes vote down vote up
protected Set<String> gatherIgnoredFactories ()
{
    final Set<String> result = new HashSet<String> ();
    for ( final TableItem item : this.factoriesViewer.getTable ().getItems () )
    {
        if ( item.getChecked () )
        {
            final String data = (String)item.getData ();
            result.add ( data );
        }
    }
    return result;
}
 
Example 36
Project: neoscada   File: QueryDataView.java   Source Code and License 5 votes vote down vote up
private void handleUpdateData ( final int index, final Map<String, List<Double>> values, final List<ValueInformation> valueInformation )
{
    // FIXME: implement faster
    final int len = valueInformation.size ();
    for ( int i = 0; i < len; i++ )
    {
        final TableItem item = this.table.getItem ( i + index );

        final double quality = valueInformation.get ( i ).getQuality ();
        final double manual = valueInformation.get ( i ).getManualPercentage ();

        item.setText ( 0, String.format ( Messages.QueryDataView_Format_Index, index + i ) );
        item.setText ( 1, String.format ( Messages.QueryDataView_Format_Quality, quality ) );
        item.setText ( 2, String.format ( Messages.QueryDataView_Format_Manual, manual ) );

        for ( int j = 0; j < this.colNames.length; j++ )
        {
            final List<Double> value = values.get ( this.colNames[j] );
            item.setText ( j + FIX_FRONT_COLS, getValueString ( value.get ( i ) ) );
        }

        item.setText ( this.colNames.length + FIX_FRONT_COLS, "" + valueInformation.get ( i ).getSourceValues () ); //$NON-NLS-1$
        item.setText ( this.colNames.length + FIX_FRONT_COLS + 1, String.format ( Messages.QueryDataView_InfoFormat, valueInformation.get ( i ).getStartTimestamp (), valueInformation.get ( i ).getEndTimestamp () ) );

        if ( quality < 0.33 )
        {
            item.setBackground ( this.invalidColor );
        }
        else
        {
            item.setBackground ( null );
        }

    }
}
 
Example 37
Project: neoscada   File: QueryDataView.java   Source Code and License 5 votes vote down vote up
private void setDataSize ( final int entries, final Set<String> valueTypes )
{
    clearDataSize ();

    this.colNames = valueTypes.toArray ( new String[0] );
    for ( final String valueType : valueTypes )
    {
        final TableColumn col = new TableColumn ( this.table, SWT.NONE );
        col.setText ( valueType );
        col.setWidth ( 100 );
        col.setAlignment ( SWT.RIGHT );
        this.columns.put ( valueType, col );
    }

    this.countCol = new TableColumn ( this.table, SWT.NONE );
    this.countCol.setText ( Messages.QueryDataView_ColValues );
    this.countCol.setWidth ( 40 );

    this.infoCol = new TableColumn ( this.table, SWT.NONE );
    this.infoCol.setText ( Messages.QueryDataView_ColInfo );
    this.infoCol.setWidth ( 150 );

    this.table.clearAll ();
    this.table.setItemCount ( entries );

    for ( int i = 0; i < entries; i++ )
    {
        final TableItem item = this.table.getItem ( i );
        item.setBackground ( this.invalidColor );
        item.setText ( 0, String.format ( Messages.QueryDataView_Format_Index, i ) );
    }
}
 
Example 38
Project: eclipse-plugin-commander   File: KaviList.java   Source Code and License 5 votes vote down vote up
public void initialize(Composite composite, int defaultOrientation) {
	display = composite.getDisplay();
	composite.addDisposeListener((DisposeListener) this::dispose);
	
	tableViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED );
	table = tableViewer.getTable();
	
       GridData gridData = new GridData();
       gridData.verticalAlignment = GridData.FILL;
       gridData.horizontalSpan = 2;
       gridData.grabExcessHorizontalSpace = true;
       gridData.grabExcessVerticalSpace = true;
       gridData.horizontalAlignment = GridData.FILL;
       tableViewer.getControl().setLayoutData(gridData);
	
	tableViewer.setContentProvider((ILazyContentProvider) rowIndex -> tableViewer.replace(contentProvider().getTableEntries().get(rowIndex), rowIndex));
	table.addListener(SWT.Selection, event-> {
		TableItem item = (TableItem) event.item;
		contentProvider().setCursorIndex(contentProvider().getRowIndex((RankedItem<T>) item.getData()));
		handleSelection();
	});
	composite.getShell().addListener(SWT.Resize, event ->  autoAdjustColumnWidths(composite));
	
	// TODO try throttleLast or custom scheduler
	//subjectFilter.debounce(0, TimeUnit.MILLISECONDS).subscribe( filter -> handleRefresh(filter));

}
 
Example 39
Project: eclipse-plugin-commander   File: KaviList.java   Source Code and License 5 votes vote down vote up
private void moveRowCursorUp() {
	Composite composite = table.getParent();
	composite.getShell().setRedraw(false);
	
	final int cursorIndex = contentProvider().moveCursorUp().getCursorIndex();
	if (cursorIndex >= 0) {
		TableItem cursoredTableItem = tableViewer.getTable().getItem(cursorIndex);
		tableViewer.getTable().showItem(cursoredTableItem);
	}
	tableViewer.refresh();
	composite.getShell().setRedraw(true);
}
 
Example 40
Project: eclipse-plugin-commander   File: KaviList.java   Source Code and License 5 votes vote down vote up
private void moveRowCursorDown() {
	Composite composite = table.getParent();
	composite.getShell().setRedraw(false);
	
	final int cursorIndex = contentProvider().moveCursorDown().getCursorIndex();
	if (cursorIndex >= 0) {
		TableItem cursoredTableItem = tableViewer.getTable().getItem(cursorIndex);
		tableViewer.getTable().showItem(cursoredTableItem);
	}
	tableViewer.refresh();
	composite.getShell().setRedraw(true);
}
 
Example 41
Project: gw4e.project   File: SummaryExecutionPage.java   Source Code and License 5 votes vote down vote up
public List<StepDetail> getStepDetails() {
	TableItem[] items = table.getItems();
	List<StepDetail> details = new ArrayList<StepDetail>();
	for (TableItem tableItem : items) {
		StepDetail sd = (StepDetail) tableItem.getData();
		details.add(sd);
	}
	return details;
}
 
Example 42
Project: Hydrograph   File: FindViewDataDialog.java   Source Code and License 5 votes vote down vote up
private void reverseTableTraverse(TableViewer debugDataViewer, TableCursor tableCursor){
	TableItem previousSelectedTableItem = null;
	if(debugDataViewer.getData("SELECTED_ROW_INDEX")!=null){
		previousSelectedTableItem = debugDataViewer.getTable().getItem((int) debugDataViewer.getData("SELECTED_ROW_INDEX"));
		findColIndex -= 1;
	}
	if(findRowIndex < 0){
		findRowIndex = debugDataViewer.getTable().getItems().length - 1;
	}
	Table table = debugDataViewer.getTable();
	TableItem[] tableItems = table.getItems();
	for(; findRowIndex >=0; findRowIndex--){
		TableItem tableItem = tableItems[findRowIndex];
		for( ; findColIndex > 0 ;findColIndex--){
			if(StringUtils.containsIgnoreCase(tableItem.getText(findColIndex), findText.getText())){
				if(prevColSelection > 0){
					previousSelectedTableItem.setBackground(prevColSelection, Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
				}
				label.setVisible(false);
				table.showItem(tableItem);
				table.showColumn(table.getColumn(findColIndex));
				tableCursor.setSelection(findRowIndex, findColIndex);
				tableCursor.setVisible(false);
				tableItem.setBackground(findColIndex,Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
				if(findColIndex<=0){debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex-1);}else{
					debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex);
				}
				debugDataViewer.setData("SEELCTED_COLUMN_INDEX", findColIndex);
				prevColSelection = findColIndex;
				prevRowSelection = findRowIndex;
				return ;
			}
			
		}
		if(findColIndex <= 0){ findColIndex = table.getColumnCount();}
		if(findRowIndex == 0){ findRowIndex = tableItems.length; }
	}
}
 
Example 43
Project: gw4e.project   File: ModelPathGenerator.java   Source Code and License 5 votes vote down vote up
private void updateModelsAndPathGenerators() {
	forceUpdate = true;
	tableViewer.setInput(mainFile);
	TableItem []  all = table.getItems();
	int index=0;
	for (TableItem tableItem : all) {
		ModelData d =  (ModelData) tableItem.getData();
		tableItem.setChecked(additionalExecutionContexts[index++].isSelected());
	}
	for (int i = 0, n = tableViewer.getTable().getColumnCount(); i < n; i++)
		tableViewer.getTable().getColumn(i).pack();
}
 
Example 44
Project: gw4e.project   File: ModelPathGenerator.java   Source Code and License 5 votes vote down vote up
public ModelData[] getModel() {
	List<ModelData> temp = new ArrayList<ModelData>();

	TableItem[] items = tableViewer.getTable().getItems();
	for (int i = 0; i < items.length; i++) {
		TableItem ti = items[i];
		ModelData data = (ModelData) ti.getData();
		temp.add(data);
	}
	ModelData[] ret = new ModelData[temp.size()];
	temp.toArray(ret);
	return ret;
}
 
Example 45
Project: gw4e.project   File: ModelSearchPage.java   Source Code and License 5 votes vote down vote up
private List<String> getModelPropertyNames() throws FileNotFoundException, CoreException, IOException {
	List<IProject> files = new ArrayList<IProject>();

	Stream<TableItem> stream = Arrays.stream(tableProjects.getItems());
	stream.filter(item -> item.getChecked()).map(item -> item.getData())
			.forEach(jp -> files.add(((IJavaProject) jp).getProject()));

	List<String> ret = GraphWalkerFacade.getPropertiesForGraphModels(files);
	if(ret!=null) ret.add(MessageUtil.getString("requirement_property"));
	return ret;
}
 
Example 46
Project: aliyun-maxcompute-data-collectors   File: OdpsOutputDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Called when the user confirms the dialog
 */
private void ok() {
    // The "stepname" variable will be the return value for the open() method.
    // Setting to step name from the dialog control
    stepname = wStepname.getText();
    // Setting the  settings to the meta object
    meta.setEndpoint(m_wEndpoint.getText());
    meta.setTunnelEndpoint(m_wTunnelEndpoint.getText());
    meta.setAccessId(m_wAccessId.getText());
    meta.setAccessKey(m_wAccessKey.getText());
    meta.setProjectName(m_wProjectName.getText());
    meta.setTableName(m_wTableName.getText());
    meta.setPartition(m_wPartition.getText());

    meta.setTruncate(m_wTruncate.getSelection());

    int nrFields = m_wFieldsTable.nrNonEmpty();
    meta.setOdpsFields(new ArrayList<OdpsField>(nrFields));
    meta.setStreamFields(new ArrayList<String>(nrFields));
    for (int i = 0; i < nrFields; i++) {
        TableItem item = m_wFieldsTable.getNonEmpty(i);
        OdpsField odpsField = new OdpsField();
        odpsField.setName(item.getText(1));
        meta.getOdpsFields().add(odpsField);
        meta.getStreamFields().add(item.getText(2));
    }

    // close the SWT dialog window
    dispose();
}
 
Example 47
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 5 votes vote down vote up
private CellLabelProvider getRemoveButtonCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList, 
		final Button btnAddGrp, final TreeMap<Integer, List<List<Integer>>> groupSelectionMap, final boolean isRemote) {
	return new CellLabelProvider() {
		
		@Override
		public void update(ViewerCell cell) {
			final TableItem item = (TableItem) cell.getItem();
			// DO NOT REMOVE THIS CONDITION. The condition is return to
			// prevent multiple updates on single item
			if (item.getData("UPDATED2") == null) {
				item.setData("UPDATED2", TRUE);
			} else {
				return;
			}
			if(OSValidator.isMac()){
				addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(), 
						removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote), 
						ImagePathConstant.MAC_DELETE_BUTTON);
			}else{
				addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(), 
						removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote), 
						ImagePathConstant.DELETE_BUTTON);
			}
			item.addDisposeListener(new DisposeListener() {
				
				@Override
				public void widgetDisposed(DisposeEvent e) {
					Button removeButton = (Button) item.getData(REMOVE);
					((TableEditor)removeButton.getData(REMOVE_EDITOR)).dispose();
					removeButton.dispose();
					
					Composite composite = (Composite)item.getData(REMOVE_BUTTON_PANE);
					composite.dispose();
				}
			});
		}
	};
}
 
Example 48
Project: SWET   File: TableEditorEx.java   Source Code and License 5 votes vote down vote up
@Override
public void modifyText(ModifyEvent event) {
	CCombo combo = (CCombo) event.widget;
	int column = (int) combo.getData("column");
	String oldValue = ((TableItem) combo.getData("item")).getText(column);
	String newValue = combo.getText();
	logger.info(String.format("Updating %s = %s", oldValue, newValue));
	if (selectorFromSWD.containsValue(newValue)) {
		((TableItem) combo.getData("item")).setText(column, newValue);
	}
}
 
Example 49
Project: SWET   File: TableEditorEx.java   Source Code and License 5 votes vote down vote up
private static void appendBlankRowToTable(Table table, TableItem item,
		int index) {

	item.setText(new String[] { String.format("%d", index), "Element name",
			"Action keyword", "", "Selector value" });

	TableEditor keywordChoiceEditor = new TableEditor(table);
	CCombo keywordChoiceCombo = new CCombo(table, SWT.NONE);
	keywordChoiceCombo.setText("Choose..");
	for (String keyword : keywordTable.keySet()) {
		keywordChoiceCombo.add(keyword);
	}
	// NOTE: none of options is initially selected
	keywordChoiceEditor.grabHorizontal = true;
	int keywordChoiceColumn = 2;
	keywordChoiceCombo.setData("column", keywordChoiceColumn);
	keywordChoiceCombo.setData("item", item);
	keywordChoiceEditor.setEditor(keywordChoiceCombo, item,
			keywordChoiceColumn);
	keywordChoiceCombo.addModifyListener(new keywordChoiceListener());

	TableEditor selectorChoiceEditor = new TableEditor(table);
	CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
	selectorChoiceCombo.setText("Choose");
	for (String locator : selectorFromSWD.values()) {
		selectorChoiceCombo.add(locator);
	}
	// NOTE: none of options is initially selected
	selectorChoiceEditor.grabHorizontal = true;
	int selectorChoiceColumn = 3;
	selectorChoiceCombo.setData("item", item);
	selectorChoiceCombo.setData("column", selectorChoiceColumn);
	selectorChoiceEditor.setEditor(selectorChoiceCombo, item,
			selectorChoiceColumn);
	selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
	return;
}
 
Example 50
Project: Hydrograph   File: AvailableFieldsComposite.java   Source Code and License 5 votes vote down vote up
private void loadData() {
	if (inputFields != null) {
		for (String field : inputFields) {
			TableItem tableItem=new TableItem(table, SWT.NONE);
			tableItem.setText(0,field);
			tableItem.setText(1,fieldMap.get(field).getSimpleName());
		}
	}
	if(table.getItemCount()==0){
		searchTextBox.setEnabled(false);
	}
}
 
Example 51
Project: Hydrograph   File: ExpressionEditorUtil.java   Source Code and License 5 votes vote down vote up
private String formatDataToTransfer(TableItem[] selectedTableItems) {
	StringBuffer buffer = new StringBuffer();
	for (TableItem tableItem : selectedTableItems) {
		buffer.append(tableItem.getText() + Constants.FIELD_SEPRATOR_FOR_DRAG_DROP);
	}
	return buffer.toString();
}
 
Example 52
Project: Hydrograph   File: HivePartitionKeyValueDialog.java   Source Code and License 5 votes vote down vote up
/**
  * 
  * @param selectedTableItems
  * @return
  */
private String formatDataToTransfer(TableItem[] selectedTableItems) {
	StringBuffer buffer = new StringBuffer();
	for (TableItem tableItem : selectedTableItems) {
		buffer.append(tableItem.getText() + "#");
	}
	return buffer.toString();
}
 
Example 53
Project: Hydrograph   File: SchemaRowValidation.java   Source Code and License 5 votes vote down vote up
private void validationCheckForXpathGridRow(GridRow gridRow,TableItem tableItem) {
	XPathGridRow xPathGridRow=(XPathGridRow)gridRow;
	String xPath=xPathGridRow.getXPath();
	if(StringUtils.isBlank(xPath)){
		setRedColor(tableItem);
	}else{ 
		checkIfXPathIsDuplicate();
	}
}
 
Example 54
Project: Hydrograph   File: SchemaRowValidation.java   Source Code and License 5 votes vote down vote up
private void validationCheckForBigDecimalAndDateDatatype(GridRow gridRow, String componentType, TableItem tableItem){
	if(StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(), JAVA_MATH_BIG_DECIMAL)){
		validationCheckForBigDecimalDatatype(gridRow, componentType, tableItem);
	}else if(StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(),JAVA_UTIL_DATE)){
		validationCheckForDateDatatype(gridRow, tableItem);	
	}
	else{
		setBlackColor(tableItem);
	}
}
 
Example 55
Project: visuflow-plugin   File: ResultView.java   Source Code and License 5 votes vote down vote up
private void highlightNodesOnGraph(boolean selection) {
	TableItem[] selectedNodes = viewer.getTable().getItems();
	List<VFNode> nodesToFilter = new ArrayList<>();
	for (TableItem tableItem : selectedNodes) {
		if (tableItem.getChecked())
			nodesToFilter.add(new VFNode((VFUnit) tableItem.getData(), 0));
	}
	try {
		ServiceUtil.getService(DataModel.class).filterGraph(nodesToFilter, selection, true, null);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 56
Project: Hydrograph   File: SchemaRowValidation.java   Source Code and License 5 votes vote down vote up
private void executeIfObjectIsGenerateRecordRow(GridRow gridRow, String componentType, TableItem tableItem){

		GenerateRecordSchemaGridRow generateRecordSchemaGridRow = (GenerateRecordSchemaGridRow) gridRow;
		boolean isRedColor = false;
		
		if (StringUtils.isNotBlank(generateRecordSchemaGridRow.getRangeFrom())
				|| StringUtils.isNotBlank(generateRecordSchemaGridRow.getRangeTo())){
			if (StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_UTIL_DATE)){				
				isRedColor = validateSchemaRangeForDate(generateRecordSchemaGridRow);
			}else if (StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_MATH_BIG_DECIMAL)){				
				isRedColor = validateSchemaRangeForBigDecimal(generateRecordSchemaGridRow);
			}else if (StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_LANG_DOUBLE)
					|| StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_LANG_FLOAT)
					|| StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_LANG_INTEGER)
					|| StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_LANG_LONG)
					|| StringUtils.equalsIgnoreCase(generateRecordSchemaGridRow.getDataTypeValue(), JAVA_LANG_SHORT)){				
				isRedColor = validateSchemaRangeForDoubleFloatIntegerLongShort(generateRecordSchemaGridRow);
			}
		}

		if (isRedColor){
			setRedColor(tableItem);
		}else{
			if(StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(), JAVA_MATH_BIG_DECIMAL)){
				validationCheckForBigDecimalDatatype(gridRow, componentType, tableItem);
			}else if(StringUtils.equalsIgnoreCase(gridRow.getDataTypeValue(),JAVA_UTIL_DATE)){
				validationCheckForDateDatatype(gridRow, tableItem);	
			}else{
				setBlackColor(tableItem);
			}
		}
	}
 
Example 57
Project: openaudible   File: BookTable.java   Source Code and License 5 votes vote down vote up
@Override
protected void setTableItems(TableItem item, Book b) {
    super.setTableItems(item, b);

    int index = 0;
    for (TableColumn i : tableColumns) {
        BookTableColumn o = (BookTableColumn) i.getData();
        if (o == BookTableColumn.File) {
            item.setImage(getFileImage(b));
            item.setText("");
        }
    }
}
 
Example 58
Project: Hydrograph   File: DragDropUtility.java   Source Code and License 5 votes vote down vote up
private String addDelimeter(TableItem[] selectedTableItems) {
	StringBuffer buffer = new StringBuffer();
	for (TableItem tableItem : selectedTableItems) {
		buffer.append(tableItem.getText() + "#");
	}
	return buffer.toString();
}
 
Example 59
Project: Hydrograph   File: ELTSWTWidgets.java   Source Code and License 5 votes vote down vote up
private String addDelimeter(String portLabel, TableItem[] selectedTableItems) {
	StringBuffer buffer = new StringBuffer();
	for (TableItem tableItem : selectedTableItems) {
		buffer.append(portLabel + tableItem.getText() + "#");
	}
	return buffer.toString();
}
 
Example 60
Project: Hydrograph   File: DebugDataViewer.java   Source Code and License 5 votes vote down vote up
private Point getCellId(Point mouseLocation,TableViewer tableViewer){
	ViewerCell cell = tableViewer.getCell(mouseLocation);
	if(cell==null){
		return null;
	}
	int columnIndex = cell.getColumnIndex();				
	int rowIndex = tableViewer.getTable().indexOf((TableItem)cell.getItem())  ;
	return new Point(rowIndex, columnIndex);
}