Class NamePage

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public final class NamePage
    extends javax.swing.JPanel
    A standard page for gathering a plug-in's name, description, icon, file names, and location in a plug-in wizard.
    Since:
    3.0
    Author:
    Chris Jennings
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      NamePage​(Task task, WizardModel model)
      Creates new wizard dialog page for gathering basic information about a plug-in.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getBundleFileName()
      Returns the file name for the plug-in bundle, without an extension.
      java.lang.String getBundleFileNameExtension()
      Returns the file name extension for the plug-in bundle, including the leading dot.
      java.lang.String getClassFileName()
      Returns the compiled class name, with the .java.
      java.lang.String getClassName()
      Returns the compiled class name, without any .java or .class extension.
      java.lang.String getDefaultPath()
      Returns a default path to use as the plug-in location.
      java.lang.String getPath()
      Returns the path where plug-in files should be stored.
      java.io.File getPathAsFile​(java.io.File parent)
      Returns the location where plug-in files should be stored as a file.
      java.lang.String getPathAsResource()
      Returns the path value as a resource identifier.
      java.lang.String getPluginDescription()
      Returns the description of the plug-in, theme, or library.
      java.awt.image.BufferedImage getPluginIconImage()
      Returns the selected representative image, or null if no image is set.
      java.lang.String getPluginName()
      Returns the name of the plug-in, theme, or library.
      ContentType getPluginType()
      Returns the type of plug-in that the dialog is formatted for.
      java.lang.String getScriptFileName()
      Returns the script file name, including the .js extension.
      boolean isCompiledClassMode()
      Returns true if the dialog is set up to create a compiled class plug-in instead of a script-based plug-in.
      void setBundleFileName​(java.lang.String bundle)
      Sets the name of the plug-in bundle file.
      void setClassName​(java.lang.String name)
      Sets the class name for a compiled plug-in.
      void setCompiledClassMode​(boolean compiledCodeMode)
      Sets whether the plug-in described by the page will be compiled instead of script-based.
      void setPath​(java.lang.String location)
      Sets the path or package name in the bundle where the plug-in files will be stored.
      void setPluginDescription​(java.lang.String description)
      Sets the description of the plug-in, theme, or library.
      void setPluginIconImage​(java.awt.image.BufferedImage image)
      Sets the image to use as the representative image for the plug-in, theme, or library.
      void setPluginName​(java.lang.String name)
      Sets the name of the plug-in, theme, or library.
      void setPluginType​(ContentType type)
      Updates the controls to represent a particular type of plug-in.
      void setScriptFileName​(java.lang.String name)
      Sets the script file name for a script-based plug-in.
      void writePluginIcon​(java.io.File dest)
      Writes the selected representative image as a PNG image file to the specified destination.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NamePage

        public NamePage​(Task task,
                        WizardModel model)
        Creates new wizard dialog page for gathering basic information about a plug-in.
        Parameters:
        task - the task that was passed to the PluginWizardDialog.WizardKit, or null
        model - the model that the page will be used in
    • Method Detail

      • setCompiledClassMode

        public void setCompiledClassMode​(boolean compiledCodeMode)
        Sets whether the plug-in described by the page will be compiled instead of script-based.
        Parameters:
        compiledCodeMode - if true, the dialog will be set up to support compiled code
      • isCompiledClassMode

        public boolean isCompiledClassMode()
        Returns true if the dialog is set up to create a compiled class plug-in instead of a script-based plug-in.
        Returns:
        true if the plug-in is based on compiled Java code
      • setPluginType

        public void setPluginType​(ContentType type)
        Updates the controls to represent a particular type of plug-in.

        Setting the type to LIBRARY will hide the script/class name and location fields since libraries do not include plug-in code. You can still query the dialog for these values, but they will be useless.

        Parameters:
        type - the type of plug-in to format the dialog for
        Throws:
        java.lang.NullPointerException - if the type is null
        java.lang.IllegalStateException - if the type is THEME and compiled class mode is not set
      • getPluginType

        public ContentType getPluginType()
        Returns the type of plug-in that the dialog is formatted for.
        Returns:
        the type of plug-in being created
      • setPluginName

        public void setPluginName​(java.lang.String name)
        Sets the name of the plug-in, theme, or library. Changing the plug-in name will set default values for the script/class name and bundle file name, so if you wish to set these also you should do so after setting name.
        Parameters:
        name - the value to set in the name field
      • getPluginName

        public java.lang.String getPluginName()
        Returns the name of the plug-in, theme, or library.
        Returns:
        the value of the name field
      • setPluginDescription

        public void setPluginDescription​(java.lang.String description)
        Sets the description of the plug-in, theme, or library.
        Parameters:
        description - the value to set in the description field
      • getPluginDescription

        public java.lang.String getPluginDescription()
        Returns the description of the plug-in, theme, or library.
        Returns:
        the value of the description field
      • setPluginIconImage

        public void setPluginIconImage​(java.awt.image.BufferedImage image)
        Sets the image to use as the representative image for the plug-in, theme, or library.
        Parameters:
        image - an image to use, or null
      • getPluginIconImage

        public java.awt.image.BufferedImage getPluginIconImage()
        Returns the selected representative image, or null if no image is set.
        Returns:
        the selected representative image
      • writePluginIcon

        public void writePluginIcon​(java.io.File dest)
                             throws java.io.IOException
        Writes the selected representative image as a PNG image file to the specified destination. If no image is selected, the method has no effect.
        Parameters:
        dest - the location where the image should be written
        Throws:
        java.io.IOException - if an error occurs while writing
      • setBundleFileName

        public void setBundleFileName​(java.lang.String bundle)
        Sets the name of the plug-in bundle file. The file name should not include an extension.
        Parameters:
        bundle - the name of the bundle file
      • getBundleFileName

        public java.lang.String getBundleFileName()
        Returns the file name for the plug-in bundle, without an extension.
        Returns:
        the bundle file name
        See Also:
        getBundleFileNameExtension()
      • setScriptFileName

        public void setScriptFileName​(java.lang.String name)
        Sets the script file name for a script-based plug-in. If the name includes the .js extension, this is removed before copying the name into the script name field.
        Parameters:
        name - the script file name, without extension
        Throws:
        java.lang.IllegalStateException - if the dialog is set to compiled code mode
      • getScriptFileName

        public java.lang.String getScriptFileName()
        Returns the script file name, including the .js extension.
        Returns:
        the script file name
        Throws:
        java.lang.IllegalStateException - if the dialog is set to compiled code mode
      • setClassName

        public void setClassName​(java.lang.String name)
        Sets the class name for a compiled plug-in. If the name includes the .java or .class extension, this is removed before copying the name into the class name field.
        Parameters:
        name - the class file name, without extension
        Throws:
        java.lang.IllegalStateException - if the dialog is not set to compiled code mode
      • getClassName

        public java.lang.String getClassName()
        Returns the compiled class name, without any .java or .class extension.
        Returns:
        the class file name
        Throws:
        java.lang.IllegalStateException - if the dialog is not set to compiled code mode
      • getClassFileName

        public java.lang.String getClassFileName()
        Returns the compiled class name, with the .java.
        Returns:
        the class file name
        Throws:
        java.lang.IllegalStateException - if the dialog is not set to compiled code mode
      • getDefaultPath

        public java.lang.String getDefaultPath()
        Returns a default path to use as the plug-in location. The path will use the value of the project's Project.KEY_RESOURCE_ID settings, if available, to create the name of a default resources subfolder. (If this setting is undefined, a default value is used that may be platform and/or user specific.)
        Returns:
        a default location
      • setPath

        public void setPath​(java.lang.String location)
        Sets the path or package name in the bundle where the plug-in files will be stored. The path may be slash-separated or dot-separated; it will be converted to slash-separated.
        Parameters:
        location - a package name or bundle file path
      • getPath

        public java.lang.String getPath()
        Returns the path where plug-in files should be stored. If you require a Java package name, replace slashes in the returned path with dots.
        Returns:
        the location for plug-in files
      • getPathAsFile

        public java.io.File getPathAsFile​(java.io.File parent)
        Returns the location where plug-in files should be stored as a file. The returned file will represent the current plug-in path relative to the specified parent file. If the parent file is null, then the task folder will be used if a non- null Task was provided to the constructor.
        Parameters:
        parent - the parent file that the path is relative to, or null to use the task folder
        Returns:
        the path as a child of the parent file
        Throws:
        java.lang.IllegalStateException - if the parent is null and a null task was set when the page was constructed
      • getPathAsResource

        public java.lang.String getPathAsResource()
        Returns the path value as a resource identifier. (If you need this value as a URL, prepend res:// to the start of the returned string.)

        Example:
        String imgCode = "ResourceKit.getImage( \"" + page.getPathAsResource() + "/myimage.png\" );"

        Returns:
        the base resource name for resources stored in the plug-in's location