css of splitbutton inside table not refreshing, table.setEnable(true/false)

Hi Friends,

I have been facing an akward problem since yesterday morning with table component. When I changed table.setEnabled to false or true (e.g table.setEnable(false) or table.setEnable(true) ) split buttons inside the table do not reflect changes, I mean if I do table.setEnabled(true) then still split buttons are grey out and if I do table.setEnabled(false) then still split are not grey out.

Explanation :
On form load only edit button is accessible(see screen-1).

When user click on edit button then add, save and cancel become accessible[button.setEnabled(true)]
and edit becomes unaccessible[setEnabled(false)]
and also table.setEnabled(true) (see screen-2)

The problem is that split button inside table are accessible but still grey out (see in screenshot-2). These split button should not be greyed out.

As soon as I refresh my browser everything is perfect now (see screenshot-3).

I have tested on IE8 and FF6

Thank you for your help

-Shyam
11915.png
11916.png
11917.png

Hi,

I tried to reproduce this and wasn’t able to produce the issue. However, I found a few problems with a disabled SplitButton and fixed those in SplitButton 0.9.5.

Thanks Henri,

I have updated my pom to get latest version.
But… I’m still getting same output.

Anybody else any thought about the problem.

Thanks for your help

Hi Henri,

I have created a demo to find the actual cause. Can you please test this demo on your side.
I have no solution yet… I’m still working on this… It looks the problem is because of super class which is AbstractComponent in case of SplitButton not AbstractField like for normal button.

Looks replacing AbstractComponent with AbstractField for split button work fine… Not sure…

public class SplitButtonBug {

public SplitButtonBug(Window mainWindow) {

	// Main Layout
	VerticalLayout mainLayout = new VerticalLayout();

	mainLayout.setWidth("100%");

	HorizontalLayout topArea = new HorizontalLayout();

	final Button editButton = new Button("Click Here(Button)");
	final Button cancelButton = new Button("Click Here(Button)");
	final Button activateButton = new Button("Activate");
	
	final VerticalLayout buttonarea = new VerticalLayout();
	
	final SplitButton splitButton = new SplitButton("Split Button");
	final PopupButton popupButton = new PopupButton("PopUp Button");

	final Button enableOrDisableButton = new Button("Enable");
	final Button enableOrDisableButton1 = new Button("Enable");

	cancelButton.setEnabled(false);
	activateButton.setEnabled(false);
	//splitButton.setEnabled(false);
	popupButton.setEnabled(false);
	
	buttonarea.setEnabled(false);

	VerticalLayout splitButtonPopup = new VerticalLayout();
	splitButtonPopup.addComponent(enableOrDisableButton);

	splitButton.setComponent(splitButtonPopup);

	VerticalLayout popup = new VerticalLayout();
	popup.addComponent(enableOrDisableButton1);

	popupButton.setComponent(popup);

	editButton.addListener(new ClickListener() {

		@Override
		public void buttonClick(ClickEvent event) {

			activateButton.setEnabled(true);
			//splitButton.setEnabled(true);
			popupButton.setEnabled(true);
			cancelButton.setEnabled(true);

			editButton.setEnabled(false);
			
			buttonarea.setEnabled(true);
			

		}
	});

	cancelButton.addListener(new ClickListener() {

		@Override
		public void buttonClick(ClickEvent event) {

			activateButton.setEnabled(false);
			//splitButton.setEnabled(false);
			popupButton.setEnabled(false);
			cancelButton.setEnabled(false);

			editButton.setEnabled(true);
			
			buttonarea.setEnabled(false);

		}
	});

	topArea.addComponent(editButton);
	topArea.addComponent(cancelButton);
	topArea.addComponent(activateButton);
	//topArea.addComponent(splitButton);
	//topArea.addComponent(popupButton);
	
	buttonarea.addComponent(splitButton);
	buttonarea.addComponent(popupButton);

	mainLayout.addComponent(topArea);
	mainLayout.addComponent(buttonarea);

	mainWindow.addComponent(mainLayout);

}

}

Thanks
-Shyam

Hi Shyam,

Just released version 0.9.6 that should fix your problem with setEnabled;

-Henri

Hi Henri,

Its working now :slight_smile: :slight_smile:

Thank you so much.

-Shyam

Hi Henri,

I have got some more issues with Split Button.

Case 1) Problem: After setting enabled to true from false width of split button automatically shrunk.

Steps
(a) Cilck on the ‘Click Here’ button to make split button accessible

Case 2) Problem: Not displaying popup menu

Steps
(a) Cilck on the ‘Click Here’ button to make split button accessible
(b) Click on the Down arrow of split button (a popup menu will appear)
(c) Click on the ‘Click Here’ button to make split button unaccessible
(d) Again Click on the ‘Click Here’ button to make split button accessible
(e) Click on the Down arrow of split button (no popup)??

Below is the latest code.

Thank you so much for help.

public class SplitButtonBug {

public SplitButtonBug(Window mainWindow) {

	// Main Layout
	VerticalLayout mainLayout = new VerticalLayout();

	mainLayout.setWidth("100%");

	HorizontalLayout topArea = new HorizontalLayout();

	final Button editButton = new Button("Click Here(Button)");
	final Button cancelButton = new Button("Click Here(Button)");
	final Button activateButton = new Button("Activate");

	final VerticalLayout buttonarea = new VerticalLayout();

	final SplitButton splitButton = new SplitButton("Split Button");
	splitButton.setWidth("100%");
	final PopupButton popupButton = new PopupButton("PopUp Button");
	popupButton.setWidth("100%");

	final Button enableOrDisableButton = new Button("Enable");
	final Button enableOrDisableButton1 = new Button("Enable");

	final Button exapandableButton = new Button("Exapandable");
	exapandableButton.setWidth("100%");

	cancelButton.setEnabled(false);
	activateButton.setEnabled(false);
	// splitButton.setEnabled(false);
	popupButton.setEnabled(false);

	buttonarea.setWidth("700px");
	buttonarea.setEnabled(false);

	VerticalLayout splitButtonPopup = new VerticalLayout();
	splitButtonPopup.addComponent(enableOrDisableButton);

	splitButton.setComponent(splitButtonPopup);

	VerticalLayout popup = new VerticalLayout();
	popup.addComponent(enableOrDisableButton1);

	popupButton.setComponent(popup);

	editButton.addListener(new ClickListener() {

		@Override
		public void buttonClick(ClickEvent event) {

			activateButton.setEnabled(true);
			// splitButton.setEnabled(true);
			popupButton.setEnabled(true);
			cancelButton.setEnabled(true);

			editButton.setEnabled(false);

			buttonarea.setEnabled(true);

		}
	});

	cancelButton.addListener(new ClickListener() {

		@Override
		public void buttonClick(ClickEvent event) {

			activateButton.setEnabled(false);
			// splitButton.setEnabled(false);
			popupButton.setEnabled(false);
			cancelButton.setEnabled(false);

			editButton.setEnabled(true);

			buttonarea.setEnabled(false);

		}
	});

	topArea.addComponent(editButton);
	topArea.addComponent(cancelButton);
	topArea.addComponent(activateButton);
	// topArea.addComponent(splitButton);
	// topArea.addComponent(popupButton);

	buttonarea.addComponent(splitButton);
	buttonarea.addComponent(popupButton);
	buttonarea.addComponent(exapandableButton);

	mainLayout.addComponent(topArea);
	mainLayout.addComponent(buttonarea);

	mainWindow.addComponent(mainLayout);

}

}

-Shyam

Hi

I have no solution for earlier posted two issues/bugs. The second problem I mentioned in my last post is also have in PopUpButton.

I have downloaded source code for SplitButton and PopUpButton. Thinking to add them to my source code.

Can anybody lead me to right direction to fix split button problems, I mean which method should I see to fix my problems.

Thank you for your help

Thanks
-Shyam

Looks like you have found nasty bugs from SplitButton and PopupButton. I’ll try take a look at them this week. These bugs need fixes to the client-side code of components. Thank you for the good test application.

-Henri

Thanks Henri,

After fix can you please also post how you fix it … it will help a lot for a newbie like me.

-Shyam

This should be fixed in version 0.9.7.