[Easyuploads Add-on] Changing The “ChooseFile” Button Caption

Is the absence of a ’
setButtonCaption
’ method in the UploadField class an oversight or intentional. The default caption is “ChooseFile” – all one word. What if I don’t like that caption?

I detest hacking into other people’s programs to implement a workaround unless I am left with no alternative. But if not a setButtonCaption method, the following would have sufficed:


public class UploadField extends CssLayout implements Field, StartedListener,
		FinishedListener, ProgressListener {

 public UploadField(String caption) {
	this(StorageMode.FILE, caption);
}

public UploadField(StorageMode mode, String caption) {
	...
	upload.setButtonCaption(caption);
}

Life would have been so much easier-- not to mention with get/set Upload methods even.

Thanks

Hi,

The reason for missing method is just because of my lazy nature and limited resources for this project. Too bad I need to work on the core project for 7.5h per day :-(. I’d really love the spend more time on these hobby projects. Luckily you got it for free and without warranty :wink:

I uploaded a new version (0.4.3) into the Directory and it now has a method for changing the button caption. But I gotta warn you. It is 10pm in Finland, I have been working around the clock now and I didn’t test the new build at all. So please, if it doesn’t work - please let me know and I’ll figure out what is wrong tomorrow.

cheers,
matti

Hi Matti,

Tell me about it:I do 10+ hours per day , but thanks for your response and quick update. I am going to use the new feature(s) and if you don’t hear again from me today or tomorrow, then it is working fine!

Thanks again.

Hi Matti Tahvonen,

I don’t know what the design rationale is, for hiding the ‘upload’ variable in the UploadField class. As it stands, one is denied all the features of the com.vaadin.ui.Upload class. May I suggest that, in your next version, you make it visible with (say) a getUpload() method.

Thanks