Skip to content

Commit

Permalink
Save divider location for desktop, scans, adddocument dialog. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 18, 2020
1 parent 33f9cdf commit c751f08
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 119 deletions.
Expand Up @@ -778,9 +778,6 @@ public JKanzleiGUI() {
// this.pack();
//FrameUtils.centerFrame(this, null);

String dividerLocation = settings.getConfiguration(ClientSettings.CONF_DIVIDERLOCATION, "175");
// this.jSplitPane1.setDividerLocation(Integer.parseInt(dividerLocation));

ModuleMetadata rootModule = settings.getRootModule();

EditorsRegistry registry = EditorsRegistry.getInstance();
Expand Down
Expand Up @@ -859,18 +859,14 @@ public DesktopPanel() {
} catch (Throwable t) {
log.error("Could not set up timer task for automatic tag updates", t);
}
this.jSplitPane1.setDividerLocation(0.5d);

SwingUtilities.invokeLater(
new Runnable() {
public void run() {

jSplitPane1.setDividerLocation(0.5d);
}

}
);
this.jSplitPane1.setDividerLocation(0.5d);

ComponentUtils.restoreSplitPane(this.jSplitPane1, this.getClass(), "jSplitPane1");
ComponentUtils.restoreSplitPane(this.jSplitPane2, this.getClass(), "jSplitPane2");

ComponentUtils.persistSplitPane(this.jSplitPane1, this.getClass(), "jSplitPane1");
ComponentUtils.persistSplitPane(this.jSplitPane2, this.getClass(), "jSplitPane2");

UserSettings us = UserSettings.getInstance();
this.lblUserName.setText(us.getCurrentUser().getPrincipalId());
Expand Down Expand Up @@ -1463,7 +1459,7 @@ private void formAncestorResized(java.awt.event.HierarchyEvent evt) {//GEN-FIRST

private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
// TODO add your handling code here:
this.jSplitPane1.setDividerLocation(0.5d);
//this.jSplitPane1.setDividerLocation(0.5d);
}//GEN-LAST:event_formComponentResized

public void updateUserIcon() {
Expand Down
Expand Up @@ -148,18 +148,20 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="584" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="chkDeleteAfterAction" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="chkCaseTagging" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cmbCaseTag" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="chkDocumentTagging" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="chkDocumentTagging" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="chkCaseTagging" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="cmbDocumentTag" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cmbCaseTag" min="-2" max="-2" attributes="0"/>
<Component id="cmbDocumentTag" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
Expand All @@ -168,19 +170,18 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="chkDocumentTagging" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmbDocumentTag" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="chkCaseTagging" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmbCaseTag" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chkDeleteAfterAction" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="chkCaseTagging" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmbCaseTag" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chkDeleteAfterAction" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="chkDocumentTagging" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmbDocumentTag" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="395" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="365" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
Expand Up @@ -917,6 +917,12 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
Timer timer2 = new Timer();
TimerTask scannerUploadsTask = new ScannerLocalDocumentsUploadTimerTask();
timer2.schedule(scannerUploadsTask, 9500, 15000);

ComponentUtils.restoreSplitPane(this.splitTop, this.getClass(), "splitTop");
ComponentUtils.restoreSplitPane(this.splitMain, this.getClass(), "splitMain");

ComponentUtils.persistSplitPane(this.splitTop, this.getClass(), "splitTop");
ComponentUtils.persistSplitPane(this.splitMain, this.getClass(), "splitMain");

// final int numberOfScans=this.tblDirContent.getModel().getRowCount();
// new Thread(new Runnable() {
Expand Down Expand Up @@ -1105,34 +1111,34 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 584, Short.MAX_VALUE)
.add(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.add(chkDeleteAfterAction)
.add(18, 18, 18)
.add(chkCaseTagging)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmbCaseTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(chkDocumentTagging)
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(chkDocumentTagging)
.add(chkCaseTagging))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmbDocumentTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(cmbCaseTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(cmbDocumentTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(chkDocumentTagging)
.add(cmbDocumentTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(chkCaseTagging)
.add(cmbCaseTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(chkDeleteAfterAction)))
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(chkCaseTagging)
.add(cmbCaseTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(chkDeleteAfterAction))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE))
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(chkDocumentTagging)
.add(cmbDocumentTag, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE))
);

splitMain.setRightComponent(jPanel2);
Expand Down Expand Up @@ -1340,40 +1346,6 @@ public void run() {
}
}
}).start();
// try {
// this.pnlPreview.setVisible(false);
// this.pnlPreview.removeAll();
// ThreadUtils.setLayout(pnlPreview, new FlowLayout());
// JProgressBar loading = new JProgressBar();
// loading.setIndeterminate(true);
// this.pnlPreview.add(loading);
// this.pnlPreview.setVisible(true);
// ClientSettings settings = ClientSettings.getInstance();
// JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());
// IntegrationServiceRemote is = locator.lookupIntegrationServiceRemote();
// byte[] data = is.getObservedFile(fileName);
// String previewText = is.getObservedFilePreview(fileName);
//
// JComponent preview = DocumentViewerFactory.getDocumentViewer(fileName, previewText, data, this.pnlPreview.getWidth(), this.pnlPreview.getHeight());
// this.pnlPreview.setVisible(false);
// this.pnlPreview.remove(loading);
// ThreadUtils.setLayout(pnlPreview, new BorderLayout());
// this.pnlPreview.add(preview, BorderLayout.CENTER);
// this.pnlPreview.setVisible(true);
// //this.pnlPreview.setBounds(this.pnlPreview.getBounds());
//
// //preview.setBounds(0,0,this.pnlPreview.getWidth(),this.pnlPreview.getHeight());
// //this.pnlPreview.revalidate();
// //this.pnlPreview.repaint();
// //System.out.println(pnlPreview.getBounds());
// //System.out.println(preview.getBounds());
// } catch (Exception ex) {
// log.error(ex);
// this.pnlPreview.removeAll();
// this.pnlPreview.add(new JLabel("Vorschau nicht verfügbar..."));
// ThreadUtils.showErrorDialog(this, "Fehler beim Generieren der Vorschau: " + ex.getMessage(), "Fehler");
//
// }

}
}
Expand Down
Expand Up @@ -804,6 +804,14 @@ public AddDocumentFromTemplateDialog(java.awt.Frame parent, boolean modal, CaseF

this.jSplitPane1.setDividerLocation(0.5d);

ComponentUtils.restoreSplitPane(splitMain, this.getClass(), "splitMain");
ComponentUtils.restoreSplitPane(this.splitPlaceholders, this.getClass(), "splitPlaceholders");
ComponentUtils.restoreSplitPane(this.jSplitPane1, this.getClass(), "jSplitPane1");

ComponentUtils.persistSplitPane(splitMain, this.getClass(), "splitMain");
ComponentUtils.persistSplitPane(this.splitPlaceholders, this.getClass(), "splitPlaceholders");
ComponentUtils.persistSplitPane(this.jSplitPane1, this.getClass(), "jSplitPane1");

try {
//InitialContext context = new InitialContext(settings.getLookupProperties());
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());
Expand All @@ -817,7 +825,7 @@ public AddDocumentFromTemplateDialog(java.awt.Frame parent, boolean modal, CaseF
EditorsRegistry.getInstance().clearStatus();
}


this.initializing = false;

}
Expand Down
Expand Up @@ -1149,7 +1149,7 @@
<Component id="cmdClearSearch" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblDocumentHits" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="35" max="32767" attributes="0"/>
<Component id="cmdNewDocument" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cmdUploadDocument" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -1218,11 +1218,7 @@
<Container class="javax.swing.JSplitPane" name="splitDocuments">
<Properties>
<Property name="dividerLocation" type="int" value="400"/>
<Property name="resizeWeight" type="double" value="0.7"/>
</Properties>
<Events>
<EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="splitDocumentsPropertyChange"/>
</Events>

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
Expand Down
Expand Up @@ -931,17 +931,10 @@ public void mouseClicked(MouseEvent event) {
}

}

try {
String dividerLocation = ClientSettings.getInstance().getConfiguration(ClientSettings.CONF_DIVIDERLOCATION_DOCPREVIEW, "");
if (!"".equalsIgnoreCase(dividerLocation)) {
this.splitDocuments.setDividerLocation(Integer.parseInt(dividerLocation));
} else {
this.splitDocuments.setDividerLocation(0.7d);
}
} catch (Throwable t) {
log.error("Could not set divider location for doc preview", t);
}

this.splitDocuments.setDividerLocation(0.7d);
ComponentUtils.restoreSplitPane(splitDocuments, this.getClass(), "splitDocuments");
ComponentUtils.persistSplitPane(splitDocuments, this.getClass(), "splitDocuments");

ArrayList<CalculationPlugin> plugins = CalculationPluginUtil.loadLocalPlugins();
Collections.sort(plugins);
Expand Down Expand Up @@ -2423,12 +2416,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});

splitDocuments.setDividerLocation(400);
splitDocuments.setResizeWeight(0.7);
splitDocuments.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
splitDocumentsPropertyChange(evt);
}
});

jScrollPane7.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
Expand Down Expand Up @@ -5002,17 +4989,6 @@ private void cmdClearSearchActionPerformed(java.awt.event.ActionEvent evt) {//GE
this.txtSearchDocumentNamesKeyReleased(null);
}//GEN-LAST:event_cmdClearSearchActionPerformed

private void splitDocumentsPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_splitDocumentsPropertyChange
if (!this.initializing) {
if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) {
if (this.splitDocuments.getDividerLocation() > 0) {
ClientSettings s = ClientSettings.getInstance();
s.setConfiguration(ClientSettings.CONF_DIVIDERLOCATION_DOCPREVIEW, "" + this.splitDocuments.getDividerLocation());
}
}
}
}//GEN-LAST:event_splitDocumentsPropertyChange

private void cmdAddNoteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAddNoteActionPerformed
AddNoteDialog dlg = new AddNoteDialog(EditorsRegistry.getInstance().getMainWindow(), true, this.caseFolderPanel1, this.dto, this.tblReviewReasons);
dlg.setTitle("Notiz hinzufügen");
Expand Down
Expand Up @@ -702,9 +702,9 @@ public class ClientSettings {

public static final String CONF_HEIGHT="client.height";
public static final String CONF_WIDTH="client.width";
public static final String CONF_DIVIDERLOCATION="client.dividerlocation";
//public static final String CONF_DIVIDERLOCATION="client.dividerlocation";

public static final String CONF_DIVIDERLOCATION_DOCPREVIEW="client.dividerlocation.case.docpreview";
//public static final String CONF_DIVIDERLOCATION_DOCPREVIEW="client.dividerlocation.case.docpreview";

public static final String CONF_UI_FONTSIZEOFFSET="client.ui.fontsizeoffset";

Expand Down

0 comments on commit c751f08

Please sign in to comment.