Determines whether the celleditor is editable.

Source: Internet
Author: User
Class tableviewereditingsupport extends editingsupport {


Int column;
Private tableviewer columnviewer;
Private celleditor editor;

Public tableviewereditingsupport (columnviewer viewers, int column ){
Super (viewers );
This. columnviewer = (tableviewer) viewers;
Switch (column ){
Case 0:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
Case 1:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;

Case 2:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border | SWT. read_only );
Break;
Case 3:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border | SWT. read_only );
Break;
Case 4:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
Case 5:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
}
This. Column = column;
}

/** This method controls whether celleditor is editable.
@ Override
Protected Boolean canedit (object element ){
/** Convert [element] to the solution object [solution ]*/
// Execute the judgment. If a project is easy to be edited, false is directly returned if it is not editable. If index is set to 1 or 2, No editing is allowed.
/** Call the springutil. getprojectlistdao method to obtain the iprojectlistdao object and call its findbysolution method to pass in the solution. Solutionid: place the obtained result to the list object templist */
/** Determine [templist]. If the part is empty, false is returned */
/** If the index is 1 or 2, false is returned */
Pmsolution solution = (pmsolution) element;
/**
* If the solution ID is blank, you can directly edit the new solution.
*/
If (! Stringutil. isnullorempty (solution. getsolutionid ()))
{
If (column = 2 | column = 3 ){
Return false; // if false is returned, it cannot be edited.
}
}
Return true; // return true to editable
}

Determines whether the celleditor is editable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.