JumpLoader
Java File Upload Applet

Documentation

GUI customization

It is possible to customize Jumploader GUI using different approaches listed below:

  • Customize look and feel (generally applies to all components)
  • Customize particular components using property injection (such as background color, foreground color

Customize look and feel

Look and feel refers to theme, used to render GUI elements. Currently jumploader supports 2 different look and feels:

  • crossPlatform — default look and feel (or "Metal")
  • system — native system look and feel

Look and feel could be set using vc_lookAndFeel applet parameter. Each look and feel maintains table named UIDefaults, which contains named properties used for rendering components, such as label font (Label.font), or scroll bar colors (ScrollBar.highlight, ScrollBar.shadow, ...), etc.

Here is dump of UI defaults for default look and feel generated with JRE 1.6. It is possible to dump UI defaults to java console setting applet parameter vc_dumpUiDefaults to true.

Applet parameter vc_uiDefaults allows override UI defaults, this must be string formatted as follows:
key1=value1;key2=value2;...keyN=valueN

Currently only color and font values are supported:

  • color value should be formatted using patter #rrggbb (i.e. "#ff0000" - red);
  • font value should be formatted using pattern [name][,style][,size] (i.e. "SansSerif,p,12"), where:
    name — font name (such as "Dialog", "Monospaced", "Serif", "SansSerif");
    style — font style, could be one of: "p" (plain), "b" (bold), "i" (italic), "bi" (bold-italic);
    size — the point size of the font

For example, following parameter sets panel background color to light green, label font to plain Tahoma, 12 points:

<param name="vc_uiDefaults" value="
Panel.background=#a7dd6d;
Label.font=Tahoma,p,12"/>

Most properties for particular elements (such as font used for rendering file list labels) explicitly defined in a properties files inside JAR, so setting UI default will not affect them. Property injection should be used in that case.

Below are properties for customizing file chooser (file open dialog triggered by "Add..." menu):

UIManager.put("FileChooser.acceptAllFileFilterText", "Directorios");
UIManager.put("FileChooser.lookInLabelText", "Localização");
UIManager.put("FileChooser.cancelButtonText", "Cancelar");
UIManager.put("FileChooser.cancelButtonToolTipText", "Cancelar");
UIManager.put("FileChooser.openButtonText", "Adicionar");
UIManager.put("FileChooser.openButtonToolTipText", "Adicionar ficheiro(s)");
UIManager.put("FileChooser.filesOfTypeLabelText", "Tipo");
UIManager.put("FileChooser.fileNameLabelText", "Ficheiro(s)");
UIManager.put("FileChooser.listViewButtonToolTipText", "Lista");
UIManager.put("FileChooser.listViewButtonAccessibleName", "Lista");
UIManager.put("FileChooser.detailsViewButtonToolTipText", "Detalhes");
UIManager.put("FileChooser.detailsViewButtonAccessibleName", "Detalhes");
UIManager.put("FileChooser.upFolderToolTipText", "Um nível acima");
UIManager.put("FileChooser.upFolderAccessibleName", "Um nível acima");
UIManager.put("FileChooser.homeFolderToolTipText", "Ambiente de Trabalho");
UIManager.put("FileChooser.homeFolderAccessibleName", "Ambiente de Trabalho"); UIManager.put("FileChooser.fileNameHeaderText", "Nome");
UIManager.put("FileChooser.fileSizeHeaderText", "Tamanho");
UIManager.put("FileChooser.fileTypeHeaderText", "Tipo");
UIManager.put("FileChooser.fileDateHeaderText", "Data");
UIManager.put("FileChooser.fileAttrHeaderText", "Atributos");
UIManager.put("FileChooser.openDialogTitleText","Adicionar Fotos");
UIManager.put("FileChooser.readOnly", Boolean.TRUE);

Customize particular components

Particular components could be customized using property injection, i.e. it is necessary to set property value for particular component. Component and property could be accessed using path, that is translated by applet at runtime. Path, class and description of components depicted in a table below:

Path Class Description
mainView JPanel Main view (top level container)
mainView.programView JPanel Program view (container for local file tree/list views, upload list view)
mainView.programView.fileTreeView JPanel Container for local file tree
mainView.programView.fileTreeView.tree JTree Local file tree component
mainView.programView.fileListView JPanel Container for local file list and location bar
mainView.programView.fileListView.fileList JList Local file list component
mainView.programView.fileListView.locationPanel JPanel Location bar container
mainView.programView.fileListView.lblLocation JLabel Location caption label
mainView.programView.fileListView.txtLocation JTextField Location text field
mainView.programView.uploadView JPanel Upload view container
mainView.programView.uploadView.list JList Upload file list
mainView.programView.uploadView.lblStart JLabel Start upload button
mainView.programView.uploadView.lblStop JLabel Stop upload button
mainView.programView.uploadView.lblListStatus JLabel Upload file list status label
mainView.programView.uploadView.menuBar JMenuBar Upload file list menu bar
mainView.programView.uploadView.menuAdd JMenuItem "Add.." menu item
mainView.programView.uploadView.menuRetry JMenuItem "Retry failed" menu item
mainView.programView.uploadView.menuRemove JMenu "Remove..." menu
mainView.programView.uploadView.menuItemRemoveSelected JMenuItem "Remove..." > "Selected" menu item
mainView.programView.uploadView.menuItemRemoveReady JMenuItem "Remove..." > "Pending" menu item
mainView.programView.uploadView.menuItemRemoveFinished JMenuItem "Remove..." > "Finished" menu item
mainView.programView.uploadView.menuItemRemoveFailed JMenuItem "Remove..." > "Failed" menu item
mainView.programView.uploadView.menuItemRemoveAll JMenuItem "Remove..." > "All" menu item
mainView.programView.uploadView.lblCountReady JLabel Pending item count label
mainView.programView.uploadView.lblCountUploading JLabel Uploading item count label
mainView.programView.uploadView.lblCountFinished JLabel Finished item count label
mainView.programView.uploadView.lblCountFailed JLabel Failed item count label
mainView.programView.uploadView.infoPanel JPanel Container for progress view and upload list status label
mainView.programView.uploadView.cmdPanel JPanel Container for start/stop upload commands and info panel
mainView.programView.uploadView.progressView JPanel Container for upload progress information
mainView.programView.uploadView.progressView.lblProgress JLabel Upload progress bar label
mainView.programView.uploadView.progressView.lblStatus JLabel Upload progress status label (completed, rate)
mainView.programView.uploadView.progressView.lblTimeLeft JLabel Upload progress time left label
mainView.programView.uploadView.fileChooser JFileChooser File choose for upload view (activated on "Add..." menu select)
mainView.imageView JPanel Image editor container
mainView.imageView.imageView JPanel Image view component
mainView.imageView.toolbarView JPanel Image editor toolbar
mainView.imageView.toolbarView.cmdSaveChanges JButton Save changes button
mainView.imageView.toolbarView.cmdDiscardChanges JButton Save changes button
mainView.imageView.toolbarView.cmdRotateCw JButton Rotate clockwise button
mainView.imageView.toolbarView.cmdRotateCcw JButton Rotate counterclockwise button
mainView.imageView.toolbarView.cmdCrop JButton Crop button
mainView.imageView.toolbarView.cmdResize JButton Resize button
mainView.imageView.toolbarView.cmdFilters JButton Filters popup menu trigger button
mainView.imageView.toolbarView.popupFilters JPopupMenu Filters popup menu
mainView.imageView.toolbarView.menuItemFilterGrayscale JMenuItem Grayscale filter menu item
mainView.imageView.toolbarView.menuItemFilterSepia JMenuItem Sepia filter menu item
mainView.imageView.toolbarView.menuItemFilterGblur JMenuItem Blur filter menu item
mainView.imageView.toolbarView.menuItemFilterContrast JMenuItem Brightness/contrast filter menu item
mainView.imageView.toolbarView.zoomIconLabel JLabel Zoom label
mainView.imageView.toolbarView.zoomSlider JSlider Zoom slider
mainView.imageView.toolbarView.zoomInput JTextField Zoom percent text field

All the components derived from javax.swing components, this all the accessor methods could be used that defined as public for particular class. Accessor methods are:

  • getter — the method for reading property, that starts with "get", have no arguments and returns property value, for example: getBackground();
  • setter — the method for writing proeprty, that starts with "set", have single argument and returns no value.

For example, all the swing components (JPanel, JLabel, JTextField, etc.) are derived from JComponent, and JComponent has following useful properties:

  • toolTipText
  • background
  • font
  • visible
  • opaque

Applet has adapter methods, that allows access properties:

  • public String injectProperty( String property, String value ) — calls setter for last comonent in the path, for example following call:
    applet.setProperty("mainView.programView.fileListView.txtLocation.text", "Hello")
    equals to
    applet.getMainView().getProgramView().getFileListView().getTxtLocation().setText("Hello")
    This method returns null, if property injection succeeded, or error message (logged to console too), if failed (i.e. due to invalid property path).
  • public Object getProperty(String property) — retrieves getter result for last component in the path.

Using adapter method from javascript is preffered, because applet internally translates string value into type required by property setter. It is possible to inject properties at startup using ac_properties parameter, its value must be formatted using pattern:
property1=value1;property2=value2;...propertyN=valueN

Check GUI appearance management demo.

advertising WebFM — easy and efficient web file manager.