Is it possible to disable CTabItem in CTabFolder? - eclipse-plugin

I have created such CTabFolder in swt:
folder = new CTabFolder(group, SWT.PUSH);
and added some items:
CTabItem tab1 = new CTabItem(folder, SWT.NONE);
CTabItem tab2 = new CTabItem(folder, SWT.NONE);
CTabItem tab3 = new CTabItem(folder, SWT.NONE);
tab1.setText("Tab 1");
tab2.setText("Tab 2");
tab3.setText("Tab 3");
tab1.setControl(CreateFirstGroup(folder, "Type 1"));
tab2.setControl(CreateFirstGroup(folder, "Type 2"));
tab3.setControl(CreateFirstGroup(folder, "Type 3"));
and I'm trying to disable items of this group:
for (int i = 0; i < folder.getChildren().length; i++) {
folder.getChildren()[i].setEnabled(false);
}
but all tabs are still clickable. Maybe it is possible to enable/disable items?

Related

RDLC Design, A column of Row number showing extra value

My rdlc report is working fine. but displaying 0 that i need to remove. please help. attached screenshot describe the design problem.enter image description here
C# code
protected void GenerateReport()
{
if (Request.QueryString["rdlcrepname"] != null)
{
reportName = Request.QueryString["rdlcrepname"].ToString();
string strprm1 = Request.QueryString["prm1"].ToString();
var strprm2 = Request.QueryString["param2"] != null ? Convert.ToInt32(Request.QueryString["param1"].ToString()) : 0 ;
SqlParameter[] clsParam = new SqlParameter[2];
clsParam[0] = new SqlParameter("#param1", strprm1);
clsParam[1] = new SqlParameter("#param2", strprm2);
ds = dataAccess.GetDataSet("spname", clsParam);
dsShow.Tables.Add();
dsShow.Tables.Add("FinalDisplayDataHeader");
dsShow.Tables.Add("FinalDisplayData");
//DataColumns-Header SQL of Header
dsShow.Tables["FinalDisplayDataHeader"].Columns.Add("col1", typeof(string));
dsShow.Tables["FinalDisplayDataHeader"].Columns.Add("col2", typeof(string));
dsShow.Tables["FinalDisplayDataHeader"].Columns.Add("col3", typeof(string));
dsShow.Tables["FinalDisplayDataHeader"].Columns.Add("col4", typeof(string));
//DataColumns SQL of data
dsShow.Tables["FinalDisplayData"].Columns.Add("col1", typeof(string));
dsShow.Tables["FinalDisplayData"].Columns.Add("col2", typeof(string));
dsShow.Tables["FinalDisplayData"].Columns.Add("col3", typeof(string));
if (ds.Tables["Table"].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables["Table"].Rows.Count; i++)
{
dsQPUDisplay.Tables["FinalDisplayDataHeader"].Rows.Add(); //Header
dsShow.Tables["FinalDisplayDataHeader"].Rows[i]["col1"] = ds.Tables["Table"].Rows[i]["col1"].ToString();
dsShow.Tables["FinalDisplayDataHeader"].Rows[i]["col2"] = ds.Tables["Table"].Rows[i]["col2"].ToString();
dsShow.Tables["FinalDisplayDataHeader"].Rows[i]["col3"] = ds.Tables["Table"].Rows[i]["col3"].ToString();
dsQPUDisplay.Tables["FinalDisplayDataHeader"].Rows[i]["col4"] = ds.Tables["Table"].Rows[i]["col4"].ToString();
for (int k = 0; k < 4; k++)
{
dsShow.Tables["FinalDisplayData"].Rows.Add(); //Data
dsShow.Tables["FinalDisplayData"].Rows[k]["col1"] = ds.Tables["Table1"].Rows[k]["col1"].ToString();
dsShow.Tables["FinalDisplayData"].Rows[k]["col2"] = ds.Tables["Table1"].Rows[k]["col2"].ToString();//This is right
dsShow.Tables["FinalDisplayData"].Rows[k]["col3"] = ds.Tables["Table1"].Rows[k]["col3"].ToString();
}
}
reportPath = string.Empty;
rdlcReportViewer.LocalReport.ReportPath = GetReportPath(reportName);
//rdlcReportViewer.LocalReport.DataSources.Clear();
ReportDataSource rdsHeader = new ReportDataSource("DataHeader", dsShow.Tables["FinalDisplayDataHeader"]);
ReportDataSource rdsData = new ReportDataSource("Data", dsShow.Tables["FinalDisplayData"]);
rdlcReportViewer.LocalReport.DataSources.Add(rdsQPUheader);
rdlcReportViewer.LocalReport.DataSources.Add(rdsQPUData);
}// for complete batch students loop closed
rdlcReportViewer.DataBind();
rdlcReportViewer.LocalReport.Refresh();
}
}
RDLC is in design. code above give you idea how i am generating the rdlc report. enter image description here this link describe issue of RowNumber display
My issue got resolved by enabling regional formatting option of the particular textbox. Click on the link to view image

Google Apps Script Sheet Looping Issue

I'm having issues with the GAS code below. The purpose is to iterate through all available sheets and create the drop-down boxes/ validation rules I would need to make an easy-to-edit form.
The main issue is that the code only runs once per sheet and it never applies itself to any other sheet except the active one; ie. it won't cycle to the next available sheet.
function FailureSauce() {
var ss = SpreadsheetApp.getActive();
for(var n in ss.getSheets()) { // loop over all tabs in the spreadsheet
var sheet = ss.getSheets()[n]; // look at every sheet in spreadsheet
var option = new Array();
option[0]="☐";
option[1]="☑";
//var dv = sheet.getRange(myRange.getRow(),myRange.getColumn()+1).getValidation();
var dv = SpreadsheetApp.getActiveSheet().getRange(SpreadsheetApp.getActiveRange().getRow(),SpreadsheetApp.getActiveRange().getColumn()).getDataValidation();
var dv = SpreadsheetApp.newDataValidation();
//dv.setAllowInvalidData(false);
dv.setAllowInvalid(false);
dv.setHelpText("Please choose of the options given in the drop down box");
dv.requireValueInList(option, true);
for (var i = 9; i <= SpreadsheetApp.getActiveSpreadsheet().getLastRow(); i++) {
for (var y = 1; y < 4; y++) {
SpreadsheetApp.getActiveSheet().getRange(i,y).setFontFamily("Arial")
SpreadsheetApp.getActiveSheet().getRange(i,y).setFontSize(10)
if (SpreadsheetApp.getActiveSheet().getRange(i,y).isBlank()) {
//SpreadsheetApp.getActiveSheet().getRange(i,y).setValue('=if(A2=1,image("http://i.stack.imgur.com/GChKZ.jpg"),image("http://i.stack.imgur.com/yQalm.jpg"))');
//sheet.getRange(SpreadsheetApp.getActiveSheet().getRow(),SpreadsheetApp.getActiveSheet().getColumn()).setDataValidation(dv.build());
SpreadsheetApp.getActiveSheet().getRange(i,y).setDataValidation(dv.build());
}
if (SpreadsheetApp.getActiveSheet().getRange(i,y).getValues() == "a") {
//SpreadsheetApp.getActiveSheet().getRange(i,y).setValue('=image("http://i.stack.imgur.com/GChKZ.jpg")');
SpreadsheetApp.getActiveSheet().getRange(i,y).setDataValidation(dv.build());
SpreadsheetApp.getActiveSheet().getRange(i,y).setValue("☑")
}
}
}
}
}
You should probably replace SpreadsheetApp.getActiveSheet() with your variable sheet.
function FailureSauce() {
var dv,option,ss,sheet;
ss = SpreadsheetApp.getActiveSpreadsheet();
for(var n in ss.getSheets()){// loop over all tabs in the spreadsheet
sheet = ss.getSheets()[n];// look at every sheet in spreadsheet
Logger.log('name: ' + sheet.getName());
option = new Array();
option[0]="☐";
option[1]="☑";
// var dv = sheet.getRange(myRange.getRow(),myRange.getColumn()+1).getValidation();
dv = sheet.getRange(SpreadsheetApp.getActiveRange().getRow(),SpreadsheetApp.getActiveRange().getColumn()).getDataValidation();
dv = SpreadsheetApp.newDataValidation();
// dv.setAllowInvalidData(false);
dv.setAllowInvalid(false);
dv.setHelpText("Please choose of the options given in the drop down box");
dv.requireValueInList(option, true);
for (var i = 9; i <= SpreadsheetApp.getActiveSpreadsheet().getLastRow(); i++) {
for (var y = 1; y < 4; y++) {
sheet.getRange(i,y).setFontFamily("Arial")
sheet.getRange(i,y).setFontSize(10)
if (sheet.getRange(i,y).isBlank()){
// sheet.getRange(i,y).setValue('=if(A2=1,image("http://i.stack.imgur.com/GChKZ.jpg"),image("http://i.stack.imgur.com/yQalm.jpg"))');
// sheet.getRange(sheet.getRow(),sheet.getColumn()).setDataValidation(dv.build());
sheet.getRange(i,y).setDataValidation(dv.build());
}
if (sheet.getRange(i,y).getValues() == "a"){
// sheet.getRange(i,y).setValue('=image("http://i.stack.imgur.com/GChKZ.jpg")');
sheet.getRange(i,y).setDataValidation(dv.build());
sheet.getRange(i,y).setValue("☑")
}
}
}
}
}

JFace TableViewer get multiple selected rows

I want to add a listener to the select button which gets the multiple rows selected in the checklist tableviewer. It then proccedes to check those boxes.
My question is how do I get the list of rows selected in the tableviewer?
Here is the code for the table:
private void createCheckViewer(Composite parent){
tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI| SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
if ( (GanttFrame.getListOfFunctionTasks()!= null)){
if (!(GanttFrame.getListOfFunctionTasks().isEmpty())){
// Data Rows
for (int i = 0; i < GanttFrame.getListOfFunctionTasks().size(); i++) {
tableViewer.add(GanttFrame.getListOfFunctionTasks().get(i));
GanttFrame.getListOfFunctionTasks().get(i).setCheckId(i);
}
}
}
// flow trace or function trace
String columnHeader;
if (TraceData.getFlowTraceFlag()){
columnHeader = "Flow Traces";
}else{
columnHeader = "Function Traces";
}
// define layout for the viewer
gridData = new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1);
gridData.heightHint = 400;
tableViewer.getControl().setLayoutData(gridData);
tableViewer.addCheckStateListener(this.getCheckListListener());
final Table table = tableViewer.getTable();
TableLayout layout = new TableLayout();
TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.LEAD);
col.getColumn().setText(columnHeader);
layout.addColumnData(new ColumnWeightData(500));
table.setLayout(layout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
}
Use:
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
You then have various choices for processing the selection:
Object [] selections = selection.toArray();
List<?> selections = selection.toList();
Iterator<?> iterator = selection.iterator();

Output values from selenium webdriver to excel sheet

I am using selenium webdriver to output first three records by using the Advanced Search of Linkedin in an excel sheet however I am not getting all the values of 'name' and 'description' fields except one. Please look into this
public void testExport() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.id("session_key-login")).clear();
driver.findElement(By.id("session_key-login")).sendKeys("#####");
driver.findElement(By.id("session_password-login")).clear();
driver.findElement(By.id("session_password-login")).sendKeys("#####");
Thread.sleep(1000);
driver.findElement(By.xpath("//input[#value='Sign In']")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(By.id("advanced-search")).click();
driver.findElement(By.id("adv-O-N-ffs")).click();
new Select(driver.findElement(By.id("advscountryCode"))).selectByVisibleText("United States");
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/legend")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/div/button")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/input")).sendKeys("Leadmd");
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='pagekey-voltron_federated_search_internal_jsp']/div[1]/div/div[2]/ul/li[1]/img")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/div/button")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/input")).sendKeys("cloudwords");
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='pagekey-voltron_federated_search_internal_jsp']/div[1]/div/div[2]/ul/li[1]/img")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/div/button")).click();
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='adv-facet-CC']/fieldset/div/div/input")).sendKeys("Grazitti");
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='pagekey-voltron_federated_search_internal_jsp']/div[1]/div/div[2]/ul/li[1]/img")).click();
Thread.sleep(1000);
driver.findElement(By.id("advs-title")).sendKeys("Marketing");
driver.findElement(By.name("submit")).click();
Thread.sleep(1000);
String name, designation;
for(int i = 0; i < 3; i++) {
int j = i + 1 ;
name = driver.findElement(By.xpath(".//*[#id='results']/li["+j+"]/div/h3/a")).getText();
System.out.println("data1 = " + name);
designation = driver.findElement(By.xpath(".//*[#id='results']/li["+j+"]/div/p")).getText();
System.out.println("data2 = " + designation);
File fExcel = new File("C:\\Users\\Master\\Desktop\\new.xls");
WritableWorkbook writableBook = Workbook.createWorkbook(fExcel);
writableBook.createSheet("Data", 0);
WritableSheet writableSheet = writableBook.getSheet(0);
Label data1 = new Label(j, 1, name);
writableSheet.addCell(data1);
Label data2 = new Label(j, 1, designation);
writableSheet.addCell(data2);
writableBook.write();
writableBook.close();
}
}
You are creating a new Excel file effectively overwriting the previous one by creating the sheet inside the for loop.
Try modifying the for loop part of your code as below
File fExcel = new File("C:\\Users\\Master\\Desktop\\new.xls");
WritableWorkbook writableBook = Workbook.createWorkbook(fExcel);
writableBook.createSheet("Data", 0);
WritableSheet writableSheet = writableBook.getSheet(0);
for(int i = 0; i < 3; i++) {
int j = i + 1 ;
name = driver.findElement(By.xpath(".//*[#id='results']/li["+j+"]/div/h3/a")).getText();
System.out.println("data1 = " + name);
designation = driver.findElement(By.xpath(".//*[#id='results']/li["+j+"]/div/p")).getText();
System.out.println("data2 = " + designation);
Label data1 = new Label(j, i, name);
writableSheet.addCell(data1);
Label data2 = new Label(j, i, designation);
writableSheet.addCell(data2);
}
writableBook.write();
writableBook.close();
Also new Label (j,1,name) means data is getting added to the first row one after other.
You may change it too new Label (j,i,name) so that each name-designation pair will be added to a new row.
Let me know if this helps you

Merging and grouping libraries code problem

I'm writing C# code to merge multiple libraries within a site collection and applying grouping on them. But grouping doesn't include documents from other sites regardless all share same meta data. Below, Blue box docs are from one site and green box docs are from other site and they don't group together.
Here are my code ,
DataTable dt = new DataTable();
DataRow dr;
DataColumn dc;
SPSite curSite = SPContext.Current.Site;
SPWebCollection subSites = curSite.AllWebs;
dc = new DataColumn("Title", Type.GetType("System.String"));
dt.Columns.Add(dc);
dc = new DataColumn("ReferenceNo", Type.GetType("System.String"));
dt.Columns.Add(dc);
dc = new DataColumn("Domain", Type.GetType("System.String"));
dt.Columns.Add(dc);
dc = new DataColumn("Created", Type.GetType("System.DateTime"));
dt.Columns.Add(dc);
for (int i = 0; i < subSites.Count; i++)
{
SPListCollection lists = subSites[i].Lists;
foreach (SPList list in lists)
{
if (list.Title == "Published Documents")
{
SPQuery myquery = new SPQuery();
//myquery.Query = "<GroupBy><FieldRef Name='Domain' /></GroupBy><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy>";
myquery.Query = "<GroupBy><FieldRef Name='Domain' /></GroupBy>";
SPListItemCollection items = list.GetItems(myquery);
foreach (SPListItem item in items)
{
if (item != null)
{
dr = dt.NewRow();
dr["Title"] = item["Title"];
dr["ReferenceNo"] = item["ReferenceNo"];
dr["Domain"] = item["Domain"];
dr["Created"] = item["Created"];
dt.Rows.Add(dr);
}
}
}
}
}
//dt.DefaultView.Sort = "Created DESC";
spGridView.AllowGrouping = true;
spGridView.AllowGroupCollapse = true;
spGridView.GroupField = "Domain";
spGridView.DataSource = dt;
spGridView.DataBind();
Updates:: , Sorting Data Table with Domain fixed the issue..
**dt.DefaultView.Sort = "Domain";**
Rishi's answer:
Sorting Data Table with Domain fixed the issue..
dt.DefaultView.Sort = "Domain";
naveed's comment:
Perfect it worked for me. all goes well just we need to have
dt.DefaultView.Sort = "Your Sorting Attribute";