Coder Social home page Coder Social logo

Comments (3)

ArchibaldBienetre avatar ArchibaldBienetre commented on June 12, 2024 1

Something like this would be great: If the location menu items had IDs, we could use these selection (rather than absolute coordinates):
TestFX/TestFX#662 (comment)

from fxfilechooser.

ArchibaldBienetre avatar ArchibaldBienetre commented on June 12, 2024

(Working with v0.0.9)

I think there is only working with selectors where you can, then choosing click coordinates based on it.

Here's what I got right now: Opening the directory dropdown for choosing the directory, then selecting the first location item there

image

    SplitMenuButton chooseDirectory = robot.lookup("#chooser").queryAs(SplitMenuButton.class);
    Bounds chooseAbsoluteBounds = chooseDirectory.localToScreen(chooseDirectory.getBoundsInLocal());

    // open dropdown with pre-programmed locations
    robot.clickOn(chooseAbsoluteBounds.getMaxX() - 10, chooseAbsoluteBounds.getMaxY() - 10);

    // choose first item in dropdown (user home)
    robot.clickOn(chooseAbsoluteBounds.getMinX() + 20, chooseAbsoluteBounds.getMaxY() + 20);

To then select the first in the list of listed files, I have this code:

private void chooseFirstInListOfFiles(FxRobot robot) {
    ListView<?> listOfFiles = robot.lookup("#listOfFiles").queryListView();
    // I cannot do this programmatically, it seems
    //        listOfFiles.getSelectionModel().selectFirst();
    //        listOfFiles.refresh();
    //        robot.clickOn(listOfFiles);

    clickOnUpperLeftPlusOffset(robot, listOfFiles, 30);
}

private void clickOnUpperLeftPlusOffset(FxRobot robot, Node node, int offset) {
    Bounds absoluteBounds = node.localToScreen(node.getBoundsInLocal());
    robot.clickOn(absoluteBounds.getMinX() + offset, absoluteBounds.getMinY() + offset);
}

from fxfilechooser.

Oliver-Loeffler avatar Oliver-Loeffler commented on June 12, 2024

Thanks for this very nice idea, I will look into this and see, if I get it working.

from fxfilechooser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.