Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-6471

Border Customizer / border properties and auto-generated code missing

    XMLWordPrintableJSON

Details

    Description

      This might be a combination of several issues, I'm not sure.

      Ever since switching from a 'last known working' NB version 5 or 7 to 11.2, opening, editing and compiling some existing UI projects, there are some weird effects.

      The project setup is 'unconventional'; the UI is created with NB in a different workspace from the business code (where Eclipse is used) and the compiled project/JAR's are then imported there. In turn, some UI extension code is developed and imported from the Eclipse workspace, e. g. a class 'LabelBorder' (which inherits from class 'TitledBorder', only rendering the upper titled border as a visual divider) and provided to the NB project as a JAR.

      Don't ask why.

      One of the detrimental effects is, that border label's title/name values are lost from PanelUI components inside a GridBagLayout on a parent JPanel, in the compiled version from NB.

      For some such visual 'LabelBorder' divider sub-components, the 'border' attribute in the properties view is printed bold. For those, the Border Customizer via [...] correctly shows a reall [?] LabelBorder entry for the imported component and all of its properties.

      Here, the auto-generated .form code from the Parent component using those PanelUI components also shows generated property code for the LabelBorder components:

      <Properties>
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors3.BorderEditor">
          <PropertyBean type="my.ui.components.LabelBorder">
            <Property name="title" type="java.lang.String" value="Section 3"/>
          </PropertyBean>
        </Property>
      </Properties> 

      For other, obviously completely similar sub-components it does not. The Border Customizer will show  [?] Unknown Border (Label Border) instead and <no properties> (also, in the properties view, the 'border' attribute is not printed bold), even though everything's in the same package hierarchy level.

      I cannot spot any difference in the component's properties, that give me any clue why this is.

      The Code Customizer will only show generated code entries for the 'good' examples like this:

      my.ui.components.LabelBorder labelBorder1 = new my.ui.components.LabelBorder();
      zuzug.setBorder(labelBorder1); 

      What's obviously missing here, though, is:

      labelBorder1.setTitle("Section1"); 

      This might explain, why the compiled version looses the label texts.

      Manually fiddling with Customize Code and adding correct code for the borked LabelBorder components, like above, will not show any different results, not even with full clean/build.

      Also, custom code can only be added 'pre-init', not as 'default code'.

      In NB 12.6, another effect shows for the 'borked' LabelBorder components, where printed the title font size is a little larger in the Preview Design view, than it is for the 'good' examples - there, the default font size from the super component TitledBorder is used.

      The only workaround to preserve title properties seems to be manually editing:
      properties -> [...] -> border/LabelBorder -> title [...] -> Plain text -> OK

      This step must be done before editing anything else, otherwise, the previous title value is gone and needs to be manually typed in the 'Plain text' field again.

      Closing and re-opening the editor will require to repeat this procedure.

      The issue(s) probably relate (at least in part) to NETBEANS-4798

      Attachments

        Activity

          People

            Unassigned Unassigned
            Imagias brad foster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: