Fixed layout.

Added handling for Date type.
This commit is contained in:
Raman 2018-02-07 10:27:19 -05:00
parent 9ef90f081e
commit c964ffa134
2 changed files with 43 additions and 20 deletions

View File

@ -16,17 +16,20 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="hdrPanel" min="-2" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" pref="400" max="-2" attributes="0"/> <Component id="hdrPanel" max="32767" attributes="0"/>
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
</Group>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace min="3" pref="3" max="-2" attributes="0"/> <EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="hdrPanel" min="-2" max="-2" attributes="0"/> <Component id="hdrPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="6" pref="6" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" pref="250" max="-2" attributes="0"/> <Component id="jPanel1" pref="249" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -37,6 +40,11 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="plistTableScrollPane"> <Container class="javax.swing.JScrollPane" name="plistTableScrollPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/> <BorderConstraints direction="Center"/>
@ -52,16 +60,17 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace min="330" pref="330" max="-2" attributes="0"/> <EmptySpace pref="320" max="32767" attributes="0"/>
<Component id="exportButton" min="-2" max="-2" attributes="0"/> <Component id="exportButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/> <EmptySpace min="0" pref="6" max="32767" attributes="0"/>
<Component id="exportButton" min="-2" max="-2" attributes="0"/> <Component id="exportButton" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>

View File

@ -33,6 +33,7 @@ import javax.swing.JFileChooser;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.TableCellRenderer; import javax.swing.table.TableCellRenderer;
@ -96,7 +97,7 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
private void customize() { private void customize() {
//outlineView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //outlineView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
//outlineView.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //outlineView.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@ -105,8 +106,11 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
explorerManager = new ExplorerManager(); explorerManager = new ExplorerManager();
} }
outline.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
plistTableScrollPane.setViewportView(outlineView); plistTableScrollPane.setViewportView(outlineView);
outline.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN); outline.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
this.setVisible(true); this.setVisible(true);
@ -127,6 +131,8 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
exportButton = new javax.swing.JButton(); exportButton = new javax.swing.JButton();
jPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setLayout(new java.awt.BorderLayout());
plistTableScrollPane.setBorder(null);
jPanel1.add(plistTableScrollPane, java.awt.BorderLayout.CENTER); jPanel1.add(plistTableScrollPane, java.awt.BorderLayout.CENTER);
org.openide.awt.Mnemonics.setLocalizedText(exportButton, org.openide.util.NbBundle.getMessage(PListViewer.class, "PListViewer.exportButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(exportButton, org.openide.util.NbBundle.getMessage(PListViewer.class, "PListViewer.exportButton.text")); // NOI18N
@ -140,14 +146,15 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
hdrPanel.setLayout(hdrPanelLayout); hdrPanel.setLayout(hdrPanelLayout);
hdrPanelLayout.setHorizontalGroup( hdrPanelLayout.setHorizontalGroup(
hdrPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) hdrPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(hdrPanelLayout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, hdrPanelLayout.createSequentialGroup()
.addGap(330, 330, 330) .addContainerGap(320, Short.MAX_VALUE)
.addComponent(exportButton)) .addComponent(exportButton)
.addContainerGap())
); );
hdrPanelLayout.setVerticalGroup( hdrPanelLayout.setVerticalGroup(
hdrPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) hdrPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(hdrPanelLayout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, hdrPanelLayout.createSequentialGroup()
.addGap(10, 10, 10) .addGap(0, 6, Short.MAX_VALUE)
.addComponent(exportButton)) .addComponent(exportButton))
); );
@ -155,16 +162,18 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hdrPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hdrPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(5, 5, 5))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(3, 3, 3) .addGap(3, 3, 3)
.addComponent(hdrPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hdrPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -323,7 +332,11 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
} else { } else {
return new PropKeyValue(key, PropertyType.NUMBER, new Float(number.floatValue())) ; return new PropKeyValue(key, PropertyType.NUMBER, new Float(number.floatValue())) ;
} }
} else if (value instanceof NSData ) { } else if (value instanceof NSDate) {
NSDate date = (NSDate) value;
return (new PropKeyValue(key, PropertyType.DATE, date.toString()));
}
else if (value instanceof NSData ) {
return new PropKeyValue(key, PropertyType.DATA, Bundle.PListViewer_DataType_message()); return new PropKeyValue(key, PropertyType.DATA, Bundle.PListViewer_DataType_message());
} else if (value instanceof NSArray) { } else if (value instanceof NSArray) {
List<PropKeyValue> children = new ArrayList<>(); List<PropKeyValue> children = new ArrayList<>();
@ -387,6 +400,7 @@ public class PListViewer extends javax.swing.JPanel implements FileTypeViewer, E
STRING, STRING,
NUMBER, NUMBER,
BOOLEAN, BOOLEAN,
DATE,
DATA, DATA,
ARRAY, ARRAY,
DICTIONARY DICTIONARY