UWC GUI Disabling Framework

As of v.48

This feature will be available as of Version 48.

Overview

Perhaps you are implementing a feature for your conversion that other people will be using, and it overrides the normal method of getting settings from the UWC's gui. You might be concerned that another user would find unused settings confusing. You might prefer to indicate to the user in some way that the standard interactions with the UWC Gui are different with your particular wiki converter.

Example

The (upcoming) Sharepoint Converter requires a different method of handling spacekeys, as we might need multiple spaces to handle namespace conflicts, since Sharepoint allows multiple wikis from a single sharepoint server. Since the Sharepoint Converter will therefore be automatically detecting spacekey names from the exported sharepoint wikis, we don't want the user to think they can control the spacekey. We want the gui to reflect this difference when the sharepoint converter is the wiki that's chosen, and undo that difference when the sharepoint converter is unchosen.

Usage

guisettings.properties

The file conf/guisettings.properties is where wiki->GuiDisabler class relationships are established.
It looks something like:

## Identify classes used to control gui elements for specific wikis
## Keys should be converter names, identical to the abc in converter.abc.properties
## Values should be classes extending com.atlassian.uwc.ui.guisettings.DefaultGuiDisabler
sharepoint=com.atlassian.uwc.ui.guisettings.SharepointGuiDisabler

Any wiki converter that isn't listed in the guisettings.properties file will use DefaultGuiDisabler, which essentially does nothing.

So, if you wanted to add a GuiDisabler for your wiki you would start by adding a line that looks something like:

mywiki=com.atlassian.uwc.ui.guisettings.MywikiGuiDisabler

DefaultGuiDisabler

Then you would write a java class that extends DefaultGuiDisabler, and shadow the methods you're interested in.

public void converterSelected

This method will be called when the converter is selected in the drop down menu. You will need to at the very least shadow this method, in order to do something useful.

In the SharepointGuiDisabler, this method looks like:

public void converterSelected() {
		Component spacekey = getSpaceKeyComponent();
		JTextField spaceText = (JTextField) spacekey;
		oldkey = spaceText.getText();
		spaceText.setText("");
		spacekey.setEnabled(false);
		this.feedback.updateFeedback("Disabling Spacekey Textfield. Sharepoint Converter will identify spacekeys automatically.\n");
	}
	private Component getSpaceKeyComponent() {
		if (this.spacekey == null) {
			HashMap<String, Component> components = this.gui.getConversionSettingsComponents();
			this.spacekey = components.get("space");
		}
		return this.spacekey;
	}

public void converterUnselected

This method will be called when some other converter is selected in the drop down menu.
It happens before the new wiki's converterSelected method is called.
You do not need to shadow this method. If you choose not to do so, the DefaultGuiDisabler will call it's reset method, which will enable all of the following components:

  • attachments text field
  • attachments browse button
  • pages pane
  • add button
  • remove button
  • add menuitem
  • remove menuitem
  • address textfield
  • login textfield
  • password textfield
  • space textfield

If you are doing something more exotic than just disabling one of the above listed components, you will need to shadow this method and undo whatever it is you did in its converterSelected method.

Fields

You have access to the following two fields:

  • UWCForm3 gui - use to get it's components
  • FeedbackWindow feedback - use to communicate what you are doing to the user via the FeedbackWindow.

Helper methods

UWCForm3's public HashMap<String, Component> getConversionSettingsComponents

You can use this method to get a map of a subset of the GUI's components.
Use the following keys to get the associated component:

  • attachmentsText
  • attachmentsButton
  • pages
  • add
  • remove
  • addMenu
  • removeMenu
  • address
  • login
  • password
  • space
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.