Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - areichel

Pages: [1]
1
Community Technical Support / CoreDumps on HPUX
« on: April 16, 2015, 09:01:23 AM »
Dear Support-Team,

testing on HPUX, I will get java coredumps when starting the SwingSet2 application.
I have tested both Java 6 and Java 7. It seems to be Font-related and I have tried all possible combinations on fonts in the default.conf file.

Please see the relevant logfiles attached. Is there anything I can do about?


2
Good Morning,

please how can I switch between "Browse Server" and "Browse Client" at run time? I tried the following without success:

Code: [Select]
     if (AjaxSwingManager.isAjaxSwingRunning()) {
            HashMap propertiesMap = com.creamtec.ajaxswing.core.AjaxSwingPropertiesManager.getInstance().getPropertiesMap();
            for (Object o : propertiesMap.entrySet()) {
                Entry entry = (Entry) o;
                String appName = (String) entry.getKey();
                com.creamtec.ajaxswing.core.AjaxSwingProperties properties = (com.creamtec.ajaxswing.core.AjaxSwingProperties) entry.getValue();
                properties.put("component.javax.swing.JFileChooser.browseClient", "false");
                properties.setProperty("component.javax.swing.JFileChooser.browseClient", "false");
            }
        }

Please advice, I thank you in advance.
Best regards

3
Dear All.

it looks like AjaxSwing does not handle the tokens of a StyledDocument well. Please see the attached screen shots. I can contributed samples if needed.
Would be great to get any response.

Thank you and best regards

4
Community Technical Support / List of supported/unsupported features
« on: October 02, 2014, 04:46:06 AM »
Dear All,

please is there a reliable list of supported/unsupported features? AjaxSwing Ads claim "100% conversion from Swing", but there are a couple of things which do not seem to work, like:

- copy'n paste
- DnD
- Mouse Wait cursor
- Dialog setLocationBy Platform
- Fonts (hard crash of the JVM!), especially when trying Highlighters in TextArea

I do not complain on the fact, that certain features can not be supported. In fact AjaxSwing does a great job. I only point on the fact that we need to know what is not supported in order to avoid very time intense trial'n error.

Thank you and best regards

5
Dear All,

there is a bug with the JTextArea.

textArea.setText("Row1 \n\t Row2 \n\t Row3");
String text=textArea.getText();

results in text="Row1 ", all the other content is cut off -- but visible in the control though.
Any fixes or workarounds?

Best regards

6
Community Technical Support / Copy Content to Clipboard
« on: September 28, 2014, 06:00:31 AM »
Good Day,

please what is the correct way to transfer content to the browser's clipboard, so it can be pasted outside of the browser?

Code: [Select]
Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable transferable = new BasicTransferable("", stringBuilder.toString());
systemClipboard.setContents(transferable, null);

Does not work.  :(

Code: [Select]
Clipboard clipboard = ClientAgent.getCurrentInstance().getClipboard();
clipboard.setContents(transferable, null);

Does not work either.  :-\

So I have to show the content in a new tab where to copy from:
Code: [Select]
ClientAgent.getCurrentInstance().clearAllowedDownloads();
AgentInitData initData = ClientAgent.getCurrentInstance().getInitData();
             
File p = new File(initData.tempDirPath + "/" + initData.clientId);
if (!p.exists()) {
                    p.mkdirs();
                }
File f = new File(p, "table_"+ System.nanoTime() + ".htm");
writer = new FileWriter(f);
writer.write(stringBuilder.toString());
writer.flush();
writer.close();
AjaxSwingManager.openInNewTab("/ajaxswing/temp/" + initData.clientId + "/" + f.getName());

But this is a rather ugly work-around.
Please advice, thank you and best regards

7
Community Technical Support / Showing a Mouse Wait Cursoor
« on: September 28, 2014, 05:53:46 AM »
Good Day.

Please how can I show a mouse wait cursor?
GlassPane.setCursor() works well in Swing, but does not do anything in AjaxSwing.
JControl.setCursor() does not work in AjaxSwing either.

So what is the correct approach please?
Thank you and best regards

8
Dear All,

please is there a way of preventing the Java instance from shutting down as long as a certain process is still running?
I understand that there is a shutdown-hook, which takes down the java instance and all its threads when the browser session dies. How can I delay this shutdown or prevent it inside a certain process, which must finish successful at any cost.

(Of course, I could/should implement this process as independent service but I am not keen on the communication between client/server).

Thank you and best regards!

9
Good Morning,

there is another annoying issue: If you have a JTable inside a JScrollPane and you scroll down using the MouseWheel or dragging the vertical ScrollBar, then the JTable scrolls down correctly first (you actually can see the content for a second), but then suddenly it jumps back to the position where you started.
The table and the scrollpane are not linked to any listeners/events. No event should be fired from my code.

Only modification is on the CellRenderer (plain JTextField, formatting negative numbers red, Dates etc).

Only work around is to set the row-cursor and us the down cursor key to scroll row by row.
Tested with AjaxSwing 4.1.1 on Chrome and FireFox on Linux.

Any work around/fix on this please?

10
Community Technical Support / JFileChooser acts eratic
« on: January 04, 2014, 03:44:25 AM »
Dear CreamTec Team,

the JFileChooser gives me a lot of headache, as it works sometimes but fails often without any reason or message.

Expected workflow:
1) User clicks on a button
2) Application offers a modal dialog for inputing a few parameters and clicks OK
3) Dialog should hide, Application reads the parameters from the dialog, dialog is disposed
4) A report is rendered and writes a file (e.g. /tmp/report.xls) on the server's filesystem
5) JFileChooser engages, and the FileInputStream of /tmp/report.xls is written to FileOutputStream of JFileChooser.getSelectedFile()

I tested this successful a few times both with Chrome and FireFox, so in general the workflow seems to be correct. However, in 90% of my tests step (5) fails: the FileChooser dialog does not come up and no file is written/downloaded to the client. There is no error/warning/message/NPE whatever. Steps 1)--4) work, I ALWAYS can see the file /tmp/report.xls on the server! I even tried to give it unique timestamps like /tmp/reports_1862381631.xls, did not help.

There is only one more obstacle, which I noticed: Disposing the dialog in step (3) does not remove the dialog. In fact, the dialog stays visible, until step 4) is concluded, while step 4) definitely starts serially after step 3). I tested also beginOperation/endOperation, it die not help.

Please would you like to have a look at the code below and give me any hint how to get it work reliable? Thank you so much in advance!

Best regards

Code: [Select]
try {
final FixFormatReport fixFormatReport = new FixFormatReport(selectedFileObject.uri);
Collection<ETLConnection.Parameter> parameterSet = fixFormatReport.getParameterSet();
final HashMap<String, ETLConnection.Parameter> parameterMap = new HashMap<String, ETLConnection.Parameter>();
boolean canceled = false;
if (parameterSet.size() > 0) {
ParameterDialog parameterDialog = new ParameterDialog(parameterSet, owner);
canceled = parameterDialog.canceled;
for (ETLConnection.Parameter p : parameterDialog.parameters) {
parameterMap.put(p.name, p);
}
parameterDialog.dispose();
}

if (!canceled) {
logger.info("Start to build the report");
File tmpFile = File.createTempFile("report", ".xls");
fixFormatReport.build(tmpFile, parameterMap, null);

JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setSelectedFile(tmpFile); // user will see this name during download
if (JFileChooser.APPROVE_OPTION == chooser.showSaveDialog(owner)) {
File f = chooser.getSelectedFile();
IOUtils.copy(new FileInputStream(tmpFile), new FileOutputStream(f));
}
}
} catch (Exception ex) {
ErrorDialog.show(owner, ex);
}

For the sake of completeness the parameter dialog:
Code: [Select]
public class ParameterDialog extends JDialog {

public boolean canceled = true;
public Collection<Parameter> parameters;
private ArrayList<JTextField> textFields = new ArrayList<JTextField>();

Action cancelAction = new AbstractAction("Cancel") {
@Override
public void actionPerformed(ActionEvent e) {
canceled = true;
setVisible(false);
}
};

Action applyAction = new AbstractAction("Apply") {
@Override
public void actionPerformed(ActionEvent e) {
for (JTextField textfield : textFields) {
Parameter p = (Parameter) textfield.getClientProperty("parameter");
p.value = textfield.getText();
}
canceled = false;
setVisible(false);
}
};

public ParameterDialog(
Collection<Parameter> parameters, Dialog owner) {
super(owner);
this.parameters = parameters;
buildUI();
}

public ParameterDialog(
Collection<Parameter> parameters, Frame owner) {
super(owner);
this.parameters = parameters;
buildUI();
}

public final void buildUI() {
setTitle("Define the parameters of the Query");
setModal(true);
setLayout(new BorderLayout(6, 6));
setLocationByPlatform(true);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
setAlwaysOnTop(true);

JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
bottomPanel.add(new JButton(cancelAction));
bottomPanel.add(new JButton(applyAction));
add(bottomPanel, BorderLayout.SOUTH);

JPanel centerPanel = new JPanel(new GridBagLayout());
Insets insets = new Insets(6, 6, 6, 6);
GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0f, 0f,
GridBagConstraints.BASELINE_LEADING, GridBagConstraints.NONE,
insets, 2, 2);
for (Parameter p : parameters) {
centerPanel.add(new JLabel(p.name), constraints);

constraints.gridx++;
centerPanel.add(new JLabel(p.classname), constraints);

JTextField textField = new JTextField(16);
textField.setName(p.name);
textField.setToolTipText("Key in the value for parameter " + p.name);
textField.putClientProperty("parameter", p);
textFields.add(textField);

constraints.gridx++;
centerPanel.add(textField, constraints);

constraints.gridx = 0;
constraints.gridy++;
}
add(centerPanel, BorderLayout.CENTER);

pack();
setVisible(true);
}
}

11
Hi CreamTec,

eventually ClientAgent.getCurrentInstance().getHTMLPage() returns null!
Why? In my understanding that should never happen as long as the website is open and the application is running. I work around now like that:

Code: [Select]
if (AjaxSwingManager.isAjaxSwingRunning()) try {
ClientAgent instance=ClientAgent.getCurrentInstance();
if (instance!=null) {
AbstractDocument document=instance.getHTMLPage();
if (document!=null) {
document.setComponentDirty(LoggerConsole.this, true);
}
instance.setUpdateBrowser(true);
}
// ClientAgent.getCurrentInstance().getHTMLPage().setComponentDirty(LoggerConsole.this, true);
// ClientAgent.getCurrentInstance().setUpdateBrowser(true);
} catch (Exception ex) {
logger.log(Level.SEVERE, "This should never happen", ex);
}

But it is rather ugly.

12
Community Technical Support / Redirecting Out and Err
« on: January 20, 2013, 04:40:48 AM »
Hello CreamTec.

I would like to redirect OUT and ERR into a JTextArea:

Code: [Select]
OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOException {
textArea.append(String.valueOf((char) b));
}

@Override
public void write(byte[] b, int off, int len) throws IOException {
textArea.append(new String(b, off, len));
}

@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
};
System.setOut(new PrintStream(out, true));
System.setErr(new PrintStream(out, true));

This works well for a while but eventually stops to work. Instead the OUT is still shown in the $AJAXSWING_HOME/logs/$1_$3.out  (as defined in clientAgent.sh). com.creamtec.ajaxswing.JVMProcess is probably the culprit and we seem to fight for the redirect.

Is there a way to stop AJAXSWING from redirecting OUT but leave the OUT to me?

13
Community Technical Support / Multiline Line Text Widget
« on: January 19, 2013, 07:17:08 AM »
Hello CreamTec,

currently I am evaluating AjaxSwing and in general it works very well. There is only one show stopper for me: Multi Line Text Widgets (like JTextArea or JTextPane). The problem ist that it never shows more than the first row only when setting Text like this:

JTextArea textArea=new JTextArea("1\n2\n3\n");
JScrollPane scrollPane=new JScrollPane(textArea);
panel.add(scrollPane);

Now I wonder if it is a limitation of the framework or if I missed anything.

Thanks and best regards



Pages: [1]